diff --git a/lib/src/german/CatGer.gf b/lib/src/german/CatGer.gf index 8cf90e157..5fde382e7 100644 --- a/lib/src/german/CatGer.gf +++ b/lib/src/german/CatGer.gf @@ -88,9 +88,9 @@ concrete CatGer of Cat = A = {s : Degree => AForm => Str} ; A2 = {s : Degree => AForm => Str ; c2 : Preposition} ; - N = {s : Number => Case => Str ; g : Gender} ; - N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Preposition} ; - N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Preposition} ; + N = ResGer.Noun ; + N2 = ResGer.Noun ** {c2 : Preposition} ; + N3 = ResGer.Noun ** {c2,c3 : Preposition} ; PN = {s : Case => Str} ; -- tense with possibility to choose conjunctive forms diff --git a/lib/src/german/NounGer.gf b/lib/src/german/NounGer.gf index 1c9597ac3..9dff6bdd2 100644 --- a/lib/src/german/NounGer.gf +++ b/lib/src/german/NounGer.gf @@ -139,19 +139,18 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ComplN3 f x = { s = \\n,c => f.s ! n ! c ++ appPrep f.c2 x.s ; + co = f.co ++ appPrep f.c2 x.s ; ---- should not occur at all; the abstract syntax is problematic in giving N2 + uncap = { + s = \\n,c => f.uncap.s ! n ! c ++ appPrep f.c2 x.s ; + co = f.uncap.co ++ appPrep f.c2 x.s ; ---- should not occur at all; the abstract syntax is problematic in giving N2 + } ; g = f.g ; c2 = f.c3 } ; - Use2N3 f = { - s = f.s ; - g = f.g ; - c2 = f.c2 - } ; + Use2N3 f = f ; - Use3N3 f = { - s = f.s ; - g = f.g ; + Use3N3 f = f ** { c2 = f.c3 } ; diff --git a/lib/src/german/ParadigmsGer.gf b/lib/src/german/ParadigmsGer.gf index 53d005d02..fd08aef03 100644 --- a/lib/src/german/ParadigmsGer.gf +++ b/lib/src/german/ParadigmsGer.gf @@ -90,8 +90,17 @@ mkN : overload { mkN : Str -> N -> N ; -- Auto + Fahrer -> Autofahrer + mkN : N -> N -> N ; -- Freiheit + Kampf -> Freiheitskampf + }; +-- The default compound form can be changed: + + changeCompoundN : Str -> N -> N ; -- kyrko + kyrka_N + +-- Add dative -e ; typically used as variant, either first or second. + + dative_eN : N -> N ; -- Relational nouns need a preposition. The most common is "von" with -- the dative, and there is a special case for regular nouns. @@ -211,7 +220,7 @@ mkV : overload { -- To add a movable prefix e.g. "auf(fassen)". - mkV : Str -> V -> V -- movable prefix, e.g. auf+fassen + mkV : Str -> V -> V -- movable prefix, e.g. auf+fassen, or fix prefix if one of be,er,ge,ver,zer }; @@ -234,6 +243,10 @@ mkV : overload { reflV : V -> Case -> V ; -- reflexive, with case +-- Compound verbs: verbs with a fixed particle; syntactically similar to prefix but written separately. + + compoundV : Str -> V -> V ; -- verb with a separate "particle", e.g. "Trinkgeld geben" + --3 Two-place verbs @@ -347,12 +360,13 @@ mkV2 : overload { singular = Sg ; plural = Pl ; - mk6N a b c d e f g = MorphoGer.mkN a b c d e f g ** {lock_N = <>} ; + mk6N a b c d e f g = MorphoGer.mkN a b c d e f (mkCompoundForm a) g ** {lock_N = <>} ; regN : Str -> N = \hund -> case hund of { _ + "e" => mk6N hund hund hund hund (hund + "n") (hund + "n") Fem ; _ + ("ion" | "ung") => mk6N hund hund hund hund (hund + "en") (hund + "en") Fem ; _ + ("er" | "en" | "el") => mk6N hund hund hund (genitS (True | False) hund) hund (pluralN hund) Masc ; + _ + "nis" => mk6N hund hund hund hund (hund + "se") (hund + "sen") Neutr ; _ => mk6N hund hund hund (genitS (True | False) hund) (hund + "e") (pluralN hund) Masc } ; @@ -366,17 +380,20 @@ mkV2 : overload { mk6N hund hunde hunde hunde hunde hunde g ; <_, Masc> => let hunde = hund + "e" ; hunden = pluralN hunde in - variants {mk6N hund hund (dativE True hund) (genitS True hund) hunde hunden g ; - mk6N hund hund (dativE False hund) (genitS False hund) hunde hunden g} ; + mk6N hund hund hund (genitS True hund) hunde hunden g ; + ---variants {mk6N hund hund (dativE True hund) (genitS True hund) hunde hunden g ; + --- mk6N hund hund (dativE False hund) (genitS False hund) hunde hunden g} ; <_, Neutr> => let hunde = hund + "er" ; hunden = pluralN hunde in - variants {mk6N hund hund (dativE True hund) (genitS True hund) hunde hunden g ; - mk6N hund hund (dativE False hund) (genitS False hund) hunde hunden g} ; + variants {mk6N hund hund hund (genitS True hund) hunde hunden g ; + mk6N hund hund hund (genitS False hund) hunde hunden g} ; +--- variants {mk6N hund hund (dativE True hund) (genitS True hund) hunde hunden g ; +--- mk6N hund hund (dativE False hund) (genitS False hund) hunde hunden g} ; <_, Fem> => let hunde : Str = case hund of {_ + "e" => hund + "n" ; _ => hund + "en"} ; hunden = hunde in mk6N hund hund hund hund hunde hunden g ; - _ => {s = (regN hund).s ; g = g ; lock_N = <>} + _ => regN hund ** {g = g} } ; reg2N : (x1,x2 : Str) -> Gender -> N = \hund,hunde,g -> @@ -384,8 +401,10 @@ mkV2 : overload { in case of { -- Duden p. 223 <_,_ + ("e" | "er"), Masc | Neutr> => -- I,IV - variants {mk6N hund hund (dativE True hund) (genitS True hund) hunde hunden g ; - mk6N hund hund (dativE False hund) (genitS False hund) hunde hunden g} ; + variants {mk6N hund hund hund (genitS True hund) hunde hunden g ; + mk6N hund hund hund (genitS False hund) hunde hunden g} ; +--- variants {mk6N hund hund (dativE True hund) (genitS True hund) hunde hunden g ; +--- mk6N hund hund (dativE False hund) (genitS False hund) hunde hunden g} ; <_ + ("el"|"er"|"en"),_ + ("el"|"er"|"en"), Masc | Neutr> => -- II mk6N hund hund hund (genitS (True | False) hund) hunde hunden g ; <_,_ + "s", Masc | Neutr> => -- V @@ -396,9 +415,20 @@ mkV2 : overload { mk6N hund hund hund hund hunde hunden g ; <_,_ + ("n" | "s"), Fem> => -- IX,X mk6N hund hund hund hund hunde hunde g ; - _ => {s = (regN hund).s ; g = g ; lock_N = <>} + <_,_ + ("n" | "s"), Neutr> => --- not mentioned; Konto-Kontos + mk6N hund hund hund hund hunde hunde g ; + _ => regN hund ** {g = g} } ; + changeCompoundN : Str -> N -> N = \co,n -> n ** { + co = co ; + uncap = n.uncap ** {co = toLowerFirst co} ; + } ; + + dative_eN : N -> N = \n -> n ** { + s = table {Sg => table {Dat => n.s ! Sg ! Dat + "e" ; c => n.s ! Sg ! c} ; Pl => n.s ! Pl} ; + } ; ---- change uncap as well? + mkN2 = overload { mkN2 : Str -> N2 = \s -> vonN2 (regN s) ; mkN2 : N -> N2 = vonN2 ; @@ -499,19 +529,18 @@ mkV2 : overload { prefixV p v = MorphoGer.prefixV p v ** {lock_V = v.lock_V} ; - habenV v = - {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VHaben ; vtype = v.vtype} ; - seinV v = - {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VSein ; vtype = v.vtype} ; - reflV v c = - {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VHaben ; vtype = VRefl (prepC c).c} ; + compoundV p v = v ** {particle = p} ; + + habenV v = v ** {aux = VHaben} ; + seinV v = v ** {aux = VSein} ; + reflV v c = v ** {aux = VHaben ; vtype = VRefl (prepC c).c} ; no_geV v = let vs = v.s in { s = table { p@(VPastPart _) => Predef.drop 2 (vs ! p) ; p => vs ! p } ; - prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype + prefix = v.prefix ; particle = v.particle ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype } ; fixprefixV s v = let vs = v.s in { @@ -520,12 +549,12 @@ mkV2 : overload { p@(VPastPart _) => s + Predef.drop 2 (vs ! p) ; p => s + vs ! p } ; - prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype + prefix = v.prefix ; particle = v.particle ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype } ; - haben_V = MorphoGer.haben_V ** {lock_V = <>} ; - sein_V = MorphoGer.sein_V ** {lock_V = <>} ; - werden_V = MorphoGer.werden_V ** {lock_V = <>} ; + haben_V = MorphoGer.haben_V ** {particle = [] ; lock_V = <>} ; + sein_V = MorphoGer.sein_V ** {particle = [] ; lock_V = <>} ; + werden_V = MorphoGer.werden_V ** {particle = [] ; lock_V = <>} ; prepV2 v c = v ** {c2 = c ; lock_V2 = <>} ; dirV2 v = prepV2 v accPrep ; @@ -597,11 +626,23 @@ mkV2 : overload { mkN : (x1,x2 : Str) -> Gender -> N = reg2N ; mkN : (x1,_,_,_,_,x6 : Str) -> Gender -> N = mk6N ; mkN : Str -> N -> N -- Auto + Fahrer -> Autofahrer - = \s,x -> lin N {s = \\n,c => s + Predef.toLower (x.s ! n ! c) ; g = x.g} ; + = \s,x -> mkCompoundN s x ; + mkN : N -> N -> N + = \n,x -> mkCompoundN n.co x ; mkN : Str -> Gender -> Gender -> N - = \s,g,h -> reg1N s g | reg1N s h ; + = \s,g,h -> reg1N s g | reg1N s h ; }; + mkCompoundN : Str -> N -> N -- Auto + Fahrer -> Autofahrer + = \s,x -> lin N { + s = \\n,c => s + x.uncap.s ! n ! c ; + co = s + x.uncap.co ; + uncap = { + s = \\n,c => toLowerFirst s + x.uncap.s ! n ! c ; + co = toLowerFirst s + x.uncap.co ; + } ; + g = x.g + } ; regA : Str -> A ; @@ -625,7 +666,10 @@ mkV2 : overload { mkV : Str -> V = regV ; mkV : (x1,_,_,_,x5 : Str) -> V = irregV ; mkV : (x1,_,_,_,_,x6 : Str) -> V = mk6V ; - mkV : Str -> V -> V = prefixV + mkV : Str -> V -> V = \p,v -> case p of { + "be" | "er" | "ge" | "ver" | "zer" => fixprefixV p v ; + _ => MorphoGer.prefixV p v ** {lock_V = v.lock_V} + } ; }; diff --git a/lib/src/german/ResGer.gf b/lib/src/german/ResGer.gf index aaac2b84d..7d9a42a7e 100644 --- a/lib/src/german/ResGer.gf +++ b/lib/src/german/ResGer.gf @@ -217,17 +217,48 @@ resource ResGer = ParamX ** open Prelude in { -- are always the same except for the dative. Actually the six forms are never -- needed at the same time, but just subsets of them. - Noun : Type = {s : Number => Case => Str ; g : Gender} ; + Noun : Type = { + s : Number => Case => Str ; + co : Str ; -- compound form, first part + uncap : { -- compound form, second part, uncapitalized + s : Number => Case => Str ; --- just a copy of the normal noun; would be nicer with run-time uncap + co : Str ; + } ; + g : Gender + } ; - mkN : (x1,_,_,_,_,x6 : Str) -> Gender -> Noun = - \mann, mannen, manne, mannes, maenner, maennern, g -> { + mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = + \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { s = table { - Sg => caselist mann mannen manne mannes ; - Pl => caselist maenner maenner maennern maenner + Sg => caselist Mann Mannen Manne Mannes ; + Pl => caselist Maenner Maenner Maennern Maenner } ; + co = Mann_ ; + uncap = + let + mann = toLowerFirst Mann ; + mannen = toLowerFirst Mannen ; + manne = toLowerFirst Manne ; + mannes = toLowerFirst Mannes ; + maenner = toLowerFirst Maenner ; + maennern = toLowerFirst Maennern ; + mann_ = toLowerFirst Mann_ ; + in { + s = table { + Sg => caselist mann mannen manne mannes ; + Pl => caselist maenner maenner maennern maenner + } ; + co = mann_ ; + } ; g = g } ; + mkCompoundForm : Str -> Str = \s -> case s of { + _ + "e" => s + "n" ; + _ + ("ung" | "heit" | "keit") => s + "s" ; + _ => s ---- any more predictable cases? + } ; + -- Adjectives need four forms: two for the positive and one for the other degrees. Adjective : Type = {s : Degree => AForm => Str} ; @@ -246,7 +277,8 @@ resource ResGer = ParamX ** open Prelude in { Verb : Type = { s : VForm => Str ; - prefix : Str ; + prefix : Str ; + particle : Str ; aux : VAux ; vtype : VType } ; @@ -288,6 +320,7 @@ resource ResGer = ParamX ** open Prelude in { VPastPart a => ein + (regA gegeben).s ! Posit ! a } ; prefix = ein ; + particle = [] ; aux = aux ; vtype = VAct } ; @@ -311,6 +344,7 @@ resource ResGer = ParamX ** open Prelude in { VPastPart a => ein + vs ! VPastPart a } ; prefix = ein ; + particle = verb.particle ; aux = verb.aux ; vtype = verb.vtype } ; @@ -320,7 +354,7 @@ resource ResGer = ParamX ** open Prelude in { -- defined in $MorphoGer$. mkN4 : (x1,_,_,x4 : Str) -> Gender -> Noun = \wein,weines,weine,weinen -> - mkN wein wein wein weines weine weinen ; + mkN wein wein wein weines weine weinen (mkCompoundForm wein) ; regA : Str -> Adjective = \blau -> let blauest : Str = case blau of { @@ -486,7 +520,7 @@ resource ResGer = ParamX ** open Prelude in { vf : Bool -> Str -> Str -> {fin,inf : Str} = \b,fin,inf -> { fin = fin ; - inf = if_then_Str b [] auf ++ inf --- negation of main b + inf = verb.particle ++ if_then_Str b [] auf ++ inf --- negation of main b } ; in { @@ -515,6 +549,7 @@ resource ResGer = ParamX ** open Prelude in { s = { s = verb.s ; prefix = verb.prefix ; + particle = verb.particle ; aux = verb.aux ; vtype = verb.vtype } ; @@ -574,6 +609,7 @@ resource ResGer = ParamX ** open Prelude in { v => sein.s ! v } ; prefix = [] ; + particle = [] ; aux = VSein ; vtype = VAct } ;