From d006a6a01612dd41c5581a2b54e62ff890afe0b0 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 5 Jan 2006 12:51:30 +0000 Subject: [PATCH] German verb syntax --- lib/resource-1.0/german/AdjectiveGer.gf | 34 ++--- lib/resource-1.0/german/CatGer.gf | 12 +- lib/resource-1.0/german/LexGer.gf | 20 +-- lib/resource-1.0/german/NounGer.gf | 2 +- lib/resource-1.0/german/ParamGer.gf | 17 ++- lib/resource-1.0/german/ResGer.gf | 191 +++++++++++++++++++----- lib/resource-1.0/german/SentenceGer.gf | 13 +- lib/resource-1.0/german/VerbGer.gf | 11 +- 8 files changed, 217 insertions(+), 83 deletions(-) diff --git a/lib/resource-1.0/german/AdjectiveGer.gf b/lib/resource-1.0/german/AdjectiveGer.gf index 6e4f60a32..b035fb0ba 100644 --- a/lib/resource-1.0/german/AdjectiveGer.gf +++ b/lib/resource-1.0/german/AdjectiveGer.gf @@ -1,16 +1,16 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { --- --- lin --- --- PositA a = { --- s = \\_ => a.s ! AAdj Posit ; --- isPre = True --- } ; --- ComparA a np = { --- s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ; --- isPre = False --- } ; --- + + lin + + PositA a = { + s = a.s ! Posit ; + isPre = True + } ; + ComparA a np = { + s = \\af => a.s ! Compar ! af ++ "als" ++ np.s ! Nom ; + isPre = False + } ; + ---- $SuperlA$ belongs to determiner syntax in $Noun$. -- -- ComplA2 a np = { @@ -31,11 +31,11 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { -- s = \\a => ap.s ! a ++ qs.s ! QIndir ; -- isPre = False -- } ; --- --- AdAP ada ap = { --- s = \\a => ada.s ++ ap.s ! a ; --- isPre = ap.isPre --- } ; + + AdAP ada ap = { + s = \\a => ada.s ++ ap.s ! a ; + isPre = ap.isPre + } ; -- -- UseA2 a = a ; -- diff --git a/lib/resource-1.0/german/CatGer.gf b/lib/resource-1.0/german/CatGer.gf index d9f5bb70b..5658cef04 100644 --- a/lib/resource-1.0/german/CatGer.gf +++ b/lib/resource-1.0/german/CatGer.gf @@ -8,18 +8,14 @@ concrete CatGer of Cat = open ResGer, Prelude, (R = ParamX) in { -- S = {s : Str} ; -- QS = {s : QForm => Str} ; -- RS = {s : Agr => Str} ; --- --- Cl = {s : Tense => Anteriority => Polarity => Order => Str} ; + + Cl = {s : Tense => Anteriority => Polarity => Order => Str} ; -- Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ; -- -- QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; -- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; --- --- VP = { --- s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ; --- s2 : Agr => Str --- } ; --- + + VP = ResGer.VP ; V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ; V2, VV, V2A = Verb ** {c2 : Preposition} ; V3 = Verb ** {c2, c3 : Preposition} ; diff --git a/lib/resource-1.0/german/LexGer.gf b/lib/resource-1.0/german/LexGer.gf index f15918a3a..bd12be157 100644 --- a/lib/resource-1.0/german/LexGer.gf +++ b/lib/resource-1.0/german/LexGer.gf @@ -1,8 +1,8 @@ concrete LexGer of Lex = CatGer ** open ResGer, Prelude in { lin - walk_V = mkV "gehen" "geht" "geh" "ging" "ginge" "gegangen" ; - help_V2 = mkV "helfen" "hilft" "hilf" "half" "hälfe" "geholfen" ** + walk_V = mkV "gehen" "geht" "geh" "ging" "ginge" "gegangen" VSein ; + help_V2 = mkV "helfen" "hilft" "hilf" "half" "hälfe" "geholfen" VHaben ** {c2 = {s = [] ; c = Dat}} ; show_V3 = regV "zeigen" ** {c2 = {s = [] ; c = Acc} ; c3 = {s = [] ; c = Dat}} ; @@ -22,14 +22,14 @@ concrete LexGer of Lex = CatGer ** open ResGer, Prelude in { always_AdV = {s = "immer"} ; only_Predet = {s = \\_,_,_ => "nur"} ; --- all_Predet = {s = "only"} ; --- 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 ; --- + all_Predet = {s = appAdj (regA "all")} ; + this_Quant = {s = appAdj (regA "dies") ! Sg ; n = Sg ; a = Weak} ; + these_Quant = {s = appAdj (regA "dies") ! Pl ; n = Pl ; a = Weak} ; + + i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Sg P1 ; + he_Pron = mkPronPers "er" "ihn" "ihm" "seiner" "sein" Sg P3 ; + we_Pron = mkPronPers "wir" "uns" "uns" "unser" "unser" Pl P1 ; + -- whoSg_IP = mkIP "who" "whom" "whose" Sg ; -- whoPl_IP = mkIP "who" "whom" "whose" Pl ; -- diff --git a/lib/resource-1.0/german/NounGer.gf b/lib/resource-1.0/german/NounGer.gf index c7b04e206..195eabf50 100644 --- a/lib/resource-1.0/german/NounGer.gf +++ b/lib/resource-1.0/german/NounGer.gf @@ -41,7 +41,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, Prelude in { PossPronPl p = { s = \\g,c => p.s ! NPPoss (gennum g Pl) c ; n = Pl ; - a = Strong + a = Weak } ; NoPredet = {s = \\_,_,_ => []} ; diff --git a/lib/resource-1.0/german/ParamGer.gf b/lib/resource-1.0/german/ParamGer.gf index b473e7087..12eba9501 100644 --- a/lib/resource-1.0/german/ParamGer.gf +++ b/lib/resource-1.0/german/ParamGer.gf @@ -50,11 +50,18 @@ resource ParamGer = ParamX ** { | VPresPart AForm | VPastPart AForm ; + param VPForm = + VPFinite Tense Anteriority + | VPImperat + | VPInfinit Anteriority ; + + param VAux = VHaben | VSein ; + -- The order of sentence is depends on whether it is used as a main -- clause, inverted, or subordinate. - Order = ODir | OQuest ; --- + param Order = Main | Inv | Sub ; + -- ----2 For $Relative$ -- @@ -80,6 +87,12 @@ resource ParamGer = ParamX ** { agrAdj : Gender -> Adjf -> Number -> Case -> AForm = \g,a,n,c -> AMod a (gennum g n) c ; + vFin : Tense -> Agr -> VForm = \t,a -> + case t of { + Pres => VPresInd a.n a.p ; + Past => VImpfInd a.n a.p ; + _ => VInf --- never used + } ; -- conjAgr : Agr -> Agr -> Agr = \a,b -> { -- n = conjNumber a.n b.n ; diff --git a/lib/resource-1.0/german/ResGer.gf b/lib/resource-1.0/german/ResGer.gf index 38ed815c3..480e33e99 100644 --- a/lib/resource-1.0/german/ResGer.gf +++ b/lib/resource-1.0/german/ResGer.gf @@ -90,9 +90,10 @@ resource ResGer = ParamGer ** open Prelude in { _ => ad GPl c } ; - Verb : Type = {s : VForm => Str} ; + Verb : Type = {s : VForm => Str ; aux : VAux} ; - mkV : (x1,_,_,_,_,x6 : Str) -> Verb = \geben,gibt,gib,gab,gaebe,gegeben -> + mkV : (x1,_,_,_,_,x6 : Str) -> VAux -> Verb = + \geben,gibt,gib,gab,gaebe,gegeben,aux -> let ifSibilant : Str -> Str -> Str -> Str = \u,b1,b2 -> case u of { @@ -114,35 +115,38 @@ resource ResGer = ParamGer ** open Prelude in { gabe = addE gab ; gibe = ifTok Str (Predef.dp 2 gib) "ig" "e" [] ++ addE gib in {s = table { + VInf => geben ; + VPresInd Sg P1 => geb + "e" ; VPresInd Sg P2 => gibst ; VPresInd Sg P3 => gibt ; VPresInd Pl P2 => gebt ; VPresInd Pl _ => geben ; -- the famous law + VImper Sg => gibe ; VImper Pl => gebt ; - VPresSubj Sg P1 => geb + "e" ; + VPresSubj Sg P2 => geb + "est" ; - VPresSubj Sg P3 => geb + "e" ; + VPresSubj Sg _ => geb + "e" ; VPresSubj Pl P2 => geb + "et" ; VPresSubj Pl _ => geben ; + VPresPart a => (regA (geben + "d")).s ! Posit ! a ; - VImpfInd Sg P1 => gab ; VImpfInd Sg P2 => gabe + "st" ; - VImpfInd Sg P3 => gab ; + VImpfInd Sg _ => gab ; VImpfInd Pl P2 => gabe + "t" ; VImpfInd Pl _ => gebte + "n" ; - VImpfSubj Sg P1 => gaebe ; VImpfSubj Sg P2 => gaebe + "st" ; - VImpfSubj Sg P3 => gaebe ; + VImpfSubj Sg _ => gaebe ; VImpfSubj Pl P2 => gaebe + "t" ; VImpfSubj Pl _ => gaebe + "n" ; VPastPart a => gegebener ! a - } + } ; + aux = aux } ; -- This function decides whether to add an "e" to the stem before "t". @@ -172,16 +176,14 @@ resource ResGer = ParamGer ** open Prelude in { -- All personal pronouns, except "ihr", conform to the simple -- pattern $mkPronPers$. - ProPN = {s : NPForm => Str ; n : Number ; p : Person} ; - - mkPronPers : (_,_,_,_,_ : Str) -> Number -> Person -> ProPN = + mkPronPers : (x1,_,_,_,x5 : Str) -> Number -> Person -> + {s : NPForm => Str ; a : Agr} = \ich,mich,mir,meiner,mein,n,p -> { s = table { NPCase c => caselist ich mich mir meiner ! c ; NPPoss gn c => mein + pronEnding ! gn ! c } ; - n = n ; - p = p + a = {n = n ; p = p} } ; pronEnding : GenNum => Case => Str = table { @@ -237,7 +239,7 @@ resource ResGer = ParamGer ** open Prelude in { lege = addE leg ; legte = lege + "te" in - mkV legen (lege+"t") leg legte legte ("ge"+lege+"t") ; + mkV legen (lege+"t") leg legte legte ("ge"+lege+"t") VHaben ; -- To eliminate the morpheme "ge". @@ -245,29 +247,150 @@ resource ResGer = ParamGer ** open Prelude in { s = table { VPastPart a => Predef.drop 2 (verb.s ! VPastPart a) ; v => verb.s ! v - } + } ; + aux = verb.aux + } ; + +-- To change the default auxiliary "haben" to "sein". + + seinV : Verb -> Verb = \verb -> { + s = verb.s ; + aux = VSein + } ; + + +-- For $Verb$. + + VP : Type = { + s : Agr => VPForm => { + fin : Str ; -- V1 hat ---s1 + inf : Str -- V2 gesagt ---s4 + } ; + a1 : Polarity => Str ; -- A1 nicht ---s3 + n2 : Agr => Str ; -- N2 dich ---s5 + a2 : Str ; -- A2 heute ---s6 + ext : Str -- S-Ext dass sie kommt ---s7 + } ; + + predV : Verb -> VP = \verb -> + let + vfin : Tense -> Agr -> Str = \t,a -> + verb.s ! vFin t a ; + vpart = verb.s ! VPastPart APred ; + vinf = verb.s ! VInf ; + + vHaben = auxPerfect verb ; + hat : Tense -> Agr -> Str = \t,a -> + vHaben ! vFin t a ; + haben : Str = vHaben ! VInf ; + + wird : Agr -> Str = \a -> werden_V.s ! VPresInd a.n a.p ; + wuerde : Agr -> Str = \a -> werden_V.s ! VImpfSubj a.n a.p ; + + vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> { + fin = fin ; inf = inf + } ; + + in { + s = \\a => table { + VPFinite t Simul => case t of { + Pres | Past => vf (vfin t a) [] ; + Fut => vf (wird a) vinf ; + Cond => vf (wuerde a) vinf + } ; + VPFinite t Anter => case t of { + Pres | Past => vf (hat t a) vpart ; + Fut => vf (wird a) (vpart ++ haben) ; + Cond => vf (wuerde a) (vpart ++ haben) + } ; + VPImperat => vf (verb.s ! VImper a.n) [] ; + VPInfinit Simul => vf [] vinf ; + VPInfinit Anter => vf [] (vpart ++ haben) + } ; + a1 : Polarity => Str = negation ; + n2 : Agr => Str = \\_ => [] ; + a2 : Str = [] ; + ext : Str = [] + } ; + + auxPerfect : Verb -> VForm => Str = \verb -> + case verb.aux of { + VHaben => haben_V.s ; + VSein => sein_V.s + } ; + + haben_V : Verb = + let + haben = mkV "haben" "hat" "hab" "hatte" "hätte" "gehabt" VHaben + in + {s = table { + VPresInd Sg P2 => "hast" ; + v => haben.s ! v + } ; + aux = VHaben + } ; + + werden_V : Verb = + let + werden = mkV "werden" "wird" "werd" "wurde" "würde" "geworden" VSein + in + {s = table { + VPresInd Sg P2 => "wirst" ; + v => werden.s ! v + } ; + aux = VSein + } ; + + sein_V : Verb = + let + sein = mkV "sein" "ist" "sei" "war" "wäre" "gewesen" VSein + in + {s = table { + VPresInd Sg P1 => "bin" ; + VPresInd Sg P2 => "bist" ; + VPresInd Pl P2 => "seid" ; + VPresInd Pl _ => "sind" ; + VImper Sg => "sei" ; + VImper Pl => "seid" ; + VPresSubj Sg P1 => "sei" ; + VPresSubj Sg P2 => (variants {"seiest" ; "seist"}) ; + VPresSubj Sg P3 => "sei" ; + VPresSubj Pl P2 => "seien" ; + VPresSubj Pl _ => "seiet" ; + VPresPart a => (regA "seiend").s ! Posit ! a ; + v => sein.s ! v + } ; + aux = VSein + } ; + + negation : Polarity => Str = table { + Pos => [] ; + Neg => "nicht" + } ; + + +-- 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 ! agr ! 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 ++ compl ++ verb.inf ++ verb.fin + } } ; - --- 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 => Order => Agr => {fin, inf : Str} ; -- diff --git a/lib/resource-1.0/german/SentenceGer.gf b/lib/resource-1.0/german/SentenceGer.gf index 666a72d2e..79cd47574 100644 --- a/lib/resource-1.0/german/SentenceGer.gf +++ b/lib/resource-1.0/german/SentenceGer.gf @@ -1,10 +1,11 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer in { --- --- flags optimize=all_subs ; --- --- lin --- PredVP np vp = mkClause (np.s ! Nom) np.a vp ; --- + + flags optimize=all_subs ; + + lin + + PredVP np vp = mkClause (np.s ! Nom) np.a vp ; + -- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; -- -- ImpVP vp = { diff --git a/lib/resource-1.0/german/VerbGer.gf b/lib/resource-1.0/german/VerbGer.gf index 07480d15e..3985fd9fe 100644 --- a/lib/resource-1.0/german/VerbGer.gf +++ b/lib/resource-1.0/german/VerbGer.gf @@ -1,9 +1,10 @@ concrete VerbGer of Verb = CatGer ** open ResGer in { --- --- flags optimize=all_subs ; --- --- lin --- UseV = predV ; + + 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) ;