diff --git a/lib/src/dutch/CatDut.gf b/lib/src/dutch/CatDut.gf index ba06a9784..d523de3fe 100644 --- a/lib/src/dutch/CatDut.gf +++ b/lib/src/dutch/CatDut.gf @@ -1,42 +1,38 @@ concrete CatDut of Cat = CommonX ** - open ResDut, Prelude in -{ + open ResDut, Prelude in { flags optimize=all_subs ; lincat --- ----- Tensed/Untensed --- + +-- Tensed/Untensed + S = {s : Order => Str} ; QS = {s : QForm => Str} ; --- RS = {s : GenNum => Str ; c : Case} ; --- SSlash = {s : Order => Str} ** {c2 : Preposition} ; --- ----- Sentence --- + RS = {s : Gender => Number => Str} ; + SSlash = {s : Order => Str} ** {c2 : Preposition} ; + +-- Sentence + Cl = Clause ; -- {s : Tense => Anteriority => Polarity => Order => Str} ; --- ClSlash = { --- s : Mood => ResDut.Tense => Anteriority => Polarity => Order => Str ; --- c2 : Preposition --- } ; --- Imp = {s : Polarity => ImpForm => Str} ; --- ----- Question --- - QCl = {s : ResDut.Tense => Anteriority => Polarity => QForm => Str} ; --- IP = {s : Case => Str ; n : Number} ; --- IComp = {s : Agr => Str} ; --- IDet = {s : Gender => Case => Str ; n : Number} ; --- IQuant = {s : Number => Gender => Case => Str} ; --- ----- Relative --- --- RCl = {s : Mood => ResDut.Tense => Anteriority => Polarity => GenNum => Str ; c : Case} ; --- RP = {s : GenNum => Case => Str ; a : RAgr} ; --- ----- Verb --- + ClSlash = Clause ** {c2 : Preposition} ; + Imp = {s : Polarity => ImpForm => Str} ; + +-- Question + + QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; + IP = {s : NPCase => Str ; n : Number} ; + IComp = {s : Agr => Str} ; + IDet = {s : Gender => Str ; n : Number} ; + IQuant = {s : Number => Gender => Str} ; + +-- Relative + + RCl = {s : Tense => Anteriority => Polarity => Gender => Number => Str} ; + RP = {s : Gender => Number => Str ; a : RAgr} ; + +-- Verb + VP = ResDut.VP ; VPSlash = ResDut.VP ** {c2 : Preposition} ; Comp = {s : Agr => Str} ; @@ -57,50 +53,36 @@ concrete CatDut of Cat = sp : Number => Gender => Str ; a : Adjf } ; --- Predet = {s : Number => Gender => Case => Str ; c : PredetCase} ; + Predet = {s : Number => Gender => Str} ; Num = {s : Str ; n : Number ; isNum : Bool} ; --- Card = {s : Gender => Case => Str ; n : Number} ; --- Ord = {s : AForm => Str} ; --- ----- Numeral --- --- Numeral = {s : CardOrd => Str ; n : Number } ; --- Digits = {s : CardOrd => Str ; n : Number } ; --- ----- Structural --- + Card = {s : Gender => Case => Str ; n : Number} ; + Ord = {s : AForm => 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 --- + +-- Open lexical classes, e.g. Lexicon + V, VS, VQ, VA = ResDut.VVerb ; VV = VVerb ** {isAux : Bool} ; V2, V2A, V2S, V2Q = VVerb ** {c2 : Preposition} ; --- V2V = Verb ** {c2 : Preposition ; isAux : Bool} ; --- V3 = Verb ** {c2, c3 : Preposition} ; --- + V2V = VVerb ** {c2 : Preposition ; isAux : Bool} ; + V3 = VVerb ** {c2, c3 : Preposition} ; + A = Adjective ; --- A2 = {s : Degree => AForm => Str ; c2 : Preposition} ; --- + A2 = Adjective ** {c2 : Preposition} ; + N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; --- N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Preposition} ; - PN = {s : Case => Str} ; --- ----- tense with possibility to choose conjunctive forms --- --- Temp = {s : Str ; t : ResDut.Tense ; a : Anteriority ; m : Mood} ; --- Tense = {s : Str ; t : ResDut.Tense ; m : Mood} ; --- --- lin --- TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a ; m = t.m} ; --- --- TPres = {s = [] ; t = Pres ; m = MIndic} ; --- TPast = {s = [] ; t = Past ; m = MIndic} ; --# notpresent --- TFut = {s = [] ; t = Fut ; m = MIndic} ; --# notpresent --- TCond = {s = [] ; t = Cond ; m = MIndic} ; --# notpresent ---} + N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; + PN = {s : NPCase => Str} ; } diff --git a/lib/src/dutch/LexiconDut.gf b/lib/src/dutch/LexiconDut.gf index 84b4d10bd..2fbc6549f 100644 --- a/lib/src/dutch/LexiconDut.gf +++ b/lib/src/dutch/LexiconDut.gf @@ -1,9 +1,9 @@ --# -path=.:../common:../abstract:../../prelude --- work by Aarne Ranta, Andreas Priesnitz, and Henning Thielemann. +-- work by Aarne Ranta concrete LexiconDut of Lexicon = CatDut ** - open Prelude, ParadigmsDut in { + open Prelude, ParadigmsDut, IrregDut in { flags optimize=all_subs ; @@ -139,7 +139,7 @@ lin -- open_V2 = mkV2 (mkV "öffnen") ; -- paint_V2A = mkV2A (mkV "malen") accPrep ; -- paper_N = mkN "Papier" "Papiere" neuter ; --- paris_PN = mkPN "Paris" "Paris" ; + paris_PN = mkPN "Parijs" ; -- peace_N = mk6N "Friede" "Frieden" "Frieden" "Friedens" "Frieden" "Frieden" masculine ; -- pen_N = mkN "Bleistift" ; ---- -- planet_N = mkN "Planet" "Planeten" masculine ; @@ -161,7 +161,7 @@ lin -- roof_N = mkN "Dach" "Dächer" neuter ; -- rubber_N = mkN "Gummi" "Gummis" neuter ; -- run_V = zijnV (mkV "laufen" "läuft" "lief" "liefe" "gelaufen") ; --- say_VS = mkVS (mkV "sagen") ; + say_VS = mkVS zeggen_V ; -- school_N = mkN "Schule"; -- science_N = mkN "Wissenschaft" "Wissenschaften" feminine ; -- sea_N = mkN "Meer" "Meere" neuter ; @@ -354,8 +354,8 @@ lin -- grammar_N = mkN "Grammatik" "Grammatiken" feminine ; -- language_N = mkN "Sprache" ; -- rule_N = mkN "Mkel" "Mkeln" feminine ; --- --- john_PN = mkPN "Johann" ; + + john_PN = mkPN "Jan" ; -- question_N = mkN "Frage" ; -- ready_A = mkA "fertig" ; -- reason_N = mkN "Grund" "Gründe" masculine ; diff --git a/lib/src/dutch/NounDut.gf b/lib/src/dutch/NounDut.gf index 1206fcf0b..e739d4a76 100644 --- a/lib/src/dutch/NounDut.gf +++ b/lib/src/dutch/NounDut.gf @@ -15,20 +15,19 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { isPron = False } ; --- UsePN pn = pn ** {a = agrP3 Sg} ; + UsePN pn = {s = pn.s ; a = agrP3 Sg ; isPron = False} ; UsePron pron = { s = table {NPNom => pron.unstressed.nom ; NPAcc => pron.unstressed.acc} ; a = pron.a } ; --- PredetNP pred np = { --- s = \\c0 => --- let c = case pred.c of {NoCase => c0 ; PredCase k => k} in --- pred.s ! np.a.n ! Masc ! c0 ++ np.s ! c ; ---- g --- a = np.a --- } ; --- + PredetNP pred np = { + s = \\c => + pred.s ! np.a.n ! np.a.g ++ np.s ! c ; ---- g + a = np.a + } ; + -- PPartNP np v2 = { -- s = \\c => np.s ! c ++ v2.s ! VPastPart APred ; --- invar part -- a = np.a @@ -69,21 +68,21 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { -- sp = \\n,g,c => p.s ! NPPoss (gennum g n) c ; -- a = Strong --- need separately weak for Pl ? -- } ; --- --- NumCard n = n ** {isNum = True} ; --- + + NumCard n = {s = n.s ! Utr ! Nom ; n = n.n ; isNum = True} ; + NumPl = {s = []; n = Pl ; isNum = False} ; NumSg = {s = []; n = Sg ; isNum = False} ; --- --- NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; --- OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; --- --- NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; --- OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; --- --- AdNum adn num = {s = \\g,c => adn.s ++ num.s!g!c; n = num.n } ; --- --- OrdSuperl a = {s = a.s ! Superl} ; + + NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; + + AdNum adn num = {s = \\g,c => adn.s ++ num.s!g!c; n = num.n } ; + + OrdSuperl a = {s = a.s ! Superl} ; DefArt = { s = \\_,n,g => case of { => "het" ; _ => "de"} ; @@ -150,12 +149,12 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { (cn.s ! a ! n) ; g = g } ; --- --- RelCN cn rs = { --- s = \\a,n,c => cn.s ! a ! n ! c ++ rs.s ! gennum cn.g n ; --- g = cn.g --- } ; --- + + RelCN cn rs = { + s = \\a,nc => cn.s ! a ! nc ++ rs.s ! cn.g ! (case nc of {NF n c => n}) ; + g = cn.g + } ; + -- RelNP np rs = { -- s = \\c => np.s ! c ++ "," ++ rs.s ! gennum np.a.g np.a.n ; -- a = np.a ; diff --git a/lib/src/dutch/NumeralDut.gf b/lib/src/dutch/NumeralDut.gf index 0b7891d15..c1b3f20ea 100644 --- a/lib/src/dutch/NumeralDut.gf +++ b/lib/src/dutch/NumeralDut.gf @@ -1,90 +1,103 @@ -concrete NumeralDut of Numeral = CatDut ** open MorphoDut in -{ ---{ --- ---flags optimize = all_subs ; --- ---lincat --- Digit = {s : DForm => CardOrd => Str} ; --- Sub10 = {s : DForm => CardOrd => Str ; n : Number} ; --- Sub100, Sub1000, Sub1000000 = --- {s : CardOrd => Str ; n : Number} ; --- ---lin --- num x = x ; --- --- n2 = mkDigit "zwei" "zwölf" "zwanzig" "zweite" ; --- n3 = mkDigit "drei" "dreizehn" "dreissig" "dritte" ; --- n4 = regDigit "vier" ; --- n5 = regDigit "fünf" ; --- n6 = regDigit "sechs" ; --- n7 = mkDigit "sieben" "siebzehn" "siebzig" "siebte" ; --- n8 = mkDigit "acht" "achzehn" "achzig" "achte" ; --- n9 = regDigit "neun" ; --- --- pot01 = { --- s = \\f => table { --- NCard g c => "ein" + pronEnding ! GSg g ! c ; --- NOrd af => (regA "erst").s ! Posit ! af --- } ; --- n = Sg --- } ; --- pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl} ; --- pot110 = {s = cardReg "zehn"; n = Pl} ; --- pot111 = {s = cardReg "elf"; n = Pl} ; --- pot1to19 d = {s = d.s ! DTeen; n = Pl} ; --- pot0as1 n = {s = n.s ! DUnit; n = n.n } ; --- pot1 d = {s = d.s ! DTen; n = Pl} ; --- pot1plus d e = {s = \\g => e.s ! DUnit ! invNum ++ "und" ++ d.s ! DTen ! g; n = Pl} ; --- pot1as2 n = n ; --- pot2 d = --- {s = \\g => d.s ! DUnit ! invNum ++ cardOrd "hundert" "hunderte" ! g ; n = Pl} ; --- pot2plus d e = --- {s = \\g => d.s ! DUnit ! invNum ++ "hundert" ++ e.s ! g ; n = Pl} ; --- pot2as3 n = n ; --- pot3 n = --- {s = \\g => n.s ! invNum ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ---- --- pot3plus n m = --- {s = \\g => n.s ! invNum ++ "tausend" ++ m.s ! g ; n = Pl} ; --- --- --- lincat --- Dig = TDigit ; --- --- lin --- IDig d = d ; --- --- IIDig d i = { --- s = \\o => d.s ! invNum ++ i.s ! o ; --- n = Pl --- } ; --- --- ---- TODO: case endings of ordinals --- D_0 = mkDig "0" ; --- D_1 = mk3Dig "1" "1e" Sg ; --- D_2 = mk2Dig "2" "2e" ; --- D_3 = mkDig "3" ; --- D_4 = mkDig "4" ; --- D_5 = mkDig "5" ; --- D_6 = mkDig "6" ; --- D_7 = mkDig "7" ; --- D_8 = mkDig "8" ; --- D_9 = mkDig "9" ; --- --- oper --- mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; --- mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; --- --- mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { --- s = table {NCard _ _ => c ; NOrd _ => o} ; --- n = n --- } ; --- --- TDigit = { --- n : Number ; --- s : CardOrd => Str --- } ; --- ---} +concrete NumeralDut of Numeral = CatDut ** open ResDut in { + +flags optimize = all_subs ; + +lincat + Digit = {s : DForm => CardOrd => Str} ; + Sub10 = {s : DForm => CardOrd => Str ; n : Number} ; + Sub100, Sub1000, Sub1000000 = + {s : CardOrd => Str ; n : Number} ; + +lin + num x = x ; + + n2 = mkDigit "twee" "twaalf" "twentig" "tweede" ; + n3 = mkDigit "drie" "dertien" "dertig" "derde" ; + n4 = mkDigit "vier" "veertien" "veertig" "vierde" ; + n5 = mkDigit "vijf" "vijftien" "vijftig" "vifjde" ; + n6 = mkDigit "zes" "zestien" "zestig" "zeste" ; + n7 = mkDigit "zeven" "zeventien" "zeventig" "zevende" ; + n8 = mkDigit "acht" "achttien" "tachtig" "achtste" ; + n9 = mkDigit "negen" "negentien" "negentig" "negende" ; + + pot01 = { + s = \\f => table { + NCard g _ => "één" ; + NOrd af => (regAdjective "eerst").s ! Posit ! af + } ; + n = Sg + } ; + pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl} ; + pot110 = {s = cardOrd "tien" "tiende" ; n = Pl} ; + pot111 = {s = cardOrd "elf" "elfde" ; n = Pl} ; + pot1to19 d = {s = d.s ! DTeen; n = Pl} ; + pot0as1 n = {s = n.s ! DUnit; n = n.n } ; + pot1 d = {s = d.s ! DTen; n = Pl} ; + pot1plus d e = {s = \\g => e.s ! DUnit ! invNum ++ "en" ++ d.s ! DTen ! g; n = Pl} ; + pot1as2 n = n ; + pot2 d = + {s = \\g => d.s ! DUnit ! invNum ++ cardOrd "honderd" "honderde" ! g ; n = Pl} ; + pot2plus d e = + {s = \\g => d.s ! DUnit ! invNum ++ "duizend" ++ e.s ! g ; n = Pl} ; + pot2as3 n = n ; + pot3 n = + {s = \\g => n.s ! invNum ++ cardOrd "duizend" "duizende" ! g ; n = Pl} ; + pot3plus n m = + {s = \\g => n.s ! invNum ++ "duizend" ++ m.s ! g ; n = Pl} ; + + + lincat + Dig = TDigit ; + + lin + IDig d = d ; + + IIDig d i = { + s = \\o => d.s ! invNum ++ i.s ! o ; + n = Pl + } ; + + D_0 = mkDig "0" ; + D_1 = mk3Dig "1" "1e" Sg ; + D_2 = mk2Dig "2" "2e" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + + oper + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; + + mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { + s = table {NCard _ _ => c ; NOrd _ => o} ; + n = n + } ; + + TDigit = { + n : Number ; + s : CardOrd => Str + } ; + + LinDigit = {s : DForm => CardOrd => Str} ; + + cardOrd : Str -> Str -> CardOrd => Str = \drei,dritte -> + table { + NCard _ _ => drei ; + NOrd a => (regAdjective dritte).s ! Posit ! a + } ; + + mkDigit : (x1,_,_,x4 : Str) -> LinDigit = + \drei,dreizehn,dreissig,dritte -> + {s = table { + DUnit => cardOrd drei dritte ; + DTeen => cardOrd dreizehn (dreizehn + "de") ; + DTen => cardOrd dreissig (dreissig + "ste") + } + } ; + invNum : CardOrd = NCard Utr Nom ; } diff --git a/lib/src/dutch/ParadigmsDut.gf b/lib/src/dutch/ParadigmsDut.gf index 172faab5f..f06acdf8c 100644 --- a/lib/src/dutch/ParadigmsDut.gf +++ b/lib/src/dutch/ParadigmsDut.gf @@ -77,24 +77,17 @@ oper -- -- mkN3 : N -> Prep -> Prep -> N3 ; -- --- -----3 Proper names and noun phrases ----- ----- Proper names, with an "s" genitive and other cases like the ----- nominative, are formed from a string. Final "s" ("Johannes-Johannes") is ----- taken into account. --- --- mkPN : overload { --- mkPN : Str -> PN ; --- ----- If only the genitive differs, two strings are needed. --- --- mkPN : (nom,gen : Str) -> PN ; --- ----- In the worst case, all four forms are needed. --- --- mkPN : (nom,acc,dat,gen : Str) -> PN --- } ; + +--3 Proper names and noun phrases + + mkPN : overload { + mkPN : Str -> PN ; + } ; + + mkPN = overload { + mkPN : Str -> PN = \s -> lin PN {s = \\_ => s} ; + } ; + --2 Adjectives @@ -199,15 +192,15 @@ oper ---- ---- Verbs and adjectives can take complements such as sentences, ---- questions, verb phrases, and adjectives. --- --- mkV0 : V -> V0 ; --- mkVS : V -> VS ; + + mkV0 : V -> V0 ; + mkVS : V -> VS ; -- mkV2S : V -> Prep -> V2S ; --- mkVV : V -> VV ; + mkVV : V -> VV ; -- mkV2V : V -> Prep -> V2V ; --- mkVA : V -> VA ; + mkVA : V -> VA ; -- mkV2A : V -> Prep -> V2A ; --- mkVQ : V -> VQ ; + mkVQ : V -> VQ ; -- mkV2Q : V -> Prep -> V2Q ; -- -- mkAS : A -> AS ; @@ -391,19 +384,18 @@ oper -- dirV3 v p = mkV3 v (mkPrep [] accusative) p ; -- accdatV3 v = dirV3 v (mkPrep [] dative) ; -- --- mkVS v = v ** {lock_VS = <>} ; --- mkVQ v = v ** {lock_VQ = <>} ; --- mkVV v = v ** {isAux = False ; lock_VV = <>} ; --- --- V0 : Type = V ; ----- V2S, V2V, V2Q : Type = V2 ; + mkVS v = lin VS v ; + mkVQ v = lin VQ v ; + mkVV v = lin VV (v ** {isAux = False}) ; + + V0 : Type = V ; -- AS, A2S, AV : Type = A ; -- A2V : Type = A2 ; --- --- mkV0 v = v ** {lock_V = <>} ; + + mkV0 v = v ; -- mkV2S v p = prepV2 v p ** {lock_V2S = <>} ; -- mkV2V v p = prepV2 v p ** {isAux = False ; lock_V2V = <>} ; --- mkVA v = v ** {lock_VA = <>} ; + mkVA v = lin VA v ; -- mkV2A v p = prepV2 v p ** {lock_V2A = <>} ; -- mkV2Q v p = prepV2 v p ** {lock_V2Q = <>} ; -- diff --git a/lib/src/dutch/PhraseDut.gf b/lib/src/dutch/PhraseDut.gf index aa1900285..922d6cb78 100644 --- a/lib/src/dutch/PhraseDut.gf +++ b/lib/src/dutch/PhraseDut.gf @@ -9,16 +9,16 @@ concrete PhraseDut of Phrase = CatDut ** open Prelude, ResDut in UttS s = {s = s.s ! Main} ; UttQS qs = {s = qs.s ! QDir} ; --- UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg False} ; --- UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False} ; --- UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True} ; --- --- UttIP ip = {s = ip.s ! Nom} ; --- Acc also --- UttIAdv iadv = iadv ; --- UttNP np = {s = np.s ! Nom} ; + UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg False} ; + UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False} ; + UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True} ; + + UttIP ip = {s = ip.s ! NPNom} ; --- Acc also + UttIAdv iadv = iadv ; + UttNP np = {s = np.s ! NPNom} ; -- UttVP vp = {s = useInfVP True vp} ; -- without zu --- UttAdv adv = adv ; --- + UttAdv adv = adv ; + NoPConj = {s = []} ; -- PConjConj conj = ss (conj.s2) ; -- diff --git a/lib/src/dutch/QuestionDut.gf b/lib/src/dutch/QuestionDut.gf index 7dc03bfd3..62055470a 100644 --- a/lib/src/dutch/QuestionDut.gf +++ b/lib/src/dutch/QuestionDut.gf @@ -14,27 +14,27 @@ concrete QuestionDut of Question = CatDut ** open ResDut in { } } ; --- QuestVP qp vp = { --- s = \\m,t,a,b,q => --- let --- cl = (mkClause (qp.s ! Nom) (agrP3 qp.n) vp).s ! m ! t ! a ! b --- in --- case q of { --- QIndir => cl ! Sub ; --- _ => cl ! Main --- } --- } ; --- --- QuestSlash ip slash = { --- s = \\m,t,a,p => --- let --- cls = slash.s ! m ! t ! a ! p ; --- who = appPrep slash.c2 ip.s --- in table { --- QDir => who ++ cls ! Inv ; --- QIndir => who ++ cls ! Sub --- } --- } ; + QuestVP qp vp = { + s = \\t,a,b,q => + let + cl = (mkClause (qp.s ! NPNom) (agrP3 qp.n) vp).s ! t ! a ! b + in + case q of { + QIndir => cl ! Sub ; + _ => cl ! Main + } + } ; + + QuestSlash ip slash = { + s = \\t,a,p => + let + cls = slash.s ! t ! a ! p ; + who = appPrep slash.c2 ip.s + in table { + QDir => who ++ cls ! Inv ; + QIndir => who ++ cls ! Sub + } + } ; QuestIAdv iadv cl = { s = \\t,a,p => @@ -46,56 +46,56 @@ concrete QuestionDut of Question = CatDut ** open ResDut in { QIndir => why ++ cls ! Sub } } ; --- --- QuestIComp icomp np = { --- s = \\m,t,a,p => --- let --- vp = predV sein_V ; --- cls = (mkClause (np.s ! Nom) np.a vp).s ! m ! t ! a ! p ; --- why = icomp.s ! np.a --- in table { --- QDir => why ++ cls ! Inv ; --- QIndir => why ++ cls ! Sub --- } --- } ; --- --- PrepIP p ip = { --- s = appPrep p ip.s --- } ; --- --- AdvIP ip adv = { --- s = \\c => ip.s ! c ++ adv.s ; --- n = ip.n --- } ; --- --- IdetCN idet cn = --- let --- g = cn.g ; --- n = idet.n --- in { --- s = \\c => idet.s ! g ! c ++ cn.s ! Weak ! n ! c ; --- n = n --- } ; --- --- IdetIP idet = --- let --- g = Neutr ; ---- --- n = idet.n --- in { --- s = idet.s ! g ; --- n = n --- } ; --- --- IdetQuant idet num = --- let --- n = num.n --- in { --- s = \\g,c => idet.s ! n ! g ! c ++ num.s!g!c ; --- n = n --- } ; --- --- CompIAdv a = {s = \\_ => a.s} ; --- --- CompIP ip = {s = \\_ => ip.s ! Nom} ; + + QuestIComp icomp np = { + s = \\t,a,p => + let + vp = predV zijn_V ; + cls = (mkClause (np.s ! NPNom) np.a vp).s ! t ! a ! p ; + why = icomp.s ! np.a + in table { + QDir => why ++ cls ! Inv ; + QIndir => why ++ cls ! Sub + } + } ; + + PrepIP p ip = { + s = appPrep p.s ip.s + } ; + + AdvIP ip adv = { + s = \\c => ip.s ! c ++ adv.s ; + n = ip.n + } ; + + IdetCN idet cn = + let + g = cn.g ; + n = idet.n + in { + s = \\c => idet.s ! g ++ cn.s ! Weak ! NF n Nom ; + n = n + } ; + + IdetIP idet = + let + g = Neutr ; ---- + n = idet.n + in { + s = \\_ => idet.s ! g ; + n = n + } ; + + IdetQuant idet num = + let + n = num.n + in { + s = \\g => idet.s ! n ! g ++ num.s ; + n = n + } ; + + CompIAdv a = {s = \\_ => a.s} ; + + CompIP ip = {s = \\_ => ip.s ! NPNom} ; } diff --git a/lib/src/dutch/RelativeDut.gf b/lib/src/dutch/RelativeDut.gf index b6f14c9c4..2b2a4e445 100644 --- a/lib/src/dutch/RelativeDut.gf +++ b/lib/src/dutch/RelativeDut.gf @@ -1,52 +1,46 @@ -concrete RelativeDut of Relative = CatDut ** open ResDut in -{ ---{ --- --- flags optimize=all_subs ; --- --- lin --- +concrete RelativeDut of Relative = CatDut ** open ResDut in { + + + flags optimize=all_subs ; + + lin + -- RelCl cl = { -- s = \\m,t,a,b,_ => "derart" ++ conjThat ++ cl.s ! m ! t ! a ! b ! Sub ; -- c = Nom -- } ; -- --- RelVP rp vp = { --- s = \\m,t,ant,b,gn => --- let --- agr = case rp.a of { --- RNoAg => agrP3 (numGenNum gn) ; --- RAg a => a ** {g = Neutr} --- } ; --- cl = mkClause (rp.s ! gn ! Nom) agr vp --- in --- cl.s ! m ! t ! ant ! b ! Sub ; --- c = Nom --- } ; --- --- RelSlash rp slash = { --- s = \\m,t,a,p,gn => --- appPrep slash.c2 (rp.s ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; --- c = slash.c2.c --- } ; --- + RelVP rp vp = { + s = \\t,ant,b,g,n => + let + agr = case rp.a of { + RNoAg => agrgP3 g n ; + RAg rn p => {g = Utr ; n = rn ; p = p} ---- g + } ; + cl = mkClause (rp.s ! g ! n) agr vp + in + cl.s ! t ! ant ! b ! Sub ; + c = Nom + } ; + + RelSlash rp slash = { + s = \\t,a,p,g,n => + appPrep slash.c2 (\\_ => rp.s ! g ! n) ++ slash.s ! t ! a ! p ! Sub ; + c = slash.c2.c + } ; + -- FunRP p np rp = { -- s = \\gn,c => np.s ! c ++ appPrep p (rp.s ! gn) ; -- a = RAg {n = np.a.n ; p = np.a.p} -- } ; -- --- IdRP = {s = relPron ; a = RNoAg} ; --- --- oper --- relPron : GenNum => Case => Str = \\gn,c => --- case of { --- => "deren" ; --- => "dessen" ; --- => "denen" ; --- => "deren" ; --- _ => artDef ! gn ! c --- } ; --- ---} + IdRP = {s = relPron ; a = RNoAg} ; + + oper + relPron : Gender => Number => Str = \\g,n => + case of { + => "dat" ; + _ => "die" + } ; } diff --git a/lib/src/dutch/ResDut.gf b/lib/src/dutch/ResDut.gf index 34cada339..7d438f66f 100644 --- a/lib/src/dutch/ResDut.gf +++ b/lib/src/dutch/ResDut.gf @@ -372,22 +372,18 @@ param => VPastPl } ; --- ----- Main clause mood: "es sei, es wäre, es werde sein". ----- Not relevant for $Fut$. --- --- --- Mood = MIndic | MConjunct ; --- -----2 For $Relative$ --- --- RAgr = RNoAg | RAg {n : Number ; p : Person} ; --- -----2 For $Numeral$ --- --- CardOrd = NCard Gender Case | NOrd AForm ; --- DForm = DUnit | DTeen | DTen ; --- -----2 Transformations between parameter types +--2 For $Relative$ + + param + RAgr = RNoAg | RAg Number Person ; + +--2 For $Numeral$ + + param + CardOrd = NCard Gender Case | NOrd AForm ; + DForm = DUnit | DTeen | DTen ; + +--2 Transformations between parameter types oper Agr : Type = {g : Gender ; n : Number ; p : Person} ; @@ -487,15 +483,15 @@ param ext = vp.ext } ; --- insertAdV : Str -> VP -> VP = \adv,vp -> { --- s = vp.s ; --- a1 = \\a => adv ++ vp.a1 ! a ; -- immer nicht --- n2 = vp.n2 ; --- a2 = vp.a2 ; --- isAux = vp.isAux ; --- inf = vp.inf ; --- ext = vp.ext --- } ; + insertAdV : Str -> VP -> VP = \adv,vp -> { + s = vp.s ; + a1 = \\a => adv ++ vp.a1 ! a ; -- immer nicht + n2 = vp.n2 ; + a2 = vp.a2 ; + isAux = vp.isAux ; + inf = vp.inf ; + ext = vp.ext + } ; insertAdv : Str -> VP -> VP = \adv,vp -> { s = vp.s ; @@ -601,16 +597,22 @@ param -- {n = Pl ; p = P2} => caselist "ihr" "euch" "euch" "euer" ; -- {n = Pl ; p = P3} => caselist "sie" "sich" "sich" "ihrer" -- } ; --- --- conjThat : Str = "daß" ; --- --- conjThan : Str = "als" ; --- ----- The infinitive particle "zu" is used if and only if $vv.isAux = False$. --- --- infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ; --- ---} + + conjThat : Str = "dat" ; + + conjThan : Str = "dan" ; + +-- The infinitive particle "zu" is used if and only if $vv.isAux = False$. + + infPart : Bool -> Str = \b -> if_then_Str b [] "te" ; + + mkDet : Str -> Str -> Number -> {s,sp : Gender => Str ; n : Number ; a : Adjf} = + \deze,dit,n -> { + s = \\g => case of { => dit ; _ => deze} ; + sp = \\g => case of { => dit ; _ => deze} ; + n = n ; + a = Weak + } ; mkQuant : Str -> Str -> { s : Bool => Number => Gender => Str ; @@ -623,6 +625,16 @@ param a = Weak } ; + mkPredet : Str -> Str -> {s : Number => Gender => Str} = + \deze,dit -> { + s = \\n,g => case of { => dit ; _ => deze} + } ; + + mkNP : Str -> Gender -> Number -> {s : NPCase => Str ; a : Agr} = \s,g,n -> { + s = \\_ => s ; + a = agrgP3 g n ; + } ; + auxVV : VVerb -> VVerb ** {isAux : Bool} = \v -> v ** {isAux = True} ; } diff --git a/lib/src/dutch/SentenceDut.gf b/lib/src/dutch/SentenceDut.gf index 10c161447..bf9e07706 100644 --- a/lib/src/dutch/SentenceDut.gf +++ b/lib/src/dutch/SentenceDut.gf @@ -5,30 +5,30 @@ concrete SentenceDut of Sentence = CatDut ** open ResDut, Prelude in { lin PredVP np vp = mkClause (np.s ! NPNom) np.a vp ; --- --- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; --- --- ImpVP vp = let vps = useVP vp in { --- s = \\pol,n => --- let --- ps = case n of { --- ImpF _ True => ; -- setzen Sie sich --- _ => --- } ; --- agr = {g = Fem ; n = numImp n ; p = ps.p1} ; --- g does not matter --- verb = vps.s ! False ! agr ! VPImperat ps.p3 ; --- inf = vp.inf ++ verb.inf ; --- in --- verb.fin ++ ps.p2 ++ --- vp.n2 ! agr ++ vp.a1 ! pol ++ vp.a2 ++ inf ++ vp.ext --- } ; --- --- SlashVP np vp = --- mkClause --- (np.s ! Nom) np.a --- vp ** --- {c2 = vp.c2} ; --- + + PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; + + ImpVP vp = { + s = \\pol,im => + let + ps = case im of { + ImpF n True => ; + ImpF n False => ---- also plural? + } ; + agr = {g = Utr ; n = ps.p3 ; p = P2} ; ---- P2? -- g does not matter + verb = vp.s.s ! ps.p1 ; + inf = vp.inf ; + in + verb ++ ps.p2 ++ + vp.n2 ! agr ++ vp.a1 ! pol ++ vp.a2 ++ inf ++ vp.ext + } ; + + SlashVP np vp = + mkClause + (np.s ! NPNom) np.a + vp ** + {c2 = vp.c2} ; + -- AdvSlash slash adv = { -- s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ; -- c2 = slash.c2 @@ -51,14 +51,13 @@ concrete SentenceDut of Sentence = CatDut ** open ResDut, Prelude in { UseQCl t p cl = { s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! q } ; --- UseRCl t p cl = { --- s = \\r => t.s ++ p.s ++ cl.s ! t.m ! t.t ! t.a ! p.p ! r ; --- c = cl.c --- } ; --- UseSlash t p cl = { --- s = \\o => t.s ++ p.s ++ cl.s ! t.m ! t.t ! t.a ! p.p ! o ; --- c2 = cl.c2 --- } ; + UseRCl t p cl = { + s = \\g,n => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! g ! n + } ; + UseSlash t p cl = { + s = \\o => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! o ; + c2 = cl.c2 + } ; AdvS a s = {s = \\o => a.s ++ s.s ! Inv} ; diff --git a/lib/src/dutch/StructuralDut.gf b/lib/src/dutch/StructuralDut.gf index 6d74f45c4..15400f87e 100644 --- a/lib/src/dutch/StructuralDut.gf +++ b/lib/src/dutch/StructuralDut.gf @@ -10,7 +10,7 @@ concrete StructuralDut of Structural = CatDut, Prelude ** above_Prep = mkPrep "boven" ; after_Prep = mkPrep "na" ; --- all_Predet = {s = appAdj (regA "all") ; c = NoCase} ; + all_Predet = mkPredet "alle" "alle" ; ---- -- almost_AdA, almost_AdN = ss "fast" ; -- although_Subj = ss "obwohl" ; always_AdV = ss "altijd" ; @@ -31,9 +31,9 @@ concrete StructuralDut of Structural = CatDut, Prelude ** -- VHaben) ; -- during_Prep = mkPrep "während" Gen ; -- either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ; --- everybody_NP = nameNounPhrase {s = caselist "jeder" "jeden" "jedem" "jedes"} ; --- every_Det = detLikeAdj Sg "jed" ; --- everything_NP = nameNounPhrase {s = caselist "alles" "alles" "allem" "alles"} ; + everybody_NP = mkNP "alle" Utr Pl ; ---- + every_Det = mkDet "elke" "elk" Sg ; ---- + everything_NP = mkNP "alles" Neutr Sg ; ---- everywhere_Adv = ss "overal" ; -- few_Det = detLikeAdj Pl "wenig" ; ------ first_Ord = {s = (regA "erst").s ! Posit} ; @@ -59,9 +59,8 @@ concrete StructuralDut of Structural = CatDut, Prelude ** must_VV = auxVV (mkV "moeten" "moest" "gemoete") ; --- only_Predet = {s = \\_,_,_ => "nur" ; c = NoCase} ; --- no_Utt = ss "nein" ; ------b no_Phr = ss "nein" ; + only_Predet = {s = \\_,_ => "slechts"} ; + no_Utt = ss "neen" ; on_Prep = mkPrep "op" ; or_Conj = {s1 = [] ; s2 = "of" ; n = Sg} ; -- otherwise_PConj = ss "sonst" ; @@ -71,7 +70,7 @@ concrete StructuralDut of Structural = CatDut, Prelude ** -- quite_Adv = ss "ziemlich" ; she_Pron = mkPronoun "ze" "haar" "haar" "zij" "haar" "haar" "haare" Utr Sg P3 ; --- so_AdA = ss "so" ; + so_AdA = ss "zo" ; -- somebody_NP = nameNounPhrase {s = caselist "jemand" "jemanden" "jemandem" "jemands"} ; -- somePl_Det = detLikeAdj Pl "einig" ; -- someSg_Det = { @@ -101,20 +100,20 @@ concrete StructuralDut of Structural = CatDut, Prelude ** want_VV = auxVV (mkV "wil" "wil" "willen" "wou" "wouden" "gewild") ; we_Pron = mkPronoun "we" "ons" "ons" "wij" "ons" "onze" "onze" Utr Sg P3 ; ---- --- --- whatSg_IP = {s = caselist "was" "was" "was" "wessen" ; n = Sg} ; ---- --- whatPl_IP = {s = caselist "was" "was" "was" "wessen" ; n = Pl} ; ---- --- + + whatSg_IP = {s = \\_ => "wat" ; n = Sg} ; + whatPl_IP = {s = \\_ => "wat" ; n = Pl} ; + when_IAdv = ss "wanneer" ; -- when_Subj = ss "wenn" ; where_IAdv = ss "waar" ; --- which_IQuant = {s = \\n => (detLikeAdj n "welch").s} ; --- --- whoSg_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; --- whoPl_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Pl} ; --- why_IAdv = ss "warum" ; --- without_Prep = mkPrep "ohne" Acc ; --- with_Prep = mkPrep "mit" Dat ; + which_IQuant = mkPredet "welke" "welk" ; + + whoSg_IP = {s = \\_ => "wie" ; n = Sg} ; + whoPl_IP = {s = \\_ => "wie" ; n = Pl} ; + why_IAdv = ss "waarom" ; + without_Prep = mkPrep "zonder" ; + with_Prep = mkPrep "met" ; youSg_Pron = mkPronoun "je" "je" "je" "jij" "jou" "je" "jouwe" Utr Sg P2 ; -- youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Fem Pl P2 ; ---- poss -- youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ; diff --git a/lib/src/dutch/VerbDut.gf b/lib/src/dutch/VerbDut.gf index 07a3636dc..b31a4af01 100644 --- a/lib/src/dutch/VerbDut.gf +++ b/lib/src/dutch/VerbDut.gf @@ -14,12 +14,12 @@ concrete VerbDut of Verb = CatDut ** open Prelude, ResDut in { insertObj vpi.p1 ( predVGen v.isAux {s = v.s ; aux = v.aux ; prefix = v.prefix ; vtype = v.vtype}))) ; ---- subtyp --- ComplVS v s = --- insertExtrapos (conjThat ++ s.s ! Sub) (predV v) ; --- ComplVQ v q = --- insertExtrapos (q.s ! QIndir) (predV v) ; --- ComplVA v ap = insertObj (\\ _ => ap.s ! APred) (predV v) ; --- + ComplVS v s = + insertExtrapos (conjThat ++ s.s ! Sub) (predV v) ; + ComplVQ v q = + insertExtrapos (q.s ! QIndir) (predV v) ; + ComplVA v ap = insertObj (\\ _ => ap.s ! APred) (predV v) ; + SlashV2a v = predV {s = v.s ; aux = v.aux ; prefix = v.prefix ; vtype = v.vtype} ** {c2 = v.c2} ; -- -- Slash2V3 v np = @@ -65,18 +65,14 @@ concrete VerbDut of Verb = CatDut ** open Prelude, ResDut in { -- UseComp comp = insertAdv (comp.s ! agrP3 Sg) (predV zijn_V) ; -- agr not used CompAP ap = {s = \\_ => ap.s ! APred} ; --- CompNP np = {s = \\_ => np.s ! Nom} ; + CompNP np = {s = \\_ => np.s ! NPNom} ; CompAdv a = {s = \\_ => a.s} ; AdvVP vp adv = insertAdv adv.s vp ; --- AdVVP adv vp = insertAdV adv.s vp ; + AdVVP adv vp = insertAdV adv.s vp ; -- -- ReflVP vp = insertObj (\\a => appPrep vp.c2 (reflPron ! a)) vp ; -- -- PassV2 v = insertInf (v.s ! VPastPart APred) (predV werdenPass) ; --- ------b UseVS, UseVQ = \v -> v ** {c2 = noPreposition Acc} ; --- ---} } diff --git a/src/PGF/VisualizeTree.hs b/src/PGF/VisualizeTree.hs index bd419e14f..857c1b08d 100644 --- a/src/PGF/VisualizeTree.hs +++ b/src/PGF/VisualizeTree.hs @@ -244,6 +244,36 @@ lin2graph ss = trace (show ss) $ prelude ++ nodes ++ links edge i v w = struct i ++ ":" ++ mark v ++ ":e -> " ++ struct (i+1) ++ ":" ++ mark w ++ ":w ;" +{- +alignmentData :: PGF -> [Expr] -> Map.Map String (Map.Map String Double) +alignmentData pgf = mkStat . concatMap (mkAlign . linsMark) where + linsMark t = + [s | la <- take 2 (cncnames pgf), s <- take 1 (linearizesMark pgf la t)] + + mkStat :: [(String,String)] -> Map.Map String (Map.Map String Double) + mkStat = + + mkAlign :: [String] -> [(String,String)] + mkAlign ss = + + nlins :: [(Int,[((Int,String),String)])] + nlins = [(i, [((j,showp p),unw ws) | (j,((_,p),ws)) <- zip [0..] vs]) | + (i,vs) <- zip [0..] (map (wlins . readPosText) ss)] + + nodes = map mkStruct nlins + + mkStruct (i, ws) = struct i ++ "[label = \"" ++ fields ws ++ "\"] ;" + + fields ws = concat (intersperse "|" [tag (mark m) ++ " " ++ w | (m,w) <- ws]) + + links = nub $ concatMap mkEdge (init nlins) + + mkEdge (i,lin) = let lin' = snd (nlins !! (i+1)) in -- next lin in the list + [edge i v w | (v@(_,p),_) <- lin, (w@(_,q),_) <- lin', p == q] + + edge i v w = + struct i ++ ":" ++ mark v ++ ":e -> " ++ struct (i+1) ++ ":" ++ mark w ++ ":w ;" +-} wlins :: PosText -> [((Maybe CId,[Int]),[String])] wlins pt = case pt of