mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-08 10:42:50 -06:00
progress with scandinavian
This commit is contained in:
@@ -102,127 +102,66 @@ resource ResScand = ParamScand ** open Prelude in {
|
||||
--
|
||||
-- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} =
|
||||
-- \i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ;
|
||||
--
|
||||
-- mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} =
|
||||
-- \i,me,my,n,p -> {
|
||||
-- s = table {
|
||||
-- Nom => i ;
|
||||
-- Acc => me ;
|
||||
-- Gen => my
|
||||
-- } ;
|
||||
-- a = {
|
||||
-- n = n ;
|
||||
-- p = p
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
---- These functions cover many cases; full coverage inflectional patterns are
|
||||
---- in $MorphoScand$.
|
||||
--
|
||||
-- regN : Str -> {s : Number => Case => Str} = \car ->
|
||||
-- mkNoun car (car + "'s") (car + "s") (car + "s'") ;
|
||||
--
|
||||
-- regA : Str -> {s : AForm => Str} = \warm ->
|
||||
-- mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ;
|
||||
--
|
||||
-- regV : Str -> {s : VForm => Str} = \walk ->
|
||||
-- mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ;
|
||||
--
|
||||
|
||||
-- For $Noun$.
|
||||
|
||||
artDef : GenNum -> Str = \gn -> gennumForms "den" "det" "de" ! gn ;
|
||||
|
||||
mkNP : (x1,_,_,_,x5 : Str) -> GenNum -> Person ->
|
||||
{s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,gn,p -> {
|
||||
s = table {
|
||||
NPNom => du ;
|
||||
NPAcc => dig ;
|
||||
NPPoss g => gennumForms din ditt dina ! g
|
||||
} ;
|
||||
a = {
|
||||
gn = gn ;
|
||||
p = p
|
||||
}
|
||||
} ;
|
||||
|
||||
gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de ->
|
||||
table {
|
||||
SgUtr => den ;
|
||||
SgNeutr => det ;
|
||||
_ => de
|
||||
} ;
|
||||
|
||||
-- regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
|
||||
-- mkNP that that (that + "'s") n P3 ;
|
||||
--
|
||||
---- We have just a heuristic definition of the indefinite article.
|
||||
---- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
---- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
--
|
||||
-- artIndef = pre {
|
||||
-- "a" ;
|
||||
-- "an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }
|
||||
-- } ;
|
||||
--
|
||||
-- artDef = "the" ;
|
||||
--
|
||||
---- For $Verb$.
|
||||
--
|
||||
-- Verb : Type = {
|
||||
-- s : VForm => Str
|
||||
-- } ;
|
||||
--
|
||||
-- VerbForms : Type =
|
||||
-- Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||
--
|
||||
-- VP : Type = {
|
||||
-- s : VerbForms ;
|
||||
-- s2 : Agr => Str
|
||||
-- } ;
|
||||
--
|
||||
-- predV : Verb -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.s ! VInf ;
|
||||
-- fin = presVerb verb agr ;
|
||||
-- past = verb.s ! VPast ;
|
||||
-- part = verb.s ! VPPart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,Pos,ODir> => vf fin [] ;
|
||||
-- <Pres,Simul,Pos,OQuest> => vf (does agr) inf ;
|
||||
-- <Pres,Simul,Neg,_> => vf (doesnt agr) inf ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,Pos,ODir> => vf past [] ;
|
||||
-- <Past,Simul,Pos,OQuest> => vf "did" inf ;
|
||||
-- <Past,Simul,Neg,_> => vf "didn't" inf ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- predAux : Aux -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.inf ;
|
||||
-- fin = verb.pres ! b ! agr ;
|
||||
-- past = verb.past ! b ! agr ;
|
||||
-- part = verb.ppart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,_, _> => vf fin [] ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,_, _> => vf past [] ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
-- } ;
|
||||
--
|
||||
|
||||
-- For $Verb$.
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str
|
||||
} ;
|
||||
|
||||
VP = {
|
||||
s : SForm => {
|
||||
fin : Str ; -- V1 har ---s1
|
||||
inf : Str -- V2 sagt ---s4
|
||||
} ;
|
||||
a1 : Polarity => Str ; -- A1 inte ---s3
|
||||
n2 : Agr => Str ; -- N2 dig ---s5
|
||||
a2 : Str ; -- A2 idag ---s6
|
||||
ext : Str ; -- S-Ext att hon går ---s7
|
||||
--- ea1,ev2, --- these depend on params of v and a1
|
||||
en2,ea2,eext : Bool -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = \\a => vp.n2 ! a ++ obj ! a ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = True ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
----- This is not functional.
|
||||
--
|
||||
-- insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
@@ -232,10 +171,10 @@ resource ResScand = ParamScand ** open Prelude in {
|
||||
--
|
||||
-- presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
|
||||
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
|
||||
--
|
||||
-- infVP : VP -> Agr -> Str = \vp,a ->
|
||||
-- (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ;
|
||||
--
|
||||
|
||||
infVP : VP -> Agr -> Str = \vp,a ->
|
||||
(vp.s ! VInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
|
||||
|
||||
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
|
||||
-- case agr of {
|
||||
-- {n = Sg ; p = P3} => has ;
|
||||
@@ -275,26 +214,29 @@ resource ResScand = ParamScand ** open Prelude in {
|
||||
-- {n = Pl ; p = P2} => "yourselves" ;
|
||||
-- {n = Pl ; p = P3} => "themselves"
|
||||
-- } ;
|
||||
--
|
||||
---- For $Sentence$.
|
||||
--
|
||||
-- Clause : Type = {
|
||||
-- s : Tense => Anteriority => Polarity => Ord => Str
|
||||
-- } ;
|
||||
--
|
||||
-- mkS : Str -> Agr -> VerbForms -> (Agr => Str) -> Clause =
|
||||
-- \subj,agr,verb,compl0 -> {
|
||||
-- s = \\t,a,b,o =>
|
||||
-- let
|
||||
-- verb = verb ! t ! a ! b ! o ! agr ;
|
||||
-- compl = compl0 ! agr
|
||||
-- in
|
||||
-- case o of {
|
||||
-- ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
|
||||
-- OQuest => verb.fin ++ subj ++ verb.inf ++ compl
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
|
||||
mkS : Str -> Agr ->
|
||||
(SForm => {fin,inf : Str}) -> (Polarity => Str) -> (Agr => Str) -> Clause =
|
||||
\subj,agr,verb,adv,compl0 -> {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
verb = verb ! VFinite t a ;
|
||||
neg = adv ! b ;
|
||||
compl = compl0 ! agr
|
||||
in
|
||||
case o of {
|
||||
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
|
||||
Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ;
|
||||
Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
--
|
||||
---- For $Numeral$.
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user