diff --git a/lib/resource-1.0/scandinavian/AdjectiveScand.gf b/lib/resource-1.0/scandinavian/AdjectiveScand.gf index cd493b6aa..488cf4541 100644 --- a/lib/resource-1.0/scandinavian/AdjectiveScand.gf +++ b/lib/resource-1.0/scandinavian/AdjectiveScand.gf @@ -8,7 +8,7 @@ incomplete concrete AdjectiveScand of Adjective = isPre = True } ; ComparA a np = { - s = \\_ => a.s ! AF ACompar Nom ++ conjThan ++ np.s ! NPNom ; + s = \\_ => a.s ! AF ACompar Nom ++ conjThan ++ np.s ! nominative ; isPre = False } ; diff --git a/lib/resource-1.0/scandinavian/AdverbScand.gf b/lib/resource-1.0/scandinavian/AdverbScand.gf index f3b1222e1..eec9d3e95 100644 --- a/lib/resource-1.0/scandinavian/AdverbScand.gf +++ b/lib/resource-1.0/scandinavian/AdverbScand.gf @@ -5,13 +5,13 @@ incomplete concrete AdverbScand of Adverb = CatScand ** open DiffScand, ResScand s = a.s ! adverbForm } ; ComparAdvAdj cadv a np = { - s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ np.s ! NPNom + s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ np.s ! nominative } ; ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ s.s ! Sub } ; - PrepNP prep np = {s = prep.s ++ np.s ! NPAcc} ; + PrepNP prep np = {s = prep.s ++ np.s ! accusative} ; AdAdv = cc2 ; @@ -20,7 +20,7 @@ incomplete concrete AdverbScand of Adverb = CatScand ** open DiffScand, ResScand } ; AdvSC s = s ; - AdnCAdv cadv = {s = cadv.s ++ "than"} ; + AdnCAdv cadv = {s = cadv.s ++ conjThan} ; oper adverbForm : AForm = AF (APosit (Strong SgNeutr)) Nom ; diff --git a/lib/resource-1.0/scandinavian/CatScand.gf b/lib/resource-1.0/scandinavian/CatScand.gf index 11e519230..3e9cb694f 100644 --- a/lib/resource-1.0/scandinavian/CatScand.gf +++ b/lib/resource-1.0/scandinavian/CatScand.gf @@ -1,5 +1,5 @@ incomplete concrete CatScand of Cat = - open ParamScand, Prelude, DiffScand, (R = ParamX) in { + open ResScand, Prelude, DiffScand, (R = ParamX) in { lincat Text, Phr, Utt = {s : Str} ; @@ -16,21 +16,23 @@ incomplete concrete CatScand of Cat = QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; +-- Constructed in $Verb$. + VP = { - v : SForm => { - v1 : Str ; -- V1 har ---s1 - v2 : Str -- V2 sagt ---s4 + s : SForm => { + fin : Str ; -- V1 har ---s1 + inf : Str -- V2 sagt ---s4 } ; - a1 : Bool => Str ; -- A1 inte ---s3 + a1 : Polarity => Str ; -- A1 inte ---s3 n2 : Agr => Str ; -- N2 dig ---s5 a2 : Str ; -- A2 idag ---s6 - ext : Str ; -- S extraposition ---s7 - ea1,ev2,en2,ea2,eext : Bool -- indicate if the field exists + ext : Str ; -- S-Ext att hon går ---s7 + en2,ea2,eext : Bool -- indicate if the field exists } ; - V, VS, VQ, VA = {s : VForm => Str} ; - V2, VV, V2A = {s : VForm => Str} ** {c2 : Str} ; - V3 = {s : VForm => Str} ** {c2,c3 : Str} ; + V, VS, VQ, VA = Verb ; + V2, VV, V2A = Verb ** {c2 : Str} ; + V3 = Verb ** {c2,c3 : Str} ; AP = {s : AFormPos => Str ; isPre : Bool} ; Comp = {s : AFormPos => Str} ; @@ -43,12 +45,17 @@ incomplete concrete CatScand of Cat = Adv, AdV, AdA, AdS, AdN = {s : Str} ; Prep = {s : Str} ; - Det, Quant = {s : Gender => Str ; n : Number ; det : DetSpecies } ; - Predet, Num, Ord = {s : Str} ; +-- Constructed in $Noun$. - CN,N = Noun ; - -- {s : Number => Species => Case => Str ; g : Gender} ; - PN = {s : Case => Str ; g : Gender} ; + Det, Quant = {s : Gender => Str ; n : Number ; det : DetSpecies } ; + Predet = {s : GenNum => Str} ; + Num = {s : Gender => Str} ; + Ord = {s : Str} ; + + N = Noun ; + -- {s : Number => Species => Case => Str ; g : Gender} ; + CN = {s : Number => DetSpecies => Case => Str ; g : Gender} ; + PN = {s : Case => Str ; g : Gender} ; Pron, NP = {s : NPForm => Str ; a : Agr} ; N2 = Noun ** {c2 : Str} ; N3 = Noun ** {c2,c3 : Str} ; diff --git a/lib/resource-1.0/scandinavian/DiffScand.gf b/lib/resource-1.0/scandinavian/DiffScand.gf index 61a372f11..ba0eecec8 100644 --- a/lib/resource-1.0/scandinavian/DiffScand.gf +++ b/lib/resource-1.0/scandinavian/DiffScand.gf @@ -1,4 +1,6 @@ -interface DiffScand = { +interface DiffScand = open ResScand, Prelude in { + +-- Parameters. param Gender ; @@ -6,7 +8,68 @@ interface DiffScand = { oper neutrum, utrum : Gender ; + gennum : Gender -> Number -> GenNum ; + + agrP3 : Gender -> Number -> Agr = \g,n -> { + gn = gennum g n ; + p = P3 + } ; + +-- This is the form of the noun in "det stora berget"/"det store berg". + + detDef : Species ; + +-- Strings. + conjThat : Str ; conjThan : Str ; infMark : Str ; + + artIndef : Gender => Str ; + + verbHave : {s : VForm => Str} ; + + auxFut : Str ; + auxCond : Str ; + + negation : Polarity => Str ; + +-- This function is here because it depends on $verbHave, auxFut, auxCond$. + + predV : Verb -> VP = \verb -> + let + vfin : Tense -> Str = \t -> verb.s ! vFin t Act ; + vsup = verb.s ! VI (VSupin Act) ; + vinf = verb.s ! VI (VInfin Act) ; + + har : Tense -> Str = \t -> verbHave.s ! vFin t Act ; + ha : Str = verbHave.s ! VI (VInfin Act) ; + + vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> { + fin = fin ; inf = inf + } ; + + in { + s = table { + VFinite t Simul => case t of { + Pres | Past => vf (vfin t) [] ; + Fut => vf auxFut vinf ; + Cond => vf auxCond vinf + } ; + VFinite t Anter => case t of { + Pres | Past => vf (har t) vsup ; + Fut => vf auxFut (ha ++ vsup) ; + Cond => vf auxCond (ha ++ vsup) + } ; + VImperat => vf (verb.s ! VF (VImper Act)) [] ; + VInfinit Simul => vf [] vinf ; + VInfinit Anter => vf [] (ha ++ vsup) + } ; + a1 : Polarity => Str = negation ; + n2 : Agr => Str = \\_ => [] ; + a2 : Str = [] ; + ext : Str = [] ; + en2,ea2,eext : Bool = False -- indicate if the field exists + } ; + } diff --git a/lib/resource-1.0/scandinavian/ExtScand.gf b/lib/resource-1.0/scandinavian/ExtScand.gf index 50aaa2193..323e16790 100644 --- a/lib/resource-1.0/scandinavian/ExtScand.gf +++ b/lib/resource-1.0/scandinavian/ExtScand.gf @@ -1,26 +1,14 @@ ---concrete ExtScand of ExtScandAbs = CatScand ** open ResScand in { --- --- lincat --- --- Aux = {s : Polarity => Str} ; --- --- lin --- --- PredAux np aux vp = mkS (np.s ! Nom) np.a --- (\\t,ant,b,ord,agr => --- let --- fin = aux.s ! b ; --- vf : Str -> Str -> {fin, inf : Str} = \x,y -> --- {fin = x ; inf = y} ; --- in --- case ant of { --- Simul => vf fin [] ; --- Anter => vf fin "have" --- } --- ) --- (\\agr => infVP vp agr) ; --- --- can_Aux = {s = \\p => posneg p "can"} ; ---- cannt --- must_Aux = {s = \\p => posneg p "must"} ; --- ---} +incomplete concrete ExtScand of ExtScandAbs = + CatScand ** open DiffScand, ResScand in { + + lin + DefSgN predet noun = let g = noun.g in { + s = \\c => predet.s ! gennum g Sg ++ noun.s ! Sg ! Def ! caseNP c ; + a = agrP3 g Sg + } ; + DefPlN predet noun = let g = noun.g in { + s = \\c => predet.s ! Plg ++ noun.s ! Pl ! Def ! caseNP c ; + a = agrP3 g Sg + } ; + +} diff --git a/lib/resource-1.0/scandinavian/ExtScandAbs.gf b/lib/resource-1.0/scandinavian/ExtScandAbs.gf new file mode 100644 index 000000000..e23f05f8e --- /dev/null +++ b/lib/resource-1.0/scandinavian/ExtScandAbs.gf @@ -0,0 +1,9 @@ +abstract ExtScandAbs = Cat ** { + + fun + +-- Definite form of simple nouns without article; neither $Num$ nor $Ord$ allowed. + + DefSgN, DefPlN : Predef -> N -> NP ; + +} diff --git a/lib/resource-1.0/scandinavian/NounScand.gf b/lib/resource-1.0/scandinavian/NounScand.gf index e82ea04e5..a7a316486 100644 --- a/lib/resource-1.0/scandinavian/NounScand.gf +++ b/lib/resource-1.0/scandinavian/NounScand.gf @@ -1,50 +1,73 @@ ---concrete NounScand of Noun = CatScand ** open ResScand, Prelude in { --- --- flags optimize=all_subs ; --- --- lin --- DetCN det cn = { --- s = \\c => det.s ++ cn.s ! det.n ! c ; --- a = agrP3 det.n --- } ; --- UsePN pn = pn ** {a = agrP3 Sg} ; --- UsePron p = p ; --- --- MkDet pred quant num ord = { --- s = pred.s ++ quant.s ++ num.s ++ ord.s ; --- n = quant.n --- } ; --- --- PossPronSg p = {s = p.s ! Gen ; n = Sg} ; --- PossPronPl p = {s = p.s ! Gen ; n = Pl} ; --- --- NoPredet, NoNum, NoOrd = {s = []} ; --- NumInt n = n ; --- --- NumNumeral numeral = {s = numeral.s ! NCard} ; --- OrdNumeral numeral = {s = numeral.s ! NOrd} ; --- --- AdNum adn num = {s = adn.s ++ num.s} ; --- --- OrdSuperl a = {s = a.s ! AAdj Superl} ; --- --- DefSg = {s = artDef ; n = Sg} ; --- DefPl = {s = artDef ; n = Pl} ; --- --- IndefSg = {s = artIndef ; n = Sg} ; --- IndefPl = {s = [] ; n = Pl} ; --- --- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ; --- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ; --- --- AdjCN ap cn = { --- s = \\n,c => preOrPost ap.isPre (ap.s ! agrP3 n) (cn.s ! n ! c) --- } ; --- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; --- --- SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ; --- QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ; --- --- UseN n = n ; --- ---} +incomplete concrete NounScand of Noun = + CatScand ** open DiffScand, ResScand, Prelude in { + + flags optimize=all_subs ; + + lin + DetCN det cn = let g = cn.g in { + s = \\c => det.s ! g ++ cn.s ! det.n ! det.det ! caseNP c ; + a = agrP3 g det.n + } ; + UsePN pn = { + s = \\c => pn.s ! caseNP c ; + a = agrP3 pn.g Sg + } ; + + UsePron p = p ; + + MkDet pred quant num ord = let n = quant.n in { + s = \\g => pred.s ! gennum g n ++ quant.s ! g ++ num.s ! g ++ ord.s ; + n = n ; + det = quant.det + } ; + + PossPronSg p = { + s = \\g => p.s ! NPPoss (gennum g Sg) ; + n = Sg ; + det = DDef Indef + } ; + PossPronPl p = { + s = \\_ => p.s ! NPPoss Plg ; + n = Pl ; + det = DDef Indef + } ; + + NoPredet, NoNum = {s = \\_ => []} ; -- these get different types! + NoOrd = {s = []} ; + NumInt n = {s = \\_ => n.s} ; + +---- NumNumeral numeral = {s = \\g => numeral.s ! NCard g} ; + OrdNumeral numeral = {s = numeral.s ! NOrd} ; + + AdNum adn num = {s = \\g => adn.s ++ num.s ! g} ; + + OrdSuperl a = {s = a.s ! AF (ASuperl SupWeak) Nom} ; + + DefSg = {s = \\g => artDef (gennum g Sg) ; n = Sg ; det = DDef detDef} ; + DefPl = {s = \\_ => artDef Plg ; n = Pl ; det = DDef detDef} ; + + IndefSg = {s = artIndef ; n = Sg ; det = DIndef} ; + IndefPl = {s = \\_ => [] ; n = Pl ; det = DIndef} ; + +---- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ; +---- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ; + + AdjCN ap cn = let g = cn.g in { + s = \\n,d,c => preOrPost ap.isPre + (ap.s ! agrAdj (gennum g n) d) + (cn.s ! n ! d ! c) ; + g = g + } ; + +{- + RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; + + SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ; + QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ; +-} + UseN noun = { + s = \\n,d => noun.s ! n ! specDet d ; + g = noun.g + } ; + +} diff --git a/lib/resource-1.0/scandinavian/ParamScand.gf b/lib/resource-1.0/scandinavian/ParamScand.gf index 98a0ab421..0a27c94e1 100644 --- a/lib/resource-1.0/scandinavian/ParamScand.gf +++ b/lib/resource-1.0/scandinavian/ParamScand.gf @@ -1,4 +1,4 @@ -resource ParamScand = ParamX ** { +resource ParamScand = ParamX ** open Prelude in { param Species = Indef | Def ; @@ -18,6 +18,8 @@ param | ACompar | ASuperl AFormSup ; +-- The $Number$ in $Weak$ only matters in "lilla"/"små". + AFormPos = Strong GenNum | Weak Number ; AFormSup = SupStrong | SupWeak ; @@ -40,7 +42,7 @@ param | VImperat | VInfinit Anteriority ; - NPForm = NPNom | NPAcc | NPGen GenNum ; + NPForm = NPNom | NPAcc | NPPoss GenNum ; --- AdjPronForm = APron GenNum Case ; --- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ; @@ -53,4 +55,33 @@ param oper Agr : PType = {gn : GenNum ; p : Person} ; + nominative : NPForm = NPNom ; + accusative : NPForm = NPAcc ; + + caseNP : NPForm -> Case = \np -> case np of { + NPPoss _ => Gen ; + _ => Nom + } ; + + specDet : DetSpecies -> Species = \d -> case d of { + DDef Def => Def ; + _ => Indef + } ; + +-- Used in $Noun.AdjCN$. + + agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> case of { + <_, DIndef> => Strong gn ; + => Weak Pl ; + _ => Weak Sg + } ; + +-- Used in $DiffScand.predV$. + + vFin : Tense -> Voice -> VForm = \t,v -> case t of { + Pres => VF (VPres v) ; + Past => VF (VPret v) ; + _ => VI (VInfin v) --- not to be used? + } ; + } diff --git a/lib/resource-1.0/scandinavian/PhraseScand.gf b/lib/resource-1.0/scandinavian/PhraseScand.gf index 2412ced36..c838e6c0a 100644 --- a/lib/resource-1.0/scandinavian/PhraseScand.gf +++ b/lib/resource-1.0/scandinavian/PhraseScand.gf @@ -9,9 +9,9 @@ incomplete concrete PhraseScand of Phrase = UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ; UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ; - UttIP ip = {s = ip.s ! NPNom} ; --- Acc also + UttIP ip = {s = ip.s ! nominative} ; --- Acc also UttIAdv iadv = iadv ; - UttNP np = {s = np.s ! NPAcc} ; + UttNP np = {s = np.s ! accusative} ; ---- UttVP vp = {s = infMark ++ infVP vp (agrP3 Sg)} ; UttAdv adv = adv ; @@ -19,6 +19,6 @@ incomplete concrete PhraseScand of Phrase = PConjConj conj = conj ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ np.s ! NPNom} ; + VocNP np = {s = "," ++ np.s ! nominative} ; } diff --git a/lib/resource-1.0/scandinavian/ResScand.gf b/lib/resource-1.0/scandinavian/ResScand.gf index 1ee24c2b7..6df96ef32 100644 --- a/lib/resource-1.0/scandinavian/ResScand.gf +++ b/lib/resource-1.0/scandinavian/ResScand.gf @@ -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 of { --- => vf fin [] ; --- => vf (does agr) inf ; --- => vf (doesnt agr) inf ; --- => vf (have agr) part ; --- => vf (havent agr) part ; --- => vf past [] ; --- => vf "did" inf ; --- => vf "didn't" inf ; --- => vf "had" part ; --- => vf "hadn't" part ; --- => vf "will" inf ; --- => vf "won't" inf ; --- => vf "will" ("have" ++ part) ; --- => vf "won't" ("have" ++ part) ; --- => vf "would" inf ; --- => vf "wouldn't" inf ; --- => vf "would" ("have" ++ part) ; --- => 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 of { --- => vf fin [] ; --- => vf (have agr) part ; --- => vf (havent agr) part ; --- => vf past [] ; --- => vf "had" part ; --- => vf "hadn't" part ; --- => vf "will" inf ; --- => vf "won't" inf ; --- => vf "will" ("have" ++ part) ; --- => vf "won't" ("have" ++ part) ; --- => vf "would" inf ; --- => vf "wouldn't" inf ; --- => vf "would" ("have" ++ part) ; --- => 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$. -- diff --git a/lib/resource-1.0/scandinavian/SentenceScand.gf b/lib/resource-1.0/scandinavian/SentenceScand.gf index 761b8a624..0234c3a0a 100644 --- a/lib/resource-1.0/scandinavian/SentenceScand.gf +++ b/lib/resource-1.0/scandinavian/SentenceScand.gf @@ -1,10 +1,11 @@ ---concrete SentenceScand of Sentence = CatScand ** open ResScand in { --- --- flags optimize=all_subs ; --- --- lin --- PredVP np vp = mkS (np.s ! Nom) np.a vp.s vp.s2 ; --- +incomplete concrete SentenceScand of Sentence = + CatScand ** open DiffScand, ResScand in { + + flags optimize=all_subs ; + + lin + PredVP np vp = mkS (np.s ! nominative) np.a vp.s vp.a1 vp.n2 ; + -- PredSCVP sc vp = mkS sc.s (agrP3 Sg) vp.s vp.s2 ; -- -- ImpVP vp = { @@ -34,4 +35,4 @@ -- -- SlashPrep cl prep = cl ** {c2 = prep.s} ; -- ---} +} diff --git a/lib/resource-1.0/scandinavian/UntensedScand.gf b/lib/resource-1.0/scandinavian/UntensedScand.gf index 26098207e..5a8915ea7 100644 --- a/lib/resource-1.0/scandinavian/UntensedScand.gf +++ b/lib/resource-1.0/scandinavian/UntensedScand.gf @@ -1,15 +1,15 @@ ---concrete UntensedScand of Untensed = CatScand ** open ResScand in { --- --- flags optimize=all_subs ; --- --- lin --- PosCl cl = {s = cl.s ! Pres ! Simul ! Pos ! ODir} ; --- NegCl cl = {s = cl.s ! Pres ! Simul ! Neg ! ODir} ; --- --- PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; --- NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; --- --- PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; --- NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; --- ---} +incomplete concrete UntensedScand of Untensed = CatScand ** open ResScand in { + + flags optimize=all_subs ; + + lin + PosCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; + NegCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; + + PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; + NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; + + PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; + NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; + +} diff --git a/lib/resource-1.0/scandinavian/VerbScand.gf b/lib/resource-1.0/scandinavian/VerbScand.gf index 53ee50fbf..0fa9b6bda 100644 --- a/lib/resource-1.0/scandinavian/VerbScand.gf +++ b/lib/resource-1.0/scandinavian/VerbScand.gf @@ -1,38 +1,39 @@ ---concrete VerbScand of Verb = CatScand ** open ResScand in { --- --- flags optimize=all_subs ; --- --- lin --- UseV = predV ; --- ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v) ; --- ComplV3 v np np2 = --- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc) (predV v) ; --- --- ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ; --- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; --- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; --- --- ComplVA v ap = insertObj (ap.s) (predV v) ; --- ComplV2A v np ap = --- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ; --- --- UseComp comp = insertObj comp.s (predAux auxBe) ; --- --- AdvVP vp adv = insertObj (\\_ => adv.s) vp ; ------- AdVVP adv vp = insertAdV adv.s vp ; --- --- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; --- --- PassV2 v = {s = \\_ => v.s ! VPPart} ; --- --- UseVV, UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; -- no "to" --- --- CompAP ap = ap ; --- CompNP np = {s = \\_ => np.s ! Acc} ; --- CompAdv a = {s = \\_ => a.s} ; --- --- EmbedS s = {s = conjThat ++ s.s} ; --- EmbedQS qs = {s = qs.s ! QIndir} ; --- EmbedVP vp = {s = infVP vp (agrP3 Sg)} ; --- agr --- ---} +incomplete concrete VerbScand of Verb = CatScand ** open DiffScand, ResScand in { + + flags optimize=all_subs ; + + lin + UseV = predV ; + ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v) ; + ComplV3 v np np2 = + insertObj (\\_ => v.c2 ++ np.s ! accusative ++ v.c3 ++ np2.s ! accusative) (predV v) ; + + ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ; + ComplVS v s = insertObj (\\_ => conjThat ++ s.s ! Sub) (predV v) ; + ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; +{- + ComplVA v ap = insertObj (ap.s) (predV v) ; + ComplV2A v np ap = + insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ; + + UseComp comp = insertObj comp.s (predAux auxBe) ; + + AdvVP vp adv = insertObj (\\_ => adv.s) vp ; + AdVVP adv vp = insertAdV adv.s vp ; + + ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; + + PassV2 v = {s = \\_ => v.s ! VPPart} ; + + UseVV, UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; + + CompAP ap = ap ; + CompNP np = {s = \\_ => np.s ! Acc} ; + CompAdv a = {s = \\_ => a.s} ; + + EmbedS s = {s = conjThat ++ s.s} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = infVP vp (agrP3 Sg)} ; --- agr +-} + +} diff --git a/lib/resource-1.0/swedish/DiffSwe.gf b/lib/resource-1.0/swedish/DiffSwe.gf index bda4e1bc7..0e1a688bf 100644 --- a/lib/resource-1.0/swedish/DiffSwe.gf +++ b/lib/resource-1.0/swedish/DiffSwe.gf @@ -1,4 +1,4 @@ -instance DiffSwe of DiffScand = { +instance DiffSwe of DiffScand = open ResScand, Prelude in { -- Parameters. @@ -6,7 +6,17 @@ instance DiffSwe of DiffScand = { Gender = Utr | Neutr ; oper - utrum = Utr ; neutrum = Neutr ; + utrum = Utr ; + neutrum = Neutr ; + + gennum : Gender -> Number -> GenNum = \g,n -> + case of { + => SgUtr ; + => SgNeutr ; + _ => Plg + } ; + + detDef : Species = Def ; -- Strings. @@ -14,4 +24,19 @@ instance DiffSwe of DiffScand = { conjThan = "än" ; infMark = "att" ; + artIndef : Gender => Str = table { + Utr => "en" ; + Neutr => "ett" + } ; + + verbHave = + mkVerb "ha" "har" "ha" "hade" "haft" "havd" "havt" "havda" ; + + auxFut = "ska" ; -- "skall" in ExtSwe + auxCond = "skulle" ; + + negation : Polarity => Str = table { + Pos => [] ; + Neg => "inte" + } ; } diff --git a/lib/resource-1.0/swedish/LexSwe.gf b/lib/resource-1.0/swedish/LexSwe.gf index bb5ea03b5..14ead07e4 100644 --- a/lib/resource-1.0/swedish/LexSwe.gf +++ b/lib/resource-1.0/swedish/LexSwe.gf @@ -30,15 +30,15 @@ concrete LexSwe of Lex = CatSwe ** open ResSwe, Prelude in { here_Adv = {s = "här"} ; very_AdA = {s = "mycket"} ; always_AdV = {s = "alltid"} ; --- --- only_Predet = {s = "bara"} ; --- all_Predet = {s = "alla"} ; + + only_Predet = {s = \\_ => "bara"} ; + all_Predet = {s = gennumForms "all" "allt" "alla"} ; -- this_Quant = {s = "this" ; n = Sg} ; -- these_Quant = {s = "these" ; n = Pl} ; -- --- i_Pron = mkNP "I" "me" "my" Sg P1 ; --- he_Pron = mkNP "he" "him" "his" Sg P3 ; --- we_Pron = mkNP "we" "us" "our" Pl P1 ; + i_Pron = mkNP "jag" "mig" "min" "mitt" "mina" SgUtr P1 ; + he_Pron = mkNP "han" "honom" "hans" "hans" "hans" SgUtr P3 ; + we_Pron = mkNP "vi" "oss" "vår" "vårt" "våra" SgUtr P1 ; -- -- whoSg_IP = mkIP "who" "whom" "whose" Sg ; -- whoPl_IP = mkIP "who" "whom" "whose" Pl ; diff --git a/lib/resource-1.0/swedish/NounSwe.gf b/lib/resource-1.0/swedish/NounSwe.gf new file mode 100644 index 000000000..aa5d48a68 --- /dev/null +++ b/lib/resource-1.0/swedish/NounSwe.gf @@ -0,0 +1,2 @@ +concrete NounSwe of Noun = CatSwe ** NounScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/SentenceSwe.gf b/lib/resource-1.0/swedish/SentenceSwe.gf new file mode 100644 index 000000000..82430d5d3 --- /dev/null +++ b/lib/resource-1.0/swedish/SentenceSwe.gf @@ -0,0 +1,2 @@ +concrete SentenceSwe of Sentence = CatSwe ** SentenceScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/TestSwe.gf b/lib/resource-1.0/swedish/TestSwe.gf index b0e038b07..226c0a66c 100644 --- a/lib/resource-1.0/swedish/TestSwe.gf +++ b/lib/resource-1.0/swedish/TestSwe.gf @@ -1,17 +1,17 @@ --# -path=.:../scandinavian:../abstract:../common:prelude concrete TestSwe of Test = --- NounSwe, --- VerbSwe, + NounSwe, + VerbSwe, AdjectiveSwe, AdverbSwe, -- -- NumeralSwe, --- SentenceSwe, + SentenceSwe, -- QuestionSwe, -- RelativeSwe, -- ConjunctionSwe, PhraseSwe, --- UntensedSwe, + UntensedSwe, -- -- TensedSwe, LexSwe ** { diff --git a/lib/resource-1.0/swedish/UntensedSwe.gf b/lib/resource-1.0/swedish/UntensedSwe.gf new file mode 100644 index 000000000..c3b830463 --- /dev/null +++ b/lib/resource-1.0/swedish/UntensedSwe.gf @@ -0,0 +1,2 @@ +concrete UntensedSwe of Untensed = CatSwe ** UntensedScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/VerbSwe.gf b/lib/resource-1.0/swedish/VerbSwe.gf new file mode 100644 index 000000000..4814d2d13 --- /dev/null +++ b/lib/resource-1.0/swedish/VerbSwe.gf @@ -0,0 +1,2 @@ +concrete VerbSwe of Verb = CatSwe ** VerbScand with + (DiffScand = DiffSwe) ;