diff options
| author | aarne <aarne@chalmers.se> | 2009-06-22 15:39:08 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2009-06-22 15:39:08 +0000 |
| commit | e89fdae2fa1626348d8025824a7469252fa85e42 (patch) | |
| tree | c7d46bbd0494043b4bd6f917a25a7687517d0547 /old-lib/resource/scandinavian | |
| parent | 3049b59b35b25381a7c6787444165c200d66e08b (diff) | |
next-lib renamed to lib, lib to old-lib
Diffstat (limited to 'old-lib/resource/scandinavian')
| -rw-r--r-- | old-lib/resource/scandinavian/AdjectiveScand.gf | 44 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/AdverbScand.gf | 27 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/CatScand.gf | 106 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/CommonScand.gf | 310 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/ConjunctionScand.gf | 37 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/DiffScand.gf | 63 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/ExtEngAbs.gf | 15 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/ExtraScand.gf | 47 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/ExtraScandAbs.gf | 3 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/NounScand.gf | 231 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/PhraseScand.gf | 25 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/QuestionScand.gf | 96 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/RelativeScand.gf | 52 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/ResScand.gf | 75 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/SentenceScand.gf | 64 | ||||
| -rw-r--r-- | old-lib/resource/scandinavian/VerbScand.gf | 69 |
16 files changed, 1264 insertions, 0 deletions
diff --git a/old-lib/resource/scandinavian/AdjectiveScand.gf b/old-lib/resource/scandinavian/AdjectiveScand.gf new file mode 100644 index 000000000..1570574cb --- /dev/null +++ b/old-lib/resource/scandinavian/AdjectiveScand.gf @@ -0,0 +1,44 @@ +incomplete concrete AdjectiveScand of Adjective = + CatScand ** open CommonScand, ResScand, Prelude in { + + lin + + PositA a = { + s = \\ap => a.s ! AF (APosit ap) Nom ; + isPre = True + } ; + ComparA a np = { + s = \\ap => case a.isComp of { + True => compMore ++ a.s ! AF (APosit ap) Nom ; + _ => a.s ! AF ACompar Nom + } + ++ conjThan ++ np.s ! nominative ; + isPre = False + } ; + +-- $SuperlA$ belongs to determiner syntax in $Noun$. + + ComplA2 a np = { + s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2.s ++ np.s ! accusative ; + isPre = False + } ; + + ReflA2 a = { + s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2.s ++ + reflPron (agrP3 utrum Sg) ; ---- + isPre = False + } ; + + SentAP ap sc = { + s = \\a => ap.s ! a ++ sc.s ; + isPre = False + } ; + + AdAP ada ap = { + s = \\a => ada.s ++ ap.s ! a ; + isPre = ap.isPre + } ; + + UseA2 a = a ; + +} diff --git a/old-lib/resource/scandinavian/AdverbScand.gf b/old-lib/resource/scandinavian/AdverbScand.gf new file mode 100644 index 000000000..1afa40cf1 --- /dev/null +++ b/old-lib/resource/scandinavian/AdverbScand.gf @@ -0,0 +1,27 @@ +incomplete concrete AdverbScand of Adverb = CatScand ** open CommonScand, ResScand, Prelude in { + + lin + PositAdvAdj a = { + s = a.s ! adverbForm + } ; + ComparAdvAdj cadv a np = { + 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 ! accusative} ; + + AdAdv = cc2 ; + + SubjS subj s = { + s = subj.s ++ s.s ! Sub + } ; + + AdnCAdv cadv = {s = cadv.s ++ conjThan} ; + + oper + adverbForm : AForm = AF (APosit (Strong SgNeutr)) Nom ; + +} diff --git a/old-lib/resource/scandinavian/CatScand.gf b/old-lib/resource/scandinavian/CatScand.gf new file mode 100644 index 000000000..536f6aa55 --- /dev/null +++ b/old-lib/resource/scandinavian/CatScand.gf @@ -0,0 +1,106 @@ +incomplete concrete CatScand of Cat = + CommonX ** open ResScand, Prelude, CommonScand, (R = ParamX) in { + + flags optimize=all_subs ; + + lincat + +-- Tensed/Untensed + + S = {s : Order => Str} ; + QS = {s : QForm => Str} ; + RS = {s : Agr => Str ; c : NPForm} ; + SSlash = {s : Order => Str ; n3 : Agr => Str ; c2 : Complement} ; + +-- Sentence + + Cl = {s : R.Tense => Anteriority => Polarity => Order => Str} ; + ClSlash = { + s : R.Tense => Anteriority => Polarity => Order => Str ; + n3 : Agr => Str ; + c2 : Complement + } ; + Imp = {s : Polarity => Number => Str} ; + +-- Question + + QCl = {s : R.Tense => Anteriority => Polarity => QForm => Str} ; + IP = {s : NPForm => Str ; gn : GenNum} ; + IComp = {s : AFormPos => Str} ; + IDet = {s : Gender => Str ; n : Number ; det : DetSpecies} ; + IQuant = {s : Number => Gender => Str ; det : DetSpecies} ; + +-- Relative; the case $c$ is for "det" clefts. + + RCl = {s : R.Tense => Anteriority => Polarity => Agr => Str ; c : NPForm} ; + RP = {s : GenNum => RCase => Str ; a : RAgr} ; + +-- Verb + + VP = { + s : VPForm => { + 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 + en2,ea2,eext : Bool -- indicate if the field exists + } ; + VPSlash = CommonScand.VP ** { + n3 : Agr => Str ; -- object-control complement + c2 : Complement + } ; + Comp = {s : AFormPos => Str} ; + + +-- Adjective + + AP = {s : AFormPos => Str ; isPre : Bool} ; + +-- Noun + +-- The fields $isMod$ and $isDet$, and the boolean parameter of +-- determiners, are a hack (the simples possible we found) that +-- permits treating definite articles "huset - de fem husen - det gamla huset" +-- as $Quant$. + + CN = {s : Number => DetSpecies => Case => Str ; g : Gender ; isMod : Bool} ; + NP,Pron = {s : NPForm => Str ; a : Agr} ; + Det = {s : Bool => Gender => Str ; n : Number ; det : DetSpecies} ; + Quant = {s : Number => Bool => Gender => Str ; det : DetSpecies} ; + Art = {s : Number => Bool => Bool => Gender => Str ; det : DetSpecies} ; + Predet = {s : GenNum => Str} ; + Num = {s : Gender => Str ; isDet : Bool ; n : Number} ; + Card = {s : Gender => Str ; n : Number} ; + Ord = {s : Str} ; + +-- Numeral + + Numeral = {s : CardOrd => Str ; n : Number} ; + Digits = {s : CardOrd => Str ; n : Number} ; + +-- Structural + + Conj = {s1,s2 : Str ; n : Number} ; + Subj = {s : Str} ; + Prep = {s : Str} ; + +-- Open lexical classes, e.g. Lexicon + + V, VS, VQ, VA = Verb ; + V2, VV, V2Q, V2S, V2A = Verb ** {c2 : Complement} ; + V3, V2V = Verb ** {c2,c3 : Complement} ; + + A = Adjective ** {isComp : Bool} ; + -- {s : AForm => Str} ; + A2 = Adjective ** {isComp : Bool ; c2 : Complement} ; + + N = Noun ; + -- {s : Number => Species => Case => Str ; g : Gender} ; + N2 = Noun ** {c2 : Complement} ; + N3 = Noun ** {c2,c3 : Complement} ; + PN = {s : Case => Str ; g : Gender} ; + +} diff --git a/old-lib/resource/scandinavian/CommonScand.gf b/old-lib/resource/scandinavian/CommonScand.gf new file mode 100644 index 000000000..487082305 --- /dev/null +++ b/old-lib/resource/scandinavian/CommonScand.gf @@ -0,0 +1,310 @@ +--1 Auxiliary operations common for Scandinavian languages. +-- +-- This module contains operations that are shared by the Scandinavian +-- languages. The complete set of auxiliary operations needed to +-- implement [Test Test.html] is defined in [ResScandinavian ResScandinavian.html], +-- which depends on [DiffScandinavian DiffScandinavian.html]. + +resource CommonScand = ParamX ** open Prelude in { + + flags optimize=all ; + +param + Species = Indef | Def ; + Case = Nom | Gen ; + Voice = Act | Pass ; + + Order = Main | Inv | Sub ; + + DetSpecies = DIndef | DDef Species ; + + GenNum = SgUtr | SgNeutr | Plg ; + + AForm = AF AFormGrad Case ; + + AFormGrad = + APosit AFormPos + | ACompar + | ASuperl AFormSup ; + +-- The $Number$ in $Weak$ only matters in "lilla"/"små". + + AFormPos = Strong GenNum | Weak Number ; + AFormSup = SupStrong | SupWeak ; + + VForm = + VF VFin + | VI VInf ; + + VFin = + VPres Voice + | VPret Voice --# notpresent + | VImper Voice + ; + + VInf = + VInfin Voice + | VSupin Voice --# notpresent + | VPtPret AFormPos Case + ; + + VPForm = + VPFinite Tense Anteriority + | VPImperat + | VPInfinit Anteriority ; + + VType = VAct | VPass | VRefl ; + + NPForm = NPNom | NPAcc | NPPoss GenNum ; +--- AdjPronForm = APron GenNum Case ; +--- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ; + + RCase = RNom | RGen | RPrep Bool ; + + RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ; + +oper + Complement : Type = {s : Str ; hasPrep : Bool} ; + + 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 + } ; + + mkComplement : Str -> Complement = \s -> { + s = s ; + hasPrep = case s of { + "" => False ; + _ => True + } + } ; +-- Used in $Noun.AdjCN$. + +----- agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> Strong gn ; --- debug + agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> + case <<gn,d> : GenNum * DetSpecies> of { + <_, DIndef> => Strong gn ; + <Plg,DDef _> => 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) ; --# notpresent + _ => VI (VInfin v) --- not to be used? + } ; + +-- Used in $ConjunctionScand$. + + conjGenNum : (_,_ : GenNum) -> GenNum = \g,h -> case <g,h> of { + <SgUtr,SgUtr> => SgUtr ; + <Plg, _> => Plg ; + <_, Plg> => Plg ; + _ => SgNeutr + } ; + + conjAgr : (_,_ : Agr) -> Agr = \a,b -> { + gn = conjGenNum a.gn b.gn ; + p = conjPerson a.p b.p + } ; + +--- + +-- For $Lex$. + +-- For each lexical category, here are the worst-case constructors. +-- +-- But $mkNoun$ is fully defined only for each language, since +-- $Gender$ varies. + + nounForms : (x1,_,_,x4 : Str) -> (Number => Species => Case => Str) = + \man,mannen,men,mennen -> \\n,d,c => case <n,d> of { + <Sg,Indef> => mkCase c man ; + <Sg,Def> => mkCase c mannen ; + <Pl,Indef> => mkCase c men ; + <Pl,Def> => mkCase c mennen + } ; + + Adjective : Type = {s : AForm => Str} ; + + mkAdjective : (x1,_,_,_,_,_,x7 : Str) -> {s : AForm => Str} = + \liten, litet, lilla, sma, mindre, minst, minsta -> { + s = table { + AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ; + AF ACompar c => mkCase c mindre ; + AF (ASuperl SupStrong) c => mkCase c minst ; + AF (ASuperl SupWeak) c => mkCase c minsta + } + } ; + + mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} = + \finna,finner,finn,fann,funnit,funnen,funnet,funna -> { + s = table { + VF (VPres Act) => finner ; + VF (VPres Pass) => mkVoice Pass finn ; + VF (VPret v) => mkVoice v fann ; --# notpresent + VF (VImper v) => mkVoice v finn ; + VI (VInfin v) => mkVoice v finna ; + VI (VSupin v) => mkVoice v funnit ; --# notpresent + VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna) + } ; + vtype = VAct + } ; + +-- These are useful auxiliaries. + + mkCase : Case -> Str -> Str = \c,f -> case c of { + Nom => f ; + Gen => f + case last f of { + "s" | "x" => [] ; + _ => "s" + } + } ; + + mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str = + \a, liten, litet, lilla, sma -> + case a of { + Strong gn => case gn of { + SgUtr => liten ; + SgNeutr => litet ; + Plg => sma + } ; + Weak Sg => lilla ; + Weak Pl => sma + } ; + + mkVoice : Voice -> Str -> Str = \v,s -> case v of { + Act => s ; + Pass => s + case last s of { + "s" => "es" ; + _ => "s" + } + } ; + + +-- 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 -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} = + \det,dess,gn -> + mkNP det det dess dess dess gn P3 ; + + +-- For $Verb$. + + VP = { + s : VPForm => { + 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 => obj ! a ++ vp.n2 ! a ; + a2 = vp.a2 ; + ext = vp.ext ; + en2 = True ; + ea2 = vp.ea2 ; + eext = vp.eext + } ; + + insertObjPost : (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 + } ; + + insertAdv : Str -> VP -> VP = \adv,vp -> { + s = vp.s ; + a1 = vp.a1 ; + n2 = vp.n2 ; + a2 = vp.a2 ++ adv ; + ext = vp.ext ; + en2 = vp.en2 ; + ea2 = True ; + eext = vp.eext + } ; + + insertAdV : Str -> VP -> VP = \adv,vp -> { + s = vp.s ; + a1 = \\b => vp.a1 ! b ++ adv ; + n2 = vp.n2 ; + a2 = vp.a2 ; + ext = vp.ext ; + en2 = vp.en2 ; + ea2 = vp.ea2 ; + eext = vp.eext + } ; + + infVP : VP -> Agr -> Str = \vp,a -> + vp.a1 ! Pos ++ (vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1 + + +-- For $Sentence$. + + Clause : Type = { + s : Tense => Anteriority => Polarity => Order => Str + } ; + + mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> { + s = \\t,a,b,o => + let + verb = vp.s ! VPFinite t a ; + neg = vp.a1 ! b ; + compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext + 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 + } + } ; + +} diff --git a/old-lib/resource/scandinavian/ConjunctionScand.gf b/old-lib/resource/scandinavian/ConjunctionScand.gf new file mode 100644 index 000000000..b98f04ae9 --- /dev/null +++ b/old-lib/resource/scandinavian/ConjunctionScand.gf @@ -0,0 +1,37 @@ +incomplete concrete ConjunctionScand of Conjunction = + CatScand ** open CommonScand, ResScand, Coordination, Prelude in { + + flags optimize=all_subs ; + + lin + + ConjS conj ss = conjunctDistrTable Order conj ss ; + + ConjAdv conj ss = conjunctDistrSS conj ss ; + + ConjNP conj ss = conjunctDistrTable NPForm conj ss ** { + a = {gn = conjGenNum (gennum utrum conj.n) ss.a.gn ; p = ss.a.p} + } ; + + ConjAP conj ss = conjunctDistrTable AFormPos conj ss ** { + isPre = ss.isPre + } ; + +-- These fun's are generated from the list cat's. + + BaseS = twoTable Order ; + ConsS = consrTable Order comma ; + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ; + ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ; + BaseAP x y = twoTable AFormPos x y ** {isPre = andB x.isPre y.isPre} ; + ConsAP xs x = consrTable AFormPos comma xs x ** {isPre = andB xs.isPre x.isPre} ; + + lincat + [S] = {s1,s2 : Order => Str} ; + [Adv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : NPForm => Str ; a : Agr} ; + [AP] = {s1,s2 : AFormPos => Str ; isPre : Bool} ; + +} diff --git a/old-lib/resource/scandinavian/DiffScand.gf b/old-lib/resource/scandinavian/DiffScand.gf new file mode 100644 index 000000000..e288be677 --- /dev/null +++ b/old-lib/resource/scandinavian/DiffScand.gf @@ -0,0 +1,63 @@ +interface DiffScand = open CommonScand, Prelude in { + +--1 Differences between Scandinavian languages + +-- Norway has three genders, Danish and Swedish have two. + + param + Gender ; + + oper + neutrum, utrum : Gender ; + + gennum : Gender -> Number -> GenNum ; + +-- This is the form of the noun in "det stora berget"/"det store berg". + + detDef : Species ; + +-- Danish and Norwegian verbs, but not Swedish verbs, +-- have two possible compound-tense auxiliaries ("have" or "være"). + + Verb : Type ; + + hasAuxBe : Verb -> Bool ; + +-- The rest of the parameters are function words used in the syntax modules. + + conjThat : Str ; + conjThan : Str ; + compMore : Str ; + conjAnd : Str ; + infMark : Str ; + + subjIf : Str ; + + artIndef : Gender => Str ; + + verbHave : Verb ; + verbBe : Verb ; + + verbBecome : Verb ; + + auxFut : Str ; + auxCond : Str ; + + negation : Polarity => Str ; + +-- For determiners; mostly two-valued even in Norwegian. + + genderForms : (x1,x2 : Str) -> Gender => Str ; + +-- The forms of a relative pronoun ("som", "vars", "i vilken"). + + relPron : GenNum => RCase => Str ; + +-- Pronoun "sådan" used in $Relative.RelCl$. + + pronSuch : GenNum => Str ; + + reflPron : Agr -> Str ; + +} + diff --git a/old-lib/resource/scandinavian/ExtEngAbs.gf b/old-lib/resource/scandinavian/ExtEngAbs.gf new file mode 100644 index 000000000..85c117e47 --- /dev/null +++ b/old-lib/resource/scandinavian/ExtEngAbs.gf @@ -0,0 +1,15 @@ +abstract ExtEngAbs = Cat ** { + + cat + Aux ; -- auxiliary verbs: "can", "must", etc + +-- Notice that $Aux$ cannot form $VP$ with infinitive, imperative, etc. + + fun + PredAux : NP -> Aux -> VP -> Cl ; + QuestAux : IP -> Aux -> VP -> QCl ; + + can_Aux : Aux ; + must_Aux : Aux ; + +} diff --git a/old-lib/resource/scandinavian/ExtraScand.gf b/old-lib/resource/scandinavian/ExtraScand.gf new file mode 100644 index 000000000..3438a0d3b --- /dev/null +++ b/old-lib/resource/scandinavian/ExtraScand.gf @@ -0,0 +1,47 @@ +incomplete concrete ExtraScand of ExtraScandAbs = CatScand ** + open CommonScand,Coordination,ResScand in { + lin + GenNP np = { + s = \\n,_,g => np.s ! NPPoss (gennum g n) ; + det = DDef Indef + } ; + + ComplBareVS v s = insertObj (\\_ => s.s ! Sub) (predV v) ; + + StrandRelSlash rp slash = { + s = \\t,a,p,ag => + rp.s ! ag.gn ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2.s ; + c = NPAcc + } ; + EmptyRelSlash rp slash = { + s = \\t,a,p,ag => + slash.s ! t ! a ! p ! Sub ++ slash.c2.s ; + c = NPAcc + } ; + + StrandQuestSlash ip slash = { + s = \\t,a,p => + let + cls = slash.s ! t ! a ! p ; + who = ip.s ! accusative + in table { + QDir => who ++ cls ! Inv ++ slash.c2.s ; + QIndir => who ++ cls ! Sub ++ slash.c2.s + } + } ; + + lincat + VPI = {s : VPIForm => Agr => Str} ; + [VPI] = {s1,s2 : VPIForm => Agr => Str} ; + + lin + BaseVPI = twoTable2 VPIForm Agr ; + ConsVPI = consrTable2 VPIForm Agr comma ; + + MkVPI vp = { + s = \\v,a => infVP vp a ---- no sup + } ; + ConjVPI = conjunctDistrTable2 VPIForm Agr ; + ComplVPIVV vv vpi = insertObj (\\a => vv.c2.s ++ vpi.s ! VPIInf ! a) (predV vv) ; + +} diff --git a/old-lib/resource/scandinavian/ExtraScandAbs.gf b/old-lib/resource/scandinavian/ExtraScandAbs.gf new file mode 100644 index 000000000..7f0fb1651 --- /dev/null +++ b/old-lib/resource/scandinavian/ExtraScandAbs.gf @@ -0,0 +1,3 @@ +abstract ExtraScandAbs = Extra ** { + +} diff --git a/old-lib/resource/scandinavian/NounScand.gf b/old-lib/resource/scandinavian/NounScand.gf new file mode 100644 index 000000000..edabe8228 --- /dev/null +++ b/old-lib/resource/scandinavian/NounScand.gf @@ -0,0 +1,231 @@ +incomplete concrete NounScand of Noun = + CatScand ** open CommonScand, ResScand, Prelude in { + + flags optimize=all_subs ; + +-- The rule defines $Det Quant Num Ord CN$ where $Det$ is empty if +-- it is the definite article ($DefSg$ or $DefPl$) and both $Num$ and +-- $Ord$ are empty and $CN$ is not adjectivally modified +-- ($AdjCN$). Thus we get $huset$ but $de fem husen$, $det gamla huset$. + + lin + DetCN det cn = + let + g = cn.g ; + m = cn.isMod ; + dd = case <det.det,detDef,m> of { + <DDef Def, Indef, True> => DDef Indef ; + <d,_,_> => d + } + in { + s = \\c => det.s ! m ! g ++ + cn.s ! det.n ! dd ! caseNP c ; + a = agrP3 g det.n + } ; + + UsePN pn = { + s = \\c => pn.s ! caseNP c ; + a = agrP3 pn.g Sg + } ; + + UsePron p = p ; + + PredetNP pred np = { + s = \\c => pred.s ! np.a.gn ++ np.s ! c ; + a = np.a + } ; + + PPartNP np v2 = { + s = \\c => np.s ! c ++ v2.s ! (VI (VPtPret (agrAdj np.a.gn DIndef) Nom)) ; + a = np.a + } ; + + AdvNP np adv = { + s = \\c => np.s ! c ++ adv.s ; + a = np.a + } ; + + DetQuantOrd quant num ord = { + s = \\b,g => quant.s ! num.n ! (orB b num.isDet) ! g ++ + num.s ! g ++ ord.s ; + n = num.n ; + det = quant.det + } ; + + DetQuant quant num = { + s = \\b,g => quant.s ! num.n ! (orB b num.isDet) ! g ++ + num.s ! g ; + n = num.n ; + det = quant.det + } ; + + DetNP det = + let + g = Neutr ; ---- + m = True ; ---- is this needed for other than Art? + in { + s = \\c => det.s ! m ! g ; + a = agrP3 g det.n + } ; + + DetArtOrd quant num ord = { + s = \\b,g => quant.s ! num.n ! b ! num.isDet ! g ++ + num.s ! g ++ ord.s ; + n = num.n ; + det = quant.det + } ; + + DetArtCard quant num = { + s = \\b,g => quant.s ! num.n ! b ! True ! g ++ num.s ! g ; + n = num.n ; + det = quant.det + } ; + + DetArtSg det cn = + let + g = cn.g ; + n = Sg ; + m = cn.isMod ; + dd = case <det.det,detDef,m> of { + <DDef Def, Indef, True> => DDef Indef ; + <d,_,_> => d + } + in { + s = \\c => det.s ! n ! cn.isMod ! False ! cn.g ++ + cn.s ! n ! dd ! caseNP c ; + a = agrP3 g n + } ; + + DetArtPl det cn = + let + g = cn.g ; + n = Pl ; + m = cn.isMod ; + dd = case <det.det,detDef,m> of { + <DDef Def, Indef, True> => DDef Indef ; + <d,_,_> => d + } + in { + s = \\c => det.s ! n ! cn.isMod ! False !cn.g ++ + cn.s ! n ! dd ! caseNP c ; + a = agrP3 g n + } ; + + + PossPron p = { + s = \\n,_,g => p.s ! NPPoss (gennum g n) ; + det = DDef Indef + } ; + + NumCard c = c ** {isDet = True} ; + + NumSg = {s = \\_ => [] ; isDet = False ; n = Sg} ; + NumPl = {s = \\_ => [] ; isDet = False ; n = Pl} ; + + NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; + OrdDigits nu = {s = nu.s ! NOrd SupWeak} ; + + NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; + OrdNumeral nu = {s = nu.s ! NOrd SupWeak} ; + + AdNum adn num = {s = \\g => adn.s ++ num.s ! g ; isDet = True ; n = num.n} ; + + OrdSuperl a = { + s = case a.isComp of { + True => "mest" ++ a.s ! AF (APosit (Weak Sg)) Nom ; + _ => a.s ! AF (ASuperl SupWeak) Nom + } ; + isDet = True + } ; + + DefArt = { + s = \\n,bm,bn,g => if_then_Str (orB bm bn) (artDef (gennum g n)) [] ; + det = DDef Def + } ; + + IndefArt = { + s = table { + Sg => \\_,bn,g => if_then_Str bn [] (artIndef ! g) ; + Pl => \\_,bn,_ => [] + } ; + det = DIndef + } ; + + MassNP cn = { + s = \\c => cn.s ! Sg ! DIndef ! caseNP c ; + a = agrP3 cn.g Sg + } ; + + UseN, UseN2 = \noun -> { + s = \\n,d,c => noun.s ! n ! specDet d ! c ; + ---- part app wo c shows editor bug. AR 8/7/2007 + g = noun.g ; + isMod = False + } ; + + Use2N3 f = { + s = f.s ; + g = f.g ; + c2 = f.c2 ; + isMod = False + } ; + + Use3N3 f = { + s = f.s ; + g = f.g ; + c2 = f.c3 ; + isMod = False + } ; + +-- The genitive of this $NP$ is not correct: "sonen till mig" (not "migs"). + + ComplN2 f x = { + s = \\n,d,c => f.s ! n ! specDet d ! Nom ++ f.c2.s ++ x.s ! accusative ; + g = f.g ; + isMod = False + } ; + ComplN3 f x = { + s = \\n,d,c => f.s ! n ! d ! Nom ++ f.c2.s ++ x.s ! accusative ; + g = f.g ; + c2 = f.c3 ; + isMod = False + } ; + + 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 ; + isMod = True + } ; + + RelCN cn rs = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! c ++ rs.s ! agrP3 g n ; + g = g ; + isMod = cn.isMod + } ; + + RelNP np rs = { + s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; + a = np.a ; + isMod = np.isMod + } ; + + AdvCN cn sc = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ; + g = g ; + isMod = cn.isMod + } ; + SentCN cn sc = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ; + g = g ; + isMod = cn.isMod + } ; + ApposCN cn np = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! Nom ++ np.s ! NPNom ; --c + g = g ; + isMod = cn.isMod + } ; + +} diff --git a/old-lib/resource/scandinavian/PhraseScand.gf b/old-lib/resource/scandinavian/PhraseScand.gf new file mode 100644 index 000000000..f417b6041 --- /dev/null +++ b/old-lib/resource/scandinavian/PhraseScand.gf @@ -0,0 +1,25 @@ +incomplete concrete PhraseScand of Phrase = + CatScand ** open CommonScand, ResScand, Prelude in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = {s = s.s ! Main} ; + UttQS qs = {s = qs.s ! QDir} ; + UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ; + UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ; + UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ; --- works for adj but not for refl + + UttIP ip = {s = ip.s ! nominative} ; --- Acc also + UttIAdv iadv = iadv ; + UttNP np = {s = np.s ! accusative} ; + UttVP vp = {s = infMark ++ infVP vp (agrP3 utrum Sg)} ; + UttAdv adv = adv ; + + NoPConj = {s = []} ; + PConjConj conj = {s = conj.s2} ; + + NoVoc = {s = []} ; + VocNP np = {s = "," ++ np.s ! nominative} ; + +} diff --git a/old-lib/resource/scandinavian/QuestionScand.gf b/old-lib/resource/scandinavian/QuestionScand.gf new file mode 100644 index 000000000..f053e71cc --- /dev/null +++ b/old-lib/resource/scandinavian/QuestionScand.gf @@ -0,0 +1,96 @@ +incomplete concrete QuestionScand of Question = + CatScand ** open CommonScand, ResScand in { + + flags optimize=all_subs ; + + lin + + QuestCl cl = { + s = \\t,a,p => + let cls = cl.s ! t ! a ! p + in table { + QDir => cls ! Inv ; + QIndir => subjIf ++ cls ! Sub + } + } ; + + QuestVP qp vp = { + s = \\t,a,b,q => + let + somo = case q of { + QIndir => <"som",Sub> ; + _ => <[], Main> + } ; + cl = mkClause (qp.s ! nominative ++ somo.p1) {gn = qp.gn ; p = P3} vp + in + cl.s ! t ! a ! b ! somo.p2 + } ; + + QuestSlash ip slash = { + s = \\t,a,p => + let + agr = {gn = ip.gn ; p = P3} ; + cls : Order => Str = \\o => slash.s ! t ! a ! p ! o ++ slash.n3 ! agr ; + who = slash.c2.s ++ ip.s ! accusative --- stranding in ExtScand + in table { + QDir => who ++ cls ! Inv ; + QIndir => who ++ cls ! Sub + } + } ; + + QuestIAdv iadv cl = { + s = \\t,a,p => + let + cls = cl.s ! t ! a ! p ; + why = iadv.s + in table { + QDir => why ++ cls ! Inv ; + QIndir => why ++ cls ! Sub + } + } ; + + QuestIComp icomp np = { + s = \\t,a,p => + let + cls = + (mkClause (np.s ! nominative) np.a (predV verbBe)).s ! t ! a ! p ; + why = icomp.s ! agrAdj np.a.gn DIndef + in table { + QDir => why ++ cls ! Inv ; + QIndir => why ++ cls ! Sub + } + } ; + + PrepIP p ip = { + s = p.s ++ ip.s ! accusative + } ; + + AdvIP ip adv = { + s = \\c => ip.s ! c ++ adv.s ; + gn = ip.gn + } ; + + IdetCN idet cn = let g = cn.g in { + s = \\c => + idet.s ! g ++ cn.s ! idet.n ! idet.det ! caseNP c ; + gn = gennum g idet.n + } ; + + IdetIP idet = + let + g = Neutr ; + in { + s = \\c => idet.s ! g ; + gn = (agrP3 g idet.n).gn + } ; + + IdetQuant idet num = { + s = \\g => idet.s ! num.n ! g ++ num.s ! g ; + n = num.n ; + det = idet.det + } ; + + CompIAdv a = {s = \\_ => a.s} ; + CompIP ip = {s = \\_ => ip.s ! nominative} ; + +} diff --git a/old-lib/resource/scandinavian/RelativeScand.gf b/old-lib/resource/scandinavian/RelativeScand.gf new file mode 100644 index 000000000..c5c0abc17 --- /dev/null +++ b/old-lib/resource/scandinavian/RelativeScand.gf @@ -0,0 +1,52 @@ +incomplete concrete RelativeScand of Relative = + CatScand ** open CommonScand, ResScand, Prelude in { + + flags optimize=all_subs ; + + lin + + RelCl cl = { + s = \\t,a,p,ag => pronSuch ! ag.gn ++ conjThat ++ cl.s ! t ! a ! p ! Sub ; + c = NPAcc + } ; + + RelVP rp vp = { + s = \\t,ant,b,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg a => a + } ; + cl = mkClause (rp.s ! ag.gn ! RNom) agr vp + in + cl.s ! t ! ant ! b ! Sub ; + c = NPNom + } ; + +-- This rule uses pied piping ("huset i vilket hon bor") +-- Preposition stranding ("huset som hon bor i") +-- and the empty relative ("huset hon bor i") are defined in $ExtraScand$. + + RelSlash rp slash = { + s = \\t,a,p,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg agg => agg + } + in + slash.c2.s ++ rp.s ! ag.gn ! RPrep slash.c2.hasPrep ++ + slash.s ! t ! a ! p ! Sub ++ slash.n3 ! agr ; + c = NPAcc + } ; + +--- The case here could be genitive. + + FunRP p np rp = { + s = \\gn,c => np.s ! nominative ++ p.s ++ rp.s ! gn ! RPrep True ; + a = RAg np.a + } ; + + IdRP = {s = relPron ; a = RNoAg} ; + +} diff --git a/old-lib/resource/scandinavian/ResScand.gf b/old-lib/resource/scandinavian/ResScand.gf new file mode 100644 index 000000000..bcd1c7497 --- /dev/null +++ b/old-lib/resource/scandinavian/ResScand.gf @@ -0,0 +1,75 @@ +--1 Scandinavian auxiliary operations + +interface ResScand = DiffScand ** open CommonScand, Prelude in { + +--2 Constants uniformly defined in terms of language-dependent constants + + param + CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup) + + oper + agrP3 : Gender -> Number -> Agr = \g,n -> { + gn = gennum g n ; + p = P3 + } ; + + Noun = {s : Number => Species => Case => Str ; g : Gender} ; + +-- This function is here because it depends on $verbHave, auxFut, auxCond$. + + predV : Verb -> VP = \verb -> + let + diath = case verb.vtype of { + VPass => Pass ; + _ => Act + } ; + vfin : Tense -> Str = \t -> verb.s ! vFin t diath ; + vsup = verb.s ! VI (VSupin diath) ; --# notpresent + vinf = verb.s ! VI (VInfin diath) ; + + auxv = case hasAuxBe verb of { + True => verbBe.s ; + _ => verbHave.s + } ; + + har : Tense -> Str = \t -> auxv ! vFin t Act ; + ha : Str = auxv ! VI (VInfin Act) ; + + vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> { + fin = fin ; inf = inf ++ verb.part + } ; + + in { + s = table { + VPFinite t Simul => case t of { +-- Pres | Past => vf (vfin t) [] ; -- the general rule + Past => vf (vfin t) [] ; --# notpresent + Fut => vf auxFut vinf ; --# notpresent + Cond => vf auxCond vinf ; --# notpresent + Pres => vf (vfin t) [] + } ; + VPFinite t Anter => case t of { --# notpresent + Pres | Past => vf (har t) vsup ; --# notpresent + Fut => vf auxFut (ha ++ vsup) ; --# notpresent + Cond => vf auxCond (ha ++ vsup) --# notpresent + } ; --# notpresent + VPImperat => vf (verb.s ! VF (VImper diath)) [] ; + VPInfinit Anter => vf [] (ha ++ vsup) ; --# notpresent + VPInfinit Simul => vf [] vinf + } ; + a1 : Polarity => Str = negation ; + n2 : Agr => Str = \\a => case verb.vtype of { + VRefl => reflPron a ; + _ => [] + } ; + a2 : Str = [] ; + ext : Str = [] ; + en2,ea2,eext : Bool = False -- indicate if the field exists + } ; + +-- needed for VP conjunction + param + VPIForm = VPIInf | VPISup ; ---- sup not yet used + + +} diff --git a/old-lib/resource/scandinavian/SentenceScand.gf b/old-lib/resource/scandinavian/SentenceScand.gf new file mode 100644 index 000000000..e845b2a79 --- /dev/null +++ b/old-lib/resource/scandinavian/SentenceScand.gf @@ -0,0 +1,64 @@ +incomplete concrete SentenceScand of Sentence = + CatScand ** open CommonScand, ResScand, Prelude in { + + flags optimize=all_subs ; + + lin + PredVP np vp = mkClause (np.s ! nominative) np.a vp ; + + PredSCVP sc vp = mkClause sc.s (agrP3 neutrum Sg) vp ; + + ImpVP vp = { + s = \\pol,n => + let + agr = {gn = gennum utrum n ; p = P2} ; + verb = vp.s ! VPImperat ; + in + verb.fin ++ vp.a1 ! pol ++ verb.inf ++ vp.n2 ! agr ++ vp.a2 ++ vp.ext + } ; + + SlashVP np vp = + mkClause + (np.s ! nominative) np.a + vp ** + {n3 = vp.n3 ; c2 = vp.c2} ; + + AdvSlash slash adv = { + s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; + n3 = slash.n3 ; + c2 = slash.c2 + } ; + + SlashPrep cl prep = cl ** {n3 = \\_ => [] ; c2 = {s = prep.s ; hasPrep = True}} ; + + SlashVS np vs slash = + mkClause + (np.s ! nominative) np.a + (insertObj (\\_ => conjThat ++ slash.s ! Sub) (predV vs)) ** + {n3 = slash.n3 ; c2 = slash.c2} ; + + EmbedS s = {s = conjThat ++ s.s ! Sub} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = infMark ++ infVP vp (agrP3 utrum Sg)} ; --- agr + + UseCl t a p cl = { + s = \\o => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! o + } ; + UseQCl t a p cl = { + s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q + } ; + UseRCl t a p cl = { + s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r ; + c = cl.c + } ; + UseSlash t a p cl = { + s = \\o => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! o ; + n3 = cl.n3 ; + c2 = cl.c2 + } ; + + AdvS a s = {s = \\o => a.s ++ s.s ! Inv} ; + + RelS s r = {s = \\o => s.s ! o ++ "," ++ r.s ! agrP3 Neutr Sg} ; --- vilket + +} diff --git a/old-lib/resource/scandinavian/VerbScand.gf b/old-lib/resource/scandinavian/VerbScand.gf new file mode 100644 index 000000000..5ec40157c --- /dev/null +++ b/old-lib/resource/scandinavian/VerbScand.gf @@ -0,0 +1,69 @@ +incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand in { + + flags optimize=all_subs ; + + lin + UseV = predV ; + + SlashV2a v = predV v ** {n3 = \\_ => [] ; c2 = v.c2} ; + + Slash2V3 v np = + insertObj (\\_ => v.c2.s ++ np.s ! accusative) (predV v) ** + {n3 = \\_ => [] ; c2 = v.c3} ; -- to preserve the order of args + Slash3V3 v np = predV v ** { + n3 = \\_ => v.c3.s ++ np.s ! accusative ; + c2 = v.c2 + } ; + + ComplVV v vp = insertObj (\\a => v.c2.s ++ 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 (\\a => ap.s ! agrAdj a.gn DIndef) (predV v) ; + + SlashV2V v vp = predV v ** { + n3 = \\a => v.c3.s ++ infVP vp a ; + c2 = v.c2 + } ; + SlashV2S v s = predV v ** { + n3 = \\_ => conjThat ++ s.s ! Sub ; + c2 = v.c2 + } ; + SlashV2Q v q = predV v ** { + n3 = \\_ => q.s ! QIndir ; + c2 = v.c2 + } ; + SlashV2A v ap = predV v ** { + n3 = \\a => ap.s ! agrAdj a.gn DIndef ; + c2 = v.c2 + } ; + + ComplSlash vp np = + insertObj + (\\_ => vp.c2.s ++ np.s ! accusative ++ vp.n3 ! np.a) vp ; + + SlashVV v vp = + insertObj (\\a => v.c2.s ++ infVP vp a) (predV v) ** {n3 = vp.n3 ; c2 = vp.c2} ; + + SlashV2VNP v np vp = + insertObj + (\\a => v.c2.s ++ np.s ! accusative ++ v.c3.s ++ infVP vp a) (predV v) + ** {n3 = vp.n3 ; c2 = v.c2} ; + + UseComp comp = insertObj (\\a => comp.s ! agrAdj a.gn DIndef) (predV verbBe) ; + + CompAP ap = ap ; + CompNP np = {s = \\_ => np.s ! accusative} ; + CompAdv a = {s = \\_ => a.s} ; + + AdvVP vp adv = insertAdv adv.s vp ; + AdVVP adv vp = insertAdV adv.s vp ; + + + ReflVP vp = insertObj (\\a => vp.c2.s ++ reflPron a ++ vp.n3 ! a) vp ; + + PassV2 v = + insertObj + (\\a => v.s ! VI (VPtPret (agrAdj a.gn DIndef) Nom)) + (predV verbBecome) ; + +} |
