most of ParadigmsGer written

This commit is contained in:
aarne
2006-01-15 15:45:23 +00:00
parent 85d1084343
commit bc8bfdea4d
5 changed files with 179 additions and 759 deletions

View File

@@ -98,7 +98,7 @@ oper
mkN2 : N -> Preposition -> N2 ;
-- The most common preposition is "of", and the following is a
-- shortcut for regular, $nonhuman$ relational nouns with "of".
-- shortcut for regular relational nouns with "of".
regN2 : Str -> N2 ;

View File

@@ -31,7 +31,7 @@ concrete LexGer of Lex = CatGer ** open ResGer, Prelude in {
ask_VQ =
regV "fragen" ;
dog_N = mkN4 "Hund" "Hundes" "Hünde" "Hünden" Masc ;
dog_N = mkN4 "Hund" "Hundes" "Hunde" "Hunden" Masc ;
son_N2 = mkN4 "Sohn" "Sohnes" "Söhne" "Söhnen" Masc **
{c2 = {s = "von" ; c = Dat}} ;
way_N3 = mkN4 "Weg" "Weges" "Wege" "Wegen" Masc **

View File

@@ -14,7 +14,7 @@ resource MorphoGer = ResGer ** open Prelude, (Predef=Predef) in {
oper
-- For [Structural Structural.html].
-- For $StructuralGer$.
mkPrep : Str -> Case -> Preposition = \s,c ->
{s = s ; c = c} ;
@@ -26,442 +26,22 @@ oper
{s : Gender => Case => Str ; n : Number ; a : Adjf} = \n,dies ->
{s = appAdj (regA dies) ! n ; n = n ; a = Weak} ;
{-
--2 Nouns
-- But we never need all the six forms at the same time. Often
-- we need just two, three, or four forms.
oper
mkNoun4 : (_,_,_,_ : Str) -> Gender -> CommNoun = \kuh,kuhes,kühe,kühen ->
mkNoun kuh kuh kuh kuhes kühe kühen ;
mkNoun3 : (_,_,_ : Str) -> Gender -> CommNoun = \kuh,kühe,kühen ->
mkNoun kuh kuh kuh kuh kühe kühen ;
mkNoun2n : (_,_ : Str) -> Gender -> CommNoun = \zahl, zahlen ->
mkNoun3 zahl zahlen zahlen ;
mkNoun2es : (_,_ : Str) -> Gender -> CommNoun = \wort, wörter ->
mkNoun wort wort wort (wort + "es") wörter (wörter + "n") ;
mkNoun2s : (_,_ : Str) -> Gender -> CommNoun = \vater, väter ->
mkNoun vater vater vater (vater + "s") väter (väter + "n") ;
mkNoun2ses : (_,_ : Str) -> Gender -> CommNoun = \wort,wörter ->
mkNoun wort wort wort (wort + variants {"es" ; "s"}) wörter (wörter + "n") ;
-- Here are the school grammar declensions with their commonest variations.
-- Unfortunately we cannot define *Umlaut* in GF, but have to give two forms.
--
-- First declension, with plural "en"/"n", including weak masculines:
declN1 : Str -> CommNoun = \zahl ->
mkNoun2n zahl (zahl + "en") Fem ;
declN1in : Str -> CommNoun = \studentin ->
mkNoun2n studentin (studentin + "nen") Fem ;
declN1e : Str -> CommNoun = \stufe ->
mkNoun2n stufe (stufe + "n") Fem ;
declN1M : Str -> CommNoun = \junge -> let {jungen = junge + "n"} in
mkNoun junge jungen jungen jungen jungen jungen Masc ;
declN1eM : Str -> CommNoun = \soldat -> let {soldaten = soldat + "en"} in
mkNoun soldat soldaten soldaten soldaten soldaten soldaten Masc ;
-- Second declension, with plural "e":
declN2 : Str -> CommNoun = \punkt ->
mkNoun2es punkt (punkt+"e") Masc ;
declN2n : Str -> CommNoun = \bein ->
mkNoun2es bein (bein+"e") Neut ;
declN2i : Str -> CommNoun = \onkel ->
mkNoun2s onkel onkel Masc ;
declN2in : Str -> CommNoun = \segel ->
mkNoun2s segel segel Neut ;
declN2u : (_,_ : Str) -> CommNoun = \raum,räume ->
mkNoun2es raum räume Masc ;
declN2uF : (_,_ : Str) -> CommNoun = \kuh,kühe ->
mkNoun3 kuh kühe (kühe + "n") Fem ;
-- Third declension, with plural "er":
declN3 : Str -> CommNoun = \punkt ->
mkNoun2es punkt (punkt+"er") Neut ;
declN3u : (_,_ : Str) -> CommNoun = \buch,bücher ->
mkNoun2ses buch bücher Neut ;
declN3uS : (_,_ : Str) -> CommNoun = \haus,häuser ->
mkNoun2es haus häuser Neut ;
-- Plural with "s":
declNs : Str -> CommNoun = \restaurant ->
mkNoun3 restaurant (restaurant+"s") (restaurant+"s") Neut ;
--2 Adjectives
--
-- As explained in $types.Deu.gf$, it
-- would be superfluous to use the cross product of gender and number,
-- since there is no gender distinction in the plural. But it is handy to have
-- a function that constructs gender-number complexes.
gNumber : Gender -> Number -> GenNum = \g,n ->
case n of {
Sg => GSg g ;
Pl => GPl
} ;
-- This function costructs parameters in the complex type of adjective forms.
aMod : Adjf -> Gender -> Number -> Case -> AForm = \a,g,n,c ->
AMod a (gNumber g n) c ;
-- The worst-case macro for adjectives (positive degree) only needs
-- two forms.
mkAdjective : (_,_ : Str) -> Adjective = \böse,bös -> {s = table {
APred => böse ;
AMod Strong (GSg Masc) c =>
caselist (bös+"er") (bös+"en") (bös+"em") (bös+"es") ! c ;
AMod Strong (GSg Fem) c =>
caselist (bös+"e") (bös+"e") (bös+"er") (bös+"er") ! c ;
AMod Strong (GSg Neut) c =>
caselist (bös+"es") (bös+"es") (bös+"em") (bös+"es") ! c ;
AMod Strong GPl c =>
caselist (bös+"e") (bös+"e") (bös+"en") (bös+"er") ! c ;
AMod Weak (GSg g) c => case <g,c> of {
<_,Nom> => bös+"e" ;
<Masc,Acc> => bös+"en" ;
<_,Acc> => bös+"e" ;
_ => bös+"en" } ;
AMod Weak GPl c => bös+"en"
}} ;
-- Here are some classes of adjectives:
adjReg : Str -> Adjective = \gut -> mkAdjective gut gut ;
adjE : Str -> Adjective = \bös -> mkAdjective (bös+"e") bös ;
adjEr : Str -> Adjective = \teu -> mkAdjective (teu+"er") (teu+"r") ;
adjInvar : Str -> Adjective = \prima -> {s = table {_ => prima}} ;
-- The first three classes can be recognized from the end of the word, depending
-- on if it is "e", "er", or something else.
adjGen : Str -> Adjective = \gut -> let {
er = Predef.dp 2 gut ;
teu = Predef.tk 2 gut ;
e = Predef.dp 1 gut ;
bös = Predef.tk 1 gut
} in
ifTok Adjective er "er" (adjEr teu) (
ifTok Adjective e "e" (adjE bös) (
(adjReg gut))) ;
-- The comparison of adjectives needs three adjectives in the worst case.
mkAdjComp : (_,_,_ : Adjective) -> AdjComp = \gut,besser,best ->
{s = table {Pos => gut.s ; Comp => besser.s ; Sup => best.s}} ;
-- It can be done by just three strings, if each of the comparison
-- forms taken separately is a regular adjective.
adjCompReg3 : (_,_,_ : Str) -> AdjComp = \gut,besser,best ->
mkAdjComp (adjReg gut) (adjReg besser) (adjReg best) ;
-- If also the comparison forms are regular, one string is enough.
adjCompReg : Str -> AdjComp = \billig ->
adjCompReg3 billig (billig+"er") (billig+"st") ;
--OLD:
--2 Verbs
--
-- We limit ourselves to verbs in present tense infinitive, indicative,
-- and imperative, and past participle. Other forms will be introduced later.
--
-- The worst-case macro needs three forms: the infinitive, the third person
-- singular indicative, and the second person singular imperative.
-- We take care of the special cases "ten", "sen", "ln", "rn".
--
-- A famous law about Germanic languages says that plural first and third
-- person are similar.
--NEW (By Harald Hammarström):
--2 Verbs
-- The worst-case macro needs six forms:
-- x Infinitive,
-- x 3p sg pres. indicative,
-- x 2p sg imperative,
-- x 1/3p sg imperfect indicative,
-- x 1/3p sg imperfect subjunctive (because this uncommon form can have umlaut)
-- x the perfect participle
-- But you'll only want to use one of the five macros:
-- x weakVerb -- For a regular verb like legen
-- x verbGratulieren -- For a regular verb without ge- in the perfect
-- particple. Like gratulieren, beweisen etc
-- x verbStrongSingen -- A strong verb without umlauting present tense.
-- You'll need to supply the strong imperfect forms
-- as well as the participle.
-- x verbStrongSehen -- A strong verb that umlauts in the 2/3p sg pres
-- indicative as well as the imperative. You'll
-- need to give (only) the 3rd p sg pres ind. in
-- addition to the strong imperfect forms and the
-- part participle.
-- x verbStrongLaufen -- A strong verb that umlauts in the 2/3p sg pres
-- indicative but NOT the imperative. You'll
-- need to give (only) the 3rd p sg pres ind. in
-- addition to the strong imperfect forms and the
-- part participle.
--
-- Things that are handled automatically
-- x Imperative e (although optional forms are not given)
-- x Extra e in verbs like arbeitete, regnet, findet, atmet.
-- NOTE: If pres. umlauting strong verbs are defined through the verbumStrong
-- macro (which they should) it is automatically handled so they avoid
-- falling into this rule e.g er tritt (rather than *er tritet)
-- x s is dropped in the 2p sg if appropriate du setzt
-- x verbs that end in -rn, -ln rather than -en
-- Things that are not handled:
-- x -ß-/-ss-
-- x Optional dropping of -e- in e.g wand(e)re etc
-- x Optional indicative forms instead of pres. subj. 2p sg. and 2p pl.
-- x (Weak) verbs without the ge- on the participle (in wait for a systematic
-- treatment of the insep. prefixes and stress). You have to manually use
-- the verbGratulieren for this. E.g do verbGratulieren "beweisen" -
-- verbWeak "beweisen" would yield *gebeweist.
impe : Str -> Str = \stem ->
let
e = ifTok Str (Predef.dp 2 stem) "ig" "e" [] ;
e2 = (adde stem)
in
e + e2 ;
adde : Str -> Str = \stem ->
let
eVowelorLiquid : Str -> Str = \u -> case u of {
"l" => "e" ;
"r" => "e" ;
"a" => "e" ;
"o" => "e" ;
"u" => "e" ;
"e" => "e" ;
"i" => "e" ;
"ü" => "e" ;
"ä" => "e" ;
"ö" => "e" ;
_ => []
} ;
eConsonantmn : Str -> Str -> Str = \nl, l ->
case l of {"m" => eVowelorLiquid nl ;
"n" => eVowelorLiquid nl ;
_ => []} ;
twolast = Predef.dp 2 stem ;
nl = Predef.tk 1 twolast ;
l = Predef.dp 1 stem ;
e = case l of {
"d" => "e" ;
"t" => "e" ;
_ => eConsonantmn nl l
} ;
in
e ;
mkVerbum : (_,_,_,_,_,_ : Str) -> Verbum = \geben,gibt,gib,gab,gäbe,gegeben ->
let {
ifSibilant : Str -> Str -> Str -> Str = \u,b1,b2 -> case u of {
"s" => b1 ;
"x" => b1 ;
"z" => b1 ;
"ß" => b1 ;
_ => b2
} ;
en = Predef.dp 2 geben ;
geb = ifTok Tok (Predef.tk 1 en) "e" (Predef.tk 2 geben)(Predef.tk 1 geben) ;
gebt = geb + (adde geb) + "t" ;
gebte = ifTok Tok (Predef.dp 1 gab) "e" gab (gab + "e") ;
gibst = ifSibilant (Predef.dp 1 gib) (gib + "t") (gib + "st") ;
gegebener = (adjReg gegeben).s ;
} in table {
VInf => geben ;
VInd Sg P1 => geb + "e" ;
VInd Sg P2 => gibst ;
VInd Sg P3 => gibt ;
VInd Pl P2 => gebt ;
VInd Pl _ => geben ; -- the famous law
VImp Sg => gib + (impe gib) ;
VImp Pl => gebt ;
VSubj Sg P1 => geb + "e" ;
VSubj Sg P2 => geb + "est" ;
VSubj Sg P3 => geb + "e" ;
VSubj Pl P2 => geb + "et" ;
VSubj Pl _ => geben ;
VPresPart a => (adjReg (geben + "d")).s ! a ;
VImpfInd Sg P1 => gab ;
VImpfInd Sg P2 => gab + (adde gab) + "st" ;
VImpfInd Sg P3 => gab ;
VImpfInd Pl P2 => gab + (adde gab) + "t" ;
VImpfInd Pl _ => gebte + "n" ;
VImpfSubj Sg P1 => gäbe ;
VImpfSubj Sg P2 => gäbe + "st" ;
VImpfSubj Sg P3 => gäbe ;
VImpfSubj Pl P2 => gäbe + "t" ;
VImpfSubj Pl _ => gäbe + "n" ;
VPart a => gegebener ! a
} ;
-- Weak verbs:
verbumWeak : Str -> Verbum = \legen ->
let
leg = (Predef.tk 2 legen) ;
legte = leg + "te" ;
in
mkVerbum legen (leg + (adde leg) + "t") leg legte legte ("ge" + (leg + "t")) ;
regVerb = verbumWeak ;
-- Weak verbs that don't have ge- in the participle
verbumGratulieren : Str -> Verbum = \gratulieren ->
let
gratulier = (Predef.tk 2 gratulieren) ;
gratulierte = gratulier + "te" ;
in
mkVerbum gratulieren (gratulier + (adde gratulier) + "t") gratulier gratulierte gratulierte (gratulier + "t") ;
-- Strong verbs (non-present-tense umlauting):
verbumStrongSingen : (_,_,_,_ : Str) -> Verbum = \singen, sang, sänge, gesungen ->
let
sing = (Predef.tk 2 singen)
in
mkVerbum singen (sing + (adde sing) + "t") sing sang sänge gesungen ;
-- Verbs with Umlaut in the 2nd and 3rd person singular and imperative:
verbumStrongSehen : (_,_,_,_,_ : Str) -> Verbum = \sehen,sieht,sah,sähe,gesehen ->
let
sieh = Predef.tk 1 sieht ;
in
mkVerbum sehen sieht sieh sah sähe gesehen ;
-- Verbs with Umlaut in the 2nd and 3rd person singular but not imperative:
-- (or any verb where the 3rd p sg pres ind is "special" and the 2p sg pres ind -- uses its stem.)
verbumStrongLaufen : (_,_,_,_,_ : Str) -> Verbum = \laufen,läuft,lief,liefe,gelaufen ->
let
lauf = Predef.dp 2 laufen ;
in
mkVerbum laufen läuft lauf lief liefe gelaufen ;
-- The verb "be":
verbumSein : Verbum = let {
sein = verbumStrongSingen "sein" "war" "wäre" "gewesen" ;
} in
table {
VInf => "sein" ;
VInd Sg P1 => "bin" ;
VInd Sg P2 => "bist" ;
VInd Sg P3 => "ist" ;
VInd Pl P2 => "seid" ;
VInd Pl _ => "sind" ;
VImp Sg => "sei" ;
VImp Pl => "seid" ;
VSubj Sg P1 => "sei" ;
VSubj Sg P2 => (variants {"seiest" ; "seist"}) ;
VSubj Sg P3 => "sei" ;
VSubj Pl P2 => "seien" ;
VSubj Pl _ => "seiet" ;
VPresPart a => ((adjReg "seiend").s) ! a ;
v => sein ! v
-- For $ParadigmsGer$.
genitS : Str -> Str = \hund -> case hund of {
_ + ("el" | "en" | "er") => hund + "s" ;
_ + ("s" | "ß" | "sch" | "st" | "x" | "z") => hund + "es" ;
_ => hund + variants {"s" ; "es"}
} ;
pluralN : Str -> Str = \hund -> case hund of {
_ + ("el" | "en" | "er" | "e") => hund + "n" ;
_ => hund + "en"
} ;
dativE : Str -> Str = \hund -> case hund of {
_ + ("el" | "en" | "er" | "e") => hund ;
_ => variants {hund ; hund + "e"}
} ;
-- Modal auxiliary verbs
verbumAux : (_,_,_,_,_ : Str) -> Verbum = \können,kann,konnte,könnte,gekonnt ->
let k = mkVerbum können kann kann konnte könnte gekonnt ;--- (verbumStrongLaufen können kann konnte könnte gekonnt)
in
table {
VInd Sg P1 => kann ;
v => k ! v
} ;
verbumKönnen = verbumAux "können" "kann" "konnte" "könnte" "gekonnt" ;
verbumDürfen = verbumAux "dürfen" "darf" "durfte" "dürfte" "gedurft" ;
verbumMögen = verbumAux "mögen" "mag" "mochte" "möchte" "gemocht" ;
verbumMüssen = verbumAux "müssen" "muss" "musste" "müsste" "gemusst" ;
verbumSollen = verbumAux "sollen" "soll" "sollte" "söllte" "gesollt" ;
verbumWollen = verbumAux "wollen" "will" "wollte" "wöllte" "gewollt" ;
verbumWissen = verbumAux "wissen" "weiss" "wusste" "wüsste" "gewusst" ;
-- The verb "have":
verbumHaben : Verbum = let {
haben = (verbumStrongSingen "haben" "hatte" "hätte" "gehabt")
} in
table {
VInd Sg P2 => "hast" ;
VInd Sg P3 => "hat" ;
v => haben ! v
} ;
-- The verb "become", used as the passive auxiliary:
verbumWerden : Verbum = let {
werden = (verbumStrongSingen "werden" "wurde" "würde" "geworden") ;
} in
table {
VInd Sg P2 => "wirst" ;
VInd Sg P3 => "wird" ;
v => werden ! v
} ;
-- A *full verb* ($Verb$) consists of the inflection forms ($Verbum$) and
-- a *particle* (e.g. "aus-sehen"). Simple verbs are the ones that have no
-- such particle.
mkVerb : Verbum -> Particle -> Verb = \v,p -> {s = v ; s2 = p} ;
mkVerbSimple : Verbum -> Verb = \v -> mkVerb v [] ;
verbSein = mkVerbSimple verbumSein ;
verbHaben = mkVerbSimple verbumHaben ;
verbWerden = mkVerbSimple verbumWerden ;
-- Apparently needed for "es gibt" etc
verbGeben = mkVerbSimple (verbumStrongSehen "geben" "gibt" "gab" "gäbe" "gegeben") ;
-}
} ;

View File

@@ -80,249 +80,144 @@ oper
reg2N : (x1,x2 : Str) -> Gender -> N ;
-- Relational nouns need a preposition. The most common is "von" with
-- the dative. Some prepositions are constructed in [StructuralGer StructuralGer.html].
{-
-- Often it is enough with singular and plural nominatives, and singular
-- genitive. The plural dative
-- is computed by the heuristic that it is the same as the nominative this
-- ends with "n" or "s", otherwise "n" is added.
mkN2 : N -> Prep -> N2 ;
vonN2 : N -> N2 ;
nGen : Str -> Str -> Str -> Gender -> N ; -- punkt,punktes,punkt
-- Here are some common patterns. Singular nominative or two nominatives are needed.
-- Two forms are needed in case of Umlaut, which would be complicated to define.
-- For the same reason, we have separate patterns for multisyllable stems.
--
-- The weak masculine pattern $nSoldat$ avoids duplicating the final "e".
-- Use the function $mkPrep$ or see the section on prepositions below to
-- form other prepositions.
--
-- Three-place relational nouns ("die Verbindung von x nach y") need two prepositions.
nRaum : (_,_ : Str) -> N ; -- Raum, (Raumes,) Räume (masc)
nTisch : Str -> N ; -- Tisch, (Tisches, Tische) (masc)
nVater : (_,_ : Str) -> N ; -- Vater, (Vaters,) Väter (masc)
nFehler : Str -> N ; -- Fehler, (fehlers, Fehler) (masc)
nSoldat : Str -> N ; -- Soldat (, Soldaten) ; Kunde (, Kunden) (masc)
-- Neuter patterns.
nBuch : (_,_ : Str) -> N ; -- Buch, (Buches, Bücher) (neut)
nMesser : Str -> N ; -- Messer, (Messers, Messer) (neut)
nBein : Str -> N ; -- Bein, (Beins, Beine) (neut)
nAuto : Str -> N ; -- Auto, (Autos, Autos) (neut)
-- Feminine patterns. Duplicated "e" is avoided in $nFrau$.
nStudentin : Str -> N ; -- Studentin (Studentinne)
nHand : (_,_ : Str) -> N ; -- Hand, Hände; Mutter, Mütter (fem)
nFrau : Str -> N ; -- Frau (, Frauen) ; Wiese (, Wiesen) (fem)
mkN3 : N -> Prep -> Prep -> N3 ;
-- Nouns used as functions need a preposition. The most common is "von".
mkFun : N -> Preposition -> Case -> Fun ;
funVon : N -> Fun ;
-- Proper names, with their possibly
-- irregular genitive. The regular genitive is "s", omitted after "s".
--3 Proper names and noun phrases
--
-- Proper names, with a regular genitive, are formed as follows
-- The regular genitive is "s", omitted after "s".
mkPN : (karolus, karoli : Str) -> PN ; -- karolus, karoli
pnReg : (Johann : Str) -> PN ; -- Johann, Johanns ; Johannes, Johannes
-- On the top level, it is maybe $CN$ that is used rather than $N$, and
-- $NP$ rather than $PN$.
mkCN : N -> CN ;
mkNP : (karolus,karoli : Str) -> NP ;
npReg : Str -> NP ; -- Johann, Johanns
-- In some cases, you may want to make a complex $CN$ into a function.
mkFunCN : CN -> Preposition -> Case -> Fun ;
funVonCN : CN -> Fun ;
regPN : (Johann : Str) -> PN ; -- Johann, Johanns ; Johannes, Johannes
--2 Adjectives
-- Non-comparison one-place adjectives need two forms in the worst case:
-- the one in predication and the one before the ending "e".
-- Adjectives need four forms: two for the positive and one for the other degrees.
mkAdj1 : (teuer,teur : Str) -> Adj1 ;
mkA : (x1,_,_,x4 : Str) -> A ; -- gut,gute,besser,best
-- Invariable adjective are a special case.
-- The regular adjective formation works for most cases, and includes
-- variations such as "teuer - teurer", "böse - böser".
adjInvar : Str -> Adj1 ; -- prima
regA : Str -> A ;
-- The following heuristic recognizes the the end of the word, and builds
-- the second form depending on if it is "e", "er", or something else.
-- N.B. a contraction is made with "er", which works for "teuer" but not
-- for "bitter".
-- Invariable adjective are a special case.
adjGen : Str -> Adj1 ; -- gut; teuer; böse
invarA : Str -> A ; -- prima
-- Two-place adjectives need a preposition and a case as extra arguments.
-- Two-place adjectives are formed by adding a preposition to an adjective.
mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- teilbar, durch, acc
mkA2 : A -> Prep -> A2 ;
-- Comparison adjectives may need three adjective, corresponding to the
-- three comparison forms.
--2 Prepositions
mkAdjDeg : (gut,besser,best : Adj1) -> AdjDeg ;
-- In many cases, each of these adjectives is itself regular. Then we only
-- need three strings. Notice that contraction with "er" is not performed
-- ("bessere", not "bessre").
aDeg3 : (gut,besser,best : Str) -> AdjDeg ;
-- In the completely regular case, the comparison forms are constructed by
-- the endings "er" and "st".
aReg : Str -> AdjDeg ; -- billig, billiger, billigst
-- The past participle of a verb can be used as an adjective.
aPastPart : V -> Adj1 ; -- gefangen
-- On top level, there are adjectival phrases. The most common case is
-- just to use a one-place adjective. The variation in $adjGen$ is taken
-- into account.
apReg : Str -> AP ;
--OLD:
--2 Verbs
--
-- The fragment only has present tense so far, but in all persons.
-- It also has the infinitive and the past participles.
-- The worst case macro needs four forms: : the infinitive and
-- the third person singular (where Umlaut may occur), the singular imperative,
-- and the past participle.
--
-- The function recognizes if the stem ends with "s" or "t" and performs the
-- appropriate contractions.
--NEW (By Harald Hammarström):
--2 Verbs
-- The worst-case macro needs six forms:
-- x Infinitive,
-- x 3p sg pres. indicative,
-- x 2p sg imperative,
-- x 1/3p sg imperfect indicative,
-- x 1/3p sg imperfect subjunctive (because this uncommon form can have umlaut)
-- x the perfect participle
-- But you'll only want to use one of the five macros:
-- x weakVerb -- For a regular verb like legen
-- x verbGratulieren -- For a regular verb without ge- in the perfect
-- particple. Like gratulieren, beweisen etc
-- x verbStrongSingen -- A strong verb without umlauting present tense.
-- You'll need to supply the strong imperfect forms
-- as well as the participle.
-- x verbStrongSehen -- A strong verb that umlauts in the 2/3p sg pres
-- indicative as well as the imperative. You'll
-- need to give (only) the 3rd p sg pres ind. in
-- addition to the strong imperfect forms and the
-- part participle.
-- x verbStrongLaufen -- A strong verb that umlauts in the 2/3p sg pres
-- indicative but NOT the imperative. You'll
-- need to give (only) the 3rd p sg pres ind. in
-- addition to the strong imperfect forms and the
-- part participle.
--
-- Things that are handled automatically
-- x Imperative e (although optional forms are not given)
-- x Extra e in verbs like arbeitete, regnet, findet, atmet.
-- NOTE: If pres. umlauting strong verbs are defined through the verbumStrong
-- macro (which they should) it is automatically handled so they avoid
-- falling into this rule e.g er tritt (rather than *er tritet)
-- x s is dropped in the 2p sg if appropriate du setzt
-- x verbs that end in -rn, -ln rather than -en
-- Things that are not handled:
-- x -ß-/-ss-
-- x Optional dropping of -e- in e.g wand(e)re etc
-- x Optional indicative forms instead of pres. subj. 2p sg. and 2p pl.
-- x (Weak) verbs without the ge- on the participle (in wait for a systematic
-- treatment of the insep. prefixes and stress). You have to manually use
-- the verbGratulieren for this. E.g do verbGratulieren "beweisen" -
-- verbWeak "beweisen" would yield *gebeweist.
mkV : (_,_,_,_,_,_ : Str) -> V ; -- geben, gibt, gib, gab, gäbe, gegeben
-- Weak verbs are sometimes called regular verbs.
vWeak : Str -> V ; -- führen
vGratulieren : Str -> V ; -- gratulieren
vSehen : (_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sah, sähe, gesehen
vLaufen : (_,_,_,_,_ : Str) -> V ; -- laufen, lauft, liefe, liefe, gelaufen
-- The verbs 'be' and 'have' are special.
vSein : V ;
vHaben : V ;
-- Some irregular verbs.
vFahren : V ;
-- Verbs with a detachable particle, with regular ones as a special case.
vPartWeak : (_,_ : Str) -> V ; -- führen, aus
-- vPartGratulieren (_,_ : Str) -> V ;
vPartSehen : (_,_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sah, sähe, gesehen
vPartLaufen : (_,_,_,_,_,_ : Str) -> V ; -- laufen, lauft, liefe, liefe, gelaufen
mkVPart : V -> Str -> V ; -- vFahren, aus
-- Obsolete; use vPartWeak etc instead
--vPart : (_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sieh, gesehen, aus
--vPartReg : (_,_ : Str) -> V ; -- bringen, um
-- Two-place verbs, and the special case with direct object. Notice that
-- a particle can be included in a $V$.
mkTV : V -> Str -> Case -> TV ; -- hören, zu, dative
tvWeak : Str -> Str -> Case -> TV ; -- hören, zu, dative
tvDir : V -> TV ; -- umbringen
tvDirReg : Str -> TV ; -- lieben
-- Three-place verbs require two prepositions and cases.
mkV3 : V -> Str -> Case -> Str -> Case -> V3 ; -- geben,[],dative,[],accusative
-- Sentence-complement verbs are just verbs.
mkVS : V -> VS ;
-- Verb-complement verbs either need the "zu" particle or don't.
-- The ones that don't are usually auxiliary verbs.
vsAux : V -> VV ;
vsZu : V -> VV ;
--2 Adverbials
--
-- Adverbials for modifying verbs, adjectives, and sentences can be formed
-- from strings.
mkAdV : Str -> AdV ;
mkAdA : Str -> AdA ;
mkAdS : Str -> AdS ;
-- Prepositional phrases are another productive form of adverbials.
mkPP : Case -> Str -> NP -> AdV ;
-- One can also use the function $ResourceGer.PrepNP$ with one of the given
-- prepositions or a preposition formed by giving a string and a case:
-- A preposition is formed from a string and a case.
mkPrep : Str -> Case -> Prep ;
--2 Verbs
-- The worst-case constructor needs six forms:
-- - Infinitive,
-- - 3p sg pres. indicative,
-- - 2p sg imperative,
-- - 1/3p sg imperfect indicative,
-- - 1/3p sg imperfect subjunctive (because this uncommon form can have umlaut)
-- - the perfect participle
mkV : (x1,_,_,_,_,x6 : Str) -> V ; -- geben, gibt, gib, gab, gäbe, gegeben
-- Weak verbs are sometimes called regular verbs.
regV : Str -> V ; -- führen
-- Irregular verbs use Ablaut and, in the worst cases, also Umlaut.
irregV : (x1,_,_,_,x5 : Str) -> V ; -- sehen, sieht, sah, sähe, gesehen
-- To remove the past participle prefix "ge", e.g. for the verbs
-- prefixed by "be-, ver-".
no_geV : V -> V ;
-- To add a movable suffix e.g. "auf(fassen)".
prefixV : Str -> V -> V ;
-- To change the auxiliary from "haben" (default) to "sein" and
-- vice-versa.
seinV : V -> V ;
habenV : V -> V ;
--3 Two-place verbs
--
-- Two-place verbs need a preposition, except the special case with direct object.
-- (transitive verbs). Notice that a particle comes from the $V$.
mkV2 : V -> Prep -> V2 ;
dirV2 : V -> V2 ;
--3 Three-place verbs
--
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> Prep -> Prep -> V3 ; -- speak, with, about
dirV3 : V -> Prep -> V3 ; -- give,_,to
accdatV3 : V -> V3 ; -- give,_,_
--3 Other complement patterns
--
-- Verbs and adjectives can take complements such as sentences,
-- questions, verb phrases, and adjectives.
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Prep -> V2S ;
mkVV : V -> VV ;
mkV2V : V -> Prep -> Prep -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Prep -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Prep -> V2Q ;
mkAS : A -> AS ;
mkA2S : A -> Prep -> A2S ;
mkAV : A -> AV ;
mkA2V : A -> Prep -> A2V ;
-- Notice: categories $V2S, V2V, V2A, V2Q$ are in v 1.0 treated
-- just as synonyms of $V2$, and the second argument is given
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
-- $V0$ is just $V$.
V0, V2S, V2V, V2A, V2Q : Type ;
AS, A2S, AV, A2V : Type ;
--2 Definitions of paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
-}
Gender = MorphoGer.Gender ;
Case = MorphoGer.Case ;
@@ -367,122 +262,58 @@ oper
_ => regN hund
} ;
-- auxiliaries
mkN2 : N -> Prep -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ;
vonN2 : N -> N2 = \n -> n ** {c2 = {s = "von" ; c = dative} ; lock_N2 = <>} ;
genitS : Str -> Str = \hund -> case hund of {
_ + ("el" | "en" | "er") => hund + "s" ;
_ => hund + variants {"s" ; "es"}
} ;
pluralN : Str -> Str = \hund -> case hund of {
_ + ("el" | "en" | "er" | "e") => hund + "n" ;
_ => hund + "en"
} ;
dativE : Str -> Str = \hund -> case hund of {
_ + ("el" | "en" | "er" | "e") => hund ;
_ => variants {hund ; hund + "e"}
} ;
{-
nGen = \punkt, punktes, punkte, g -> let {
e = Predef.dp 1 punkte ;
eqy = ifTok N e ;
noN = mkNoun4 punkt punktes punkte punkte g ** {lock_N = <>}
} in
eqy "n" noN (
eqy "s" noN (
mkNoun4 punkt punktes punkte (punkte+"n") g ** {lock_N = <>})) ;
nRaum = \raum, räume -> nGen raum (raum + "es") räume masculine ;
nTisch = \tisch ->
mkNoun4 tisch (tisch + "es") (tisch + "e") (tisch +"en") masculine **
{lock_N = <>};
nVater = \vater, väter -> nGen vater (vater + "s") väter masculine ;
nFehler = \fehler -> nVater fehler fehler ;
nSoldat = \soldat -> let {
e = Predef.dp 1 soldat ;
soldaten = ifTok Tok e "e" (soldat + "n") (soldat + "en")
} in
mkN soldat soldaten soldaten soldaten soldaten soldaten masculine ;
nBein = \bein -> declN2n bein ** {lock_N = <>};
nBuch = \buch, bücher -> nGen buch (buch + "es") bücher neuter ;
nMesser = \messer -> nGen messer (messer + "s") messer neuter ;
nAuto = \auto -> let {autos = auto + "s"} in
mkNoun4 auto autos autos autos neuter ** {lock_N = <>} ;
nStudentin = \studentin -> declN1in studentin ** {lock_N = <>};
nHand = \hand, hände -> nGen hand hand hände feminine ;
nFrau = \frau -> let {
e = Predef.dp 1 frau ;
frauen = ifTok Tok e "e" (frau + "n") (frau + "en")
} in
mkN frau frau frau frau frauen frauen feminine ;
mkFun n = mkFunCN (UseN n) ;
funVon n = funVonCN (UseN n) ;
mkN3 = \n,p,q -> n ** {c2 = p ; c3 = q ; lock_N3 = <>} ;
mkPN = \karolus, karoli ->
{s = table {Gen => karoli ; _ => karolus} ; lock_PN = <>} ;
pnReg = \horst ->
regPN = \horst ->
mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ;
mkCN = UseN ;
mkNP = \x,y -> UsePN (mkPN x y) ;
npReg = \s -> UsePN (pnReg s) ;
mkA : (x1,_,_,x4 : Str) -> A = \a,b,c,d ->
MorphoGer.mkA a b c d ** {lock_A = <>} ;
mkFunCN n p c = mkFunC n p c ** {lock_Fun = <>} ;
funVonCN n = funVonC n ** {lock_Fun = <>} ;
regA : Str -> A = \a -> case a of {
teu + "er" => mkA a (teu + "re") (teu + "rer") (teu + "rest") ;
_ + "e" => mkA a a (a + "r") (a + "st") ;
_ => mkA a a (a + "er") (a + "est")
} ;
mkAdj1 x y = mkAdjective x y ** {lock_Adj1 = <>} ;
adjInvar a = Morpho.adjInvar a ** {lock_Adj1 = <>} ;
adjGen a = Morpho.adjGen a ** {lock_Adj1 = <>} ;
mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c ; lock_Adj2 = <>} ;
invarA = \s -> {s = \\_,_ => s ; lock_A = <>} ; ---- comparison
mkAdjDeg a b c = mkAdjComp a b c ** {lock_AdjDeg = <>} ;
aDeg3 a b c = adjCompReg3 a b c ** {lock_AdjDeg = <>} ;
aReg a = adjCompReg a ** {lock_AdjDeg = <>} ;
aPastPart = \v -> {s = table AForm {a => v.s ! VPart a} ; lock_Adj1 = <>} ;
apReg = \s -> AdjP1 (adjGen s) ;
mkA2 = \a,p -> a ** {c2 = p ; lock_A2 = <>} ;
mkV a b c d e f = mkVerbSimple (mkVerbum a b c d e f) ** {lock_V = <>} ;
vWeak a = mkVerbSimple (verbumWeak a) ** {lock_V = <>} ;
vGratulieren a = mkVerbSimple (verbumGratulieren a) ** {lock_V = <>} ;
vSehen a b c d e = mkVerbSimple (verbumStrongSehen a b c d e) ** {lock_V = <>} ;
vLaufen a b c d e = mkVerbSimple (verbumStrongLaufen a b c d e) ** {lock_V = <>} ;
-- vReg = \s -> mkVerbSimple (regVerb s) ** {lock_V = <>} ;
vSein = verbSein ** {lock_V = <>} ;
vHaben = verbHaben ** {lock_V = <>} ;
vFahren = mkVerbSimple (verbumStrongLaufen "fahren" "fährt" "fuhr" "führe" "gefahren") ** {lock_V = <>} ;
vPartWeak = \führen, aus -> (mkVerb (verbumWeak führen) aus) ** {lock_V = <>} ;
--vGratulieren = verbumGratulieren ** {lock_V = <>} ;
vPartSehen a b c d e aus = (mkVerb (verbumStrongSehen a b c d e) aus) ** {lock_V = <>} ;
vPartLaufen a b c d e aus = (mkVerb (verbumStrongLaufen a b c d e) aus) ** {lock_V = <>} ;
--vPart = \sehen, sieht, sieh, gesehen, aus ->
-- mkVerb (mkVerbum sehen sieht sieh gesehen) aus ** {lock_V = <>} ;
--vPartReg = \sehen, aus -> mkVerb (regVerb sehen) aus ** {lock_V = <>} ;
mkVPart v p = mkVerb v.s p ** {lock_V = <>} ;
mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ;
tvWeak = \hören, zu, dat -> mkTV (vWeak hören) zu dat ;
tvDir = \v -> mkTV v [] accusative ;
tvDirReg = \v -> tvWeak v [] accusative ;
mkV3 v s c t d = mkDitransVerb v s c t d ** {lock_V3 = <>} ;
mkVS v = v ** {lock_VS = <>} ;
vsAux v = v ** {isAux = True ; lock_VV = <>} ;
vsZu v = v ** {isAux = True ; lock_VV = <>} ;
mkAdV a = ss a ** {lock_AdV = <>} ;
mkPP x y = PrepNP {s = y ; c = x ; lock_Prep = <>} ;
mkAdA a = ss a ** {lock_AdA = <>} ;
mkAdS a = ss a ** {lock_AdS = <>} ;
mkPrep s c = {s = s ; c = c ; lock_Prep = <>} ;
-}
mkV geben gibt gib gab gaebe gegeben =
let
gebe = init geben ; ----
gibst = init gibt + "st" ; ----
gebt = init gebe ; ----
gabst = gab + "st" ; ----
gaben = pluralN gab ;
gabt = gab + "t" ----
in
MorphoGer.mkV
geben gebe gibst gibt gebt gib gab gabst gaben gabt gaebe gegeben
[] VHaben ** {lock_V = <>} ;
regV fragen =
let
frag = Predef.tk 2 fragen ; ----
fragt = frag + "t" ; ----
fragte = fragt + "e" ;
gefragt = "ge" + fragt ;
in
mkV fragen fragt frag fragte fragte gefragt ;
irregV singen singt sang saenge gesungen =
let
sing = Predef.tk 2 singen ; ----
in
mkV singen singt sing sang saenge gesungen ;
} ;

View File

@@ -188,3 +188,12 @@ wc german/*.gfc
Ca. 4h more work was needed, so we have spent 16h now.
--------------------
14/1
TensedGer: just uncomment, except S
StructuralGer: almost complete with some determiner forms to revisit
ParadigmsGer: almost complete with verb form variations to revisit
MorphoGer: very few functions in this module