diff options
| author | bjorn <bjorn@bringert.net> | 2008-08-14 07:58:04 +0000 |
|---|---|---|
| committer | bjorn <bjorn@bringert.net> | 2008-08-14 07:58:04 +0000 |
| commit | 77270a010a0b453e9a84c3e62db7cfd22e49d55d (patch) | |
| tree | d17682a545d6ac1e68ff49b8c20964182794baf7 /grammars/resource/german | |
| parent | 0bbb906141711767678f82b15a7b43e65e0b5bd6 (diff) | |
Remove the grammars directory. It was full of old grammars that don't compile these days. See the old source distributions if you want them.
Diffstat (limited to 'grammars/resource/german')
| -rw-r--r-- | grammars/resource/german/DatabaseDeu.gf | 54 | ||||
| -rw-r--r-- | grammars/resource/german/DatabaseRes.gf | 11 | ||||
| -rw-r--r-- | grammars/resource/german/Deutsch.gf | 1 | ||||
| -rw-r--r-- | grammars/resource/german/Logical.gf | 26 | ||||
| -rw-r--r-- | grammars/resource/german/Morpho.gf | 398 | ||||
| -rw-r--r-- | grammars/resource/german/Paradigms.gf | 310 | ||||
| -rw-r--r-- | grammars/resource/german/Predication.gf | 96 | ||||
| -rw-r--r-- | grammars/resource/german/ResDeu.gf | 223 | ||||
| -rw-r--r-- | grammars/resource/german/RestaurantDeu.gf | 26 | ||||
| -rw-r--r-- | grammars/resource/german/Syntax.gf | 969 | ||||
| -rw-r--r-- | grammars/resource/german/TestDeu.gf | 49 | ||||
| -rw-r--r-- | grammars/resource/german/Types.gf | 98 |
12 files changed, 0 insertions, 2261 deletions
diff --git a/grammars/resource/german/DatabaseDeu.gf b/grammars/resource/german/DatabaseDeu.gf deleted file mode 100644 index b5f41969d..000000000 --- a/grammars/resource/german/DatabaseDeu.gf +++ /dev/null @@ -1,54 +0,0 @@ ---# -path=.:../abstract:../../prelude - -concrete DatabaseDeu of Database = - open Prelude,Syntax,Deutsch,Predication,Paradigms,DatabaseRes in { - -flags lexer=text ; unlexer=text ; - -lincat - Phras = SS1 Bool ; -- long or short form - Subject = NP ; - Noun = CN ; - Property = AP ; - Comparison = AdjDeg ; - Relation = Adj2 ; - Feature = Fun ; - Value = NP ; - Name = PN ; - -lin - LongForm sent = ss (sent.s ! True ++ "?") ; - ShortForm sent = ss (sent.s ! False ++ "?") ; - - WhichAre A B = mkSent (defaultQuestion (IntVP (NounIPMany A) (PosA B))) - (defaultNounPhrase (IndefManyNP (ModAdj B A))) ; - - IsIt Q A = mkSentSame (defaultQuestion (QuestVP Q (PosA A))) ; - - MoreThan = ComparAdjP ; - TheMost = SuperlNP ; - Relatively C _ = PositAdjP C ; - - RelatedTo = ComplAdj ; - - FeatureOf = appFun1 ; - ValueOf F V = appFun1 F (UsePN V) ; - - WithProperty A B = ModAdj B A ; - - Individual n = nameNounPhrase n ** {lock_NP = <>} ; - - AllN = DetNP AllDet ; - MostN = DetNP MostDet ; - EveryN = DetNP EveryDet ; - --- only these are language-dependent - - Any n = detNounPhrase einDet n ** {lock_NP = <>} ; - - IsThere A = mkSentPrel ["gibt es"] (defaultNounPhrase (IndefOneNP A)) ; - AreThere A = mkSentPrel ["gibt es"] (defaultNounPhrase (IndefManyNP A)) ; - - WhatIs V = mkSentPrel ["was ist"] (defaultNounPhrase V) ; - -} ; diff --git a/grammars/resource/german/DatabaseRes.gf b/grammars/resource/german/DatabaseRes.gf deleted file mode 100644 index 57bac16ac..000000000 --- a/grammars/resource/german/DatabaseRes.gf +++ /dev/null @@ -1,11 +0,0 @@ -resource DatabaseRes = open Prelude in { -oper - mkSent : SS -> SS -> SS1 Bool = \long, short -> - {s = table {b => if_then_else Str b long.s short.s}} ; - - mkSentPrel : Str -> SS -> SS1 Bool = \prel, matter -> - mkSent (ss (prel ++ matter.s)) matter ; - - mkSentSame : SS -> SS1 Bool = \s -> - mkSent s s ; -} ; diff --git a/grammars/resource/german/Deutsch.gf b/grammars/resource/german/Deutsch.gf deleted file mode 100644 index 4a91ad219..000000000 --- a/grammars/resource/german/Deutsch.gf +++ /dev/null @@ -1 +0,0 @@ -resource Deutsch = reuse ResDeu ; diff --git a/grammars/resource/german/Logical.gf b/grammars/resource/german/Logical.gf deleted file mode 100644 index b6d3b524b..000000000 --- a/grammars/resource/german/Logical.gf +++ /dev/null @@ -1,26 +0,0 @@ ---# -path=.:../abstract:../../prelude - --- Slightly ad hoc and formal negation and connectives. - -resource Logical = Predication ** open Deutsch, Paradigms in { - - oper - negS : S -> S ; -- es ist nicht der Fall, dass S - univS : CN -> S -> S ; -- für alle CNs gilt es, dass S - existS : CN -> S -> S ; -- es gibt ein CN derart, dass S - existManyS : CN -> S -> S ; -- es gibt CNs derart, dass S ---. - - negS = \A -> - PredVP ItNP (NegNP (DefOneNP (CNthatS (UseN (nRaum "Fall" "Fälle")) A))) ; - univS = \A,B -> - PredVP ItNP - (AdvVP (PosVS (mkV "gelten" "gilt" "gelte" "gegolten" ** {lock_VS = <>}) B) - (mkPP accusative "für" (DetNP AllDet A))) ; - existS = \A,B -> - PredVP ItNP (PosTV (tvDir (mkV "geben" "gibt" "gib" "gegeben")) - (IndefOneNP (ModRC A (RelSuch B)))) ; - existManyS = \A,B -> - PredVP ItNP (PosTV (tvDir (mkV "geben" "gibt" "gib" "gegeben")) - (IndefManyNP (ModRC A (RelSuch B)))) ; -} ; diff --git a/grammars/resource/german/Morpho.gf b/grammars/resource/german/Morpho.gf deleted file mode 100644 index f62c2fcf5..000000000 --- a/grammars/resource/german/Morpho.gf +++ /dev/null @@ -1,398 +0,0 @@ ---1 A Simple German Resource Morphology --- --- Aarne Ranta 2002 --- --- This resource morphology contains definitions needed in the resource --- syntax. It moreover contains the most usual inflectional patterns. --- --- We use the parameter types and word classes defined in $types.Deu.gf$. - -resource Morpho = Types ** open (Predef=Predef), Prelude in { - ---2 Nouns --- --- For conciseness and abstraction, we define a method for --- generating a case-dependent table from a list of four forms. - -oper - caselist : (_,_,_,_ : Str) -> Case => Str = \n,a,d,g -> table { - Nom => n ; Acc => a ; Dat => d ; Gen => g} ; - --- The *worst-case macro* for common nouns needs six forms: all plural forms --- are always the same except for the dative. - - mkNoun : (_,_,_,_,_,_ : Str) -> Gender -> CommNoun = - \mann, mannen, manne, mannes, männer, männern, g -> {s = table { - Sg => caselist mann mannen manne mannes ; - Pl => caselist männer männer männern männer - } ; g = g} ; - --- But we never need all the six forms at the same time. Often --- we need just two, three, or four forms. - - 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 masculins: - - declN1 : Str -> CommNoun = \zahl -> - mkNoun2n zahl (zahl + "en") 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 ; - - declN2i : Str -> CommNoun = \onkel -> - mkNoun2s onkel onkel Masc ; - - 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 Pronouns --- --- Here we define personal and relative pronouns. --- All personal pronouns, except "ihr", conform to the simple --- pattern $mkPronPers$. - - ProPN = {s : NPForm => Str ; n : Number ; p : Person} ; - - mkPronPers : (_,_,_,_,_ : Str) -> Number -> Person -> ProPN = - \ich,mich,mir,meines,mein,n,p -> { - s = table { - NPCase c => caselist ich mich mir meines ! c ; - NPPoss gn c => mein + pronEnding ! gn ! c - } ; - n = n ; - p = p - } ; - - pronEnding : GenNum => Case => Str = table { - GSg Masc => caselist "" "en" "em" "es" ; - GSg Fem => caselist "e" "e" "er" "er" ; - GSg Neut => caselist "" "" "em" "es" ; - GPl => caselist "e" "e" "en" "er" - } ; - - pronIch = mkPronPers "ich" "mich" "mir" "meines" "mein" Sg P1 ; - pronDu = mkPronPers "du" "dich" "dir" "deines" "dein" Sg P2 ; - pronEr = mkPronPers "er" "ihn" "ihm" "seines" "sein" Sg P3 ; - pronSie = mkPronPers "sie" "sie" "ihr" "ihres" "ihr" Sg P3 ; - pronEs = mkPronPers "es" "es" "ihm" "seines" "sein" Sg P3 ; - pronWir = mkPronPers "wir" "uns" "uns" "unser" "unser" Pl P1 ; - - pronSiePl = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Pl P3 ; - pronSSie = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ; --- - --- We still have wrong agreement with the complement of the polite "Sie": --- it is in plural, like the verb, although it should be in singular. - --- The peculiarity with "ihr" is the presence of "e" in forms without an ending. - - pronIhr = - {s = table { - NPPoss (GSg Masc) Nom => "euer" ; - NPPoss (GSg Neut) Nom => "euer" ; - NPPoss (GSg Neut) Acc => "euer" ; - pf => (mkPronPers "ihr" "euch" "euch" "euer" "eur" Pl P2).s ! pf - } ; - n = Pl ; - p = P2 - } ; - --- Relative pronouns are like the definite article, except in the genitive and --- the plural dative. The function $artDef$ will be defined right below. - - RelPron : Type = {s : GenNum => Case => Str} ; - - relPron : RelPron = {s = \\gn,c => - case <gn,c> of { - <GSg Fem,Gen> => "deren" ; - <GSg g,Gen> => "dessen" ; - <GPl,Dat> => "denen" ; - <GPl,Gen> => "deren" ; - _ => artDef ! gn ! c - } - } ; - - ---2 Articles --- --- Here are all forms the indefinite and definite article. --- The indefinite article is like a large class of pronouns. --- The definite article is more peculiar; we don't try to --- subsume it to any general rule. - - artIndef : Gender => Case => Str = \\g,c => "ein" + pronEnding ! GSg g ! c ; - - artDef : GenNum => Case => Str = table { - GSg Masc => caselist "der" "den" "dem" "des" ; - GSg Fem => caselist "die" "die" "der" "der" ; - GSg Neut => caselist "das" "das" "dem" "des" ; - GPl => caselist "die" "die" "den" "der" - } ; - - ---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 - } ; - --- It's also handy to have a function that finds out the number from such a complex. - - numGenNum : GenNum -> Number = \gn -> - case gn of { - GSg _ => Sg ; - GPl => Pl - } ; - --- 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") ; - - ---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. - - mkVerbum : (_,_,_,_ : Str) -> Verbum = \geben, gib, gb, gegeben -> - let { - en = Predef.dp 2 geben ; - geb = ifTok Tok (Predef.tk 1 en) "e" (Predef.tk 2 geben)(Predef.tk 1 geben) ; - gebt = ifTok Tok (Predef.dp 1 geb) "t" (geb + "et") (geb + "t") ; - gibst = ifTok Tok (Predef.dp 1 gib) "s" (gib + "t") (gib + "st") ; - gegebener = (adjReg gegeben).s - } in table { - VInf => geben ; - VInd Sg P1 => geb + "e" ; - VInd Sg P2 => gibst ; - VInd Sg P3 => gib + "t" ; - VInd Pl P2 => gebt ; - VInd Pl _ => geben ; -- the famous law - VImp Sg => gb ; - VImp Pl => gebt ; - VPart a => gegebener ! a - } ; - --- Regular verbs: - - regVerb : Str -> Verbum = \legen -> - let {lege = ifTok Tok (Predef.dp 3 legen) "ten" (Predef.tk 1 legen) ( - ifTok Tok (Predef.dp 2 legen) "en" (Predef.tk 2 legen) ( - Predef.tk 1 legen))} in - mkVerbum legen lege lege ("ge" + (lege + "t")) ; - --- Verbs ending with "t"; now recognized in $mkVerbum$. - - verbWarten : Str -> Verbum = regVerb ; - --- Verbs with Umlaut in the second and third person singular and imperative: - - verbSehen : Str -> Str -> Str -> Verbum = \sehen, sieht, gesehen -> - let {sieh = Predef.tk 1 sieht} in mkVerbum sehen sieh sieh gesehen ; - --- Verbs with Umlaut in the second and third person singular but not imperative: - - verbLaufen : Str -> Str -> Str -> Verbum = \laufen, läuft, gelaufen -> - let {läuf = Predef.tk 1 läuft ; laufe = Predef.tk 1 laufen} - in mkVerbum laufen läuf laufe gelaufen ; - --- The verb "be": - - verbumSein : Verbum = let { - gewesen = (adjReg "gewesen").s - } 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 => "seiet" ; - VPart a => gewesen ! a - } ; - --- The verb "have": - - verbumHaben : Verbum = let { - haben = (regVerb "haben") - } 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 = regVerb "werden" ; - geworden = (adjReg "geworden").s - } in - table { - VInd Sg P2 => "wirst" ; - VInd Sg P3 => "wird" ; - VPart a => geworden ! a ; - 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 ; - -{- - -- tests for optimizer - verbumSein2 : Verbum = - 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 => "seiet" ; - VPart a => (adjReg "gewesen").s ! a - } ; - - verbumHaben2 : Verbum = - table { - VInd Sg P2 => "hast" ; - VInd Sg P3 => "hat" ; - v => regVerb "haben" ! v - } ; --} - -} ; diff --git a/grammars/resource/german/Paradigms.gf b/grammars/resource/german/Paradigms.gf deleted file mode 100644 index 1bfeb3fe6..000000000 --- a/grammars/resource/german/Paradigms.gf +++ /dev/null @@ -1,310 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 German Lexical Paradigms --- --- Aarne Ranta 2003 --- --- This is an API to the user of the resource grammar --- for adding lexical items. It give shortcuts for forming --- expressions of basic categories: nouns, adjectives, verbs. --- --- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $resource.Abs.gf$. --- --- The main difference with $morpho.Deu.gf$ is that the types --- referred to are compiled resource grammar types. We have moreover --- had the design principle of always having existing forms as string --- arguments of the paradigms, not stems. --- --- The following modules are presupposed: - -resource Paradigms = open (Predef=Predef), Prelude, (Morpho=Morpho), Syntax, Deutsch in { - - ---2 Parameters --- --- To abstract over gender names, we define the following identifiers. - -oper - masculine : Gender ; - feminine : Gender ; - neuter : Gender ; - --- To abstract over case names, we define the following. - - nominative : Case ; - accusative : Case ; - dative : Case ; - genitive : Case ; - --- To abstract over number names, we define the following. - - singular : Number ; - plural : Number ; - - ---2 Nouns - --- Worst case: give all four singular forms, two plural forms (others + dative), --- and the gender. - - mkN : (_,_,_,_,_,_ : Str) -> Gender -> N ; - -- mann, mann, manne, mannes, männer, männern - --- 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. - - 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". - - 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) - nAuto : Str -> N ; -- Auto, (Autos, Autos) (neut) - --- Feminine patterns. Duplicated "e" is avoided in $nFrau$. - - nHand : (_,_ : Str) -> N ; -- Hand, Hände; Mutter, Mütter (fem) - nFrau : Str -> N ; -- Frau (, Frauen) ; Wiese (, Wiesen) (fem) - - --- 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". - - 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 ; - - ---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". - - mkAdj1 : (teuer,teur : Str) -> Adj1 ; - --- Invariable adjective are a special case. - - adjInvar : Str -> Adj1 ; -- prima - --- 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". - - adjGen : Str -> Adj1 ; -- gut; teuer; böse - --- Two-place adjectives need a preposition and a case as extra arguments. - - mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- teilbar, durch, acc - --- Comparison adjectives may need three adjective, corresponding to the --- three comparison forms. - - 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 ; - - ---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. - - mkV : (_,_,_,_ : Str) -> V ; -- geben, gibt, gib, gegeben - --- Regular verbs are those where no Umlaut occurs. - - vReg : Str -> V ; -- kommen - --- The verbs 'be' and 'have' are special. - - vSein : V ; - vHaben : V ; - --- Verbs with a detachable particle, with regular ones as a special case. - - 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 - - tvReg : 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 - - ---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 ; - --- The definitions should not bother the user of the API. So they are --- hidden from the document. ---. - - - masculine = Masc ; - feminine = Fem ; - neuter = Neut ; - nominative = Nom ; - accusative = Acc ; - dative = Dat ; - genitive = Gen ; - -- singular defined in Types - -- plural defined in Types - - mkN a b c d e f g = mkNoun a b c d e f g ** {lock_N = <>} ; - - 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 ; - - 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 = <>} ; - - 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) ; - - mkPN = \karolus, karoli -> - {s = table {Gen => karoli ; _ => karolus} ; lock_PN = <>} ; - pnReg = \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) ; - - mkFunCN n p c = mkFunC n p c ** {lock_Fun = <>} ; - funVonCN n = funVonC n ** {lock_Fun = <>} ; - - 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 = <>} ; - - 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) ; - - mkV = \sehen, sieht, sieh, gesehen -> - mkVerbSimple (mkVerbum sehen (Predef.tk 1 sieht) sieh gesehen) ** {lock_V = <>} ; - vReg = \s -> mkVerbSimple (regVerb s) ** {lock_V = <>} ; - vSein = verbSein ** {lock_V = <>} ; - vHaben = verbHaben ** {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 = <>} ; - - mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ; - tvReg = \hören, zu, dat -> mkTV (vReg hören) zu dat ; - tvDir = \v -> mkTV v [] accusative ; - tvDirReg = \v -> tvReg v [] accusative ; - mkV3 v s c t d = mkDitransVerb v s c t d ** {lock_V3 = <>} ; - - mkAdV a = ss a ** {lock_AdV = <>} ; - mkPP x y z = prepPhrase x y z ** {lock_AdV = <>}; - mkAdA a = ss a ** {lock_AdA = <>} ; - mkAdS a = ss a ** {lock_AdS = <>} ; -} ; diff --git a/grammars/resource/german/Predication.gf b/grammars/resource/german/Predication.gf deleted file mode 100644 index 37572b4c1..000000000 --- a/grammars/resource/german/Predication.gf +++ /dev/null @@ -1,96 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 A Small Predication Library --- --- (c) Aarne Ranta 2003 under Gnu GPL. --- --- This library is built on a language-independent API of --- resource grammars. It has a common part, the type signatures --- (defined here), and language-dependent parts. The user of --- the library should only have to look at the type signatures. - -resource Predication = open Deutsch in { - --- We first define a set of predication patterns. - -oper - predV1 : V -> NP -> S ; -- one-place verb: "John walks" - predV2 : TV -> NP -> NP -> S ; -- two-place verb: "John loves Mary" - predV3 : TV -> NP -> NP -> NP -> S ; -- three-place verb: "John gives Mary beer" - predVColl : V -> NP -> NP -> S ; -- collective verb: "John and Mary fight" - predA1 : Adj1 -> NP -> S ; -- one-place adjective: "John is old" - predA2 : Adj2 -> NP -> NP -> S ; -- two-place adj: "John is married to Mary" - predAComp : AdjDeg -> NP -> NP -> S ; -- compar adj: "John is older than Mary" - predAColl : Adj1 -> NP -> NP -> S ; -- collect adj: "John and Mary are married" - predN1 : N -> NP -> S ; -- one-place noun: "John is a man" - predN2 : Fun -> NP -> NP -> S ; -- two-place noun: "John is a lover of Mary" - predNColl : N -> NP -> NP -> S ; -- collect noun: "John and Mary are lovers" - --- Individual-valued function applications. - - appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x" - appFun2 : Fun2 -> NP -> NP -> NP ; -- two-place function: "the line from x to y" - appFunColl : Fun -> NP -> NP -> NP ; -- collective function: "the sum of x and y" - --- Families of types, expressed by common nouns depending on arguments. - - appFam1 : Fun -> NP -> CN ; -- one-place family: "divisor of x" - appFam2 : Fun2 -> NP -> NP -> CN ; -- two-place family: "line from x to y" - appFamColl : Fun -> NP -> NP -> CN ; -- collective family: "path between x and y" - --- Type constructor, similar to a family except that the argument is a type. - - constrTyp1 : Fun -> CN -> CN ; - --- Logical connectives on two sentences. - - conjS : S -> S -> S ; -- A and B - disjS : S -> S -> S ; -- A or B - implS : S -> S -> S ; -- if A, B - --- A variant of implication. - - ifThenS : S -> S -> S ; -- if A, then B - --- As an auxiliary, we need two-place conjunction of names ("John and Mary"), --- used in collective predication. - - conjNP : NP -> NP -> NP ; - - ------------------------------ - ----- what follows should be an implementation of the preceding - -oper - predV1 = \F, x -> PredVP x (PosV F) ; - predV2 = \F, x, y -> PredVP x (PosTV F y) ; - predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ; - predA1 = \F, x -> PredVP x (PosA (AdjP1 F)) ; - predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ; - predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ; - predAColl = \F, x, y -> PredVP (conjNP x y) (PosA (AdjP1 F)) ; - predN1 = \F, x -> PredVP x (PosCN (UseN F)) ; - predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ; - predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ; - - appFun1 = \f, x -> DefOneNP (AppFun f x) ; - appFun2 = \f, x, y -> DefOneNP (AppFun (AppFun2 f x) y) ; - appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ; - - appFam1 = \F, x -> AppFun F x ; - appFam2 = \F, x, y -> AppFun (AppFun2 F x) y ; - appFamColl = \F, x, y -> AppFun F (conjNP x y) ; - - conjS = \A, B -> ConjS AndConj (TwoS A B) ; - disjS = \A, B -> ConjS OrConj (TwoS A B) ; - implS = \A, B -> SubjS IfSubj A B ; - - ifThenS = \A,B -> - SubjS IfSubj A {s = \\o => "then" ++ B.s ! o ; lock_S = <>} ; --- not in Res - - constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ; - - conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ; - -} ; diff --git a/grammars/resource/german/ResDeu.gf b/grammars/resource/german/ResDeu.gf deleted file mode 100644 index 8a602e305..000000000 --- a/grammars/resource/german/ResDeu.gf +++ /dev/null @@ -1,223 +0,0 @@ ---1 The Top-Level German Resource Grammar --- --- Aarne Ranta 2002 -- 2003 --- --- This is the German concrete syntax of the multilingual resource --- grammar. Most of the work is done in the file $syntax.Deu.gf$. --- However, for the purpose of documentation, we make here explicit the --- linearization types of each category, so that their structures and --- dependencies can be seen. --- Another substantial part are the linearization rules of some --- structural words. --- --- The users of the resource grammar should not look at this file for the --- linearization rules, which are in fact hidden in the document version. --- They should use $resource.Abs.gf$ to access the syntactic rules. --- This file can be consulted in those, hopefully rare, occasions in which --- one has to know how the syntactic categories are --- implemented. The parameter types are defined in $Types.gf$. - -concrete ResDeu of ResAbs = open Prelude, Syntax in { - -flags - startcat=Phr ; - parser=chart ; - -lincat - CN = CommNounPhrase ; - -- = {s : Adjf => Number => Case => Str ; g : Gender} ; - N = CommNoun ; - -- = {s : Number => Case => Str ; g : Gender} ; - NP = NounPhrase ; - -- = {s : NPForm => Str ; n : Number ; p : Person ; pro : Bool} ; - PN = ProperName ; - -- = {s : Case => Str} ; - Det = {s : Gender => Case => Str ; n : Number ; a : Adjf} ; - Fun = Function ; - -- = CommNounPhrase ** {s2 : Preposition ; c : Case} ; - Fun2 = Function ** {s3 : Preposition ; c2 : Case} ; - - Adj1 = Adjective ; - -- = {s : AForm => Str} ; - Adj2 = Adjective ** {s2 : Preposition ; c : Case} ; - AdjDeg = {s : Degree => AForm => Str} ; - AP = Adjective ** {p : Bool} ; - - V = Verb ; - -- = {s : VForm => Str ; s2 : Particle} ; - VP = Verb ** {s3 : Number => Str ; s4 : Str} ; - TV = TransVerb ; - -- = Verb ** {s3 : Preposition ; c : Case} ; - V3 = TransVerb ** {s4 : Preposition ; c2 : Case} ; - VS = Verb ; - AdV = {s : Str} ; - - S = Sentence ; - -- = {s : Order => Str} ; - Slash = Sentence ** {s2 : Preposition ; c : Case} ; - - RP = {s : GenNum => Case => Str} ; - RC = {s : GenNum => Str} ; - - IP = ProperName ** {n : Number} ; - Qu = {s : QuestForm => Str} ; - Imp = {s : Number => Str} ; - Phr = {s : Str} ; - Text = {s : Str} ; - - Conj = {s : Str ; n : Number} ; - ConjD = {s1,s2 : Str ; n : Number} ; - - ListS = {s1,s2 : Order => Str} ; - ListAP = {s1,s2 : AForm => Str ; p : Bool} ; - ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person ; pro : Bool} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenMany = npGenDet plural ; - UsePN = nameNounPhrase ; - UseFun = funAsCommNounPhrase ; - AppFun = appFunComm ; - AppFun2 = appFun2 ; - AdjP1 = adj2adjPhrase ; - ComplAdj = complAdj ; - PositAdjP = positAdjPhrase ; - ComparAdjP = comparAdjPhrase ; - SuperlNP = superlNounPhrase ; - - DetNP = detNounPhrase ; - IndefOneNP = indefNounPhrase singular ; - IndefManyNP = indefNounPhrase plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhrase plural ; - - CNthatS = nounThatSentence ; - - PredVP = predVerbPhrase ; - PosV = predVerb True ; - NegV = predVerb False ; - PosA = predAdjective True ; - NegA = predAdjective False ; - PosCN = predCommNoun True ; - NegCN = predCommNoun False ; - PosTV = complTransVerb True ; - NegTV = complTransVerb False ; - PosPassV = passVerb True ; - NegPassV = passVerb False ; - PosNP = predNounPhrase True ; - NegNP = predNounPhrase False ; - PosVS = complSentVerb True ; - NegVS = complSentVerb False ; - PosV3 = complDitransVerb True ; - NegV3 = complDitransVerb False ; - VTrans = transAsVerb ; - - AdvVP = adVerbPhrase ; - LocNP = locativeNounPhrase ; - AdvCN = advCommNounPhrase ; - AdvAP = advAdjPhrase ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - OneVP = predVerbPhrase (nameNounPhrase {s = \\_ => "man"}) ; - - IdRP = identRelPron ; - FunRP = funRelPron ; - RelVP = relVerbPhrase ; - RelSlash = relSlash ; - ModRC = modRelClause ; - RelSuch = relSuch ; - - WhoOne = intPronWho singular ; - WhoMany = intPronWho plural ; - WhatOne = intPronWhat singular ; - WhatMany = intPronWhat plural ; - FunIP = funIntPron ; - NounIPOne = nounIntPron singular ; - NounIPMany = nounIntPron plural ; - - QuestVP = questVerbPhrase ; - IntVP = intVerbPhrase ; - IntSlash = intSlash ; - QuestAdv = questAdverbial ; - - ImperVP = imperVerbPhrase ; - - IndicPhrase = indicUtt ; - QuestPhrase = interrogUtt ; - ImperOne = imperUtterance singular ; - ImperMany = imperUtterance plural ; - - AdvS = advSentence ; - -lin - TwoS = twoSentence ; - ConsS = consSentence ; - ConjS = conjunctSentence ; - ConjDS = conjunctDistrSentence ; - - TwoAP = twoAdjPhrase ; - ConsAP = consAdjPhrase ; - ConjAP = conjunctAdjPhrase ; - ConjDAP = conjunctDistrAdjPhrase ; - - TwoNP = twoNounPhrase ; - ConsNP = consNounPhrase ; - ConjNP = conjunctNounPhrase ; - ConjDNP = conjunctDistrNounPhrase ; - - SubjS = subjunctSentence ; - SubjImper = subjunctImperative ; - SubjQu = subjunctQuestion ; - SubjVP = subjunctVerbPhrase ; - - PhrNP = useNounPhrase ; - PhrOneCN = useCommonNounPhrase singular ; - PhrManyCN = useCommonNounPhrase plural ; - PhrIP ip = ip ; - PhrIAdv ia = ia ; - - OnePhr p = p ; - ConsPhr = cc2 ; - - INP = pronNounPhrase pronIch ; - ThouNP = pronNounPhrase pronDu ; - HeNP = pronNounPhrase pronEr ; - SheNP = pronNounPhrase pronSie ; - ItNP = pronNounPhrase pronEs ; - WeNP = pronNounPhrase pronWir ; - YeNP = pronNounPhrase pronIhr ; - TheyNP = pronNounPhrase pronSiePl ; - - YouNP = pronNounPhrase pronSSie ; - - EveryDet = jederDet ; - AllDet = alleDet ; - WhichDet = welcherDet ; - MostDet = meistDet ; - - HowIAdv = ss "wie" ; - WhenIAdv = ss "wann" ; - WhereIAdv = ss "war" ; - WhyIAdv = ss "warum" ; - - AndConj = ss "und" ** {n = Pl} ; - OrConj = ss "oder" ** {n = Sg} ; - BothAnd = sd2 "sowohl" ["als auch"] ** {n = Pl} ; - EitherOr = sd2 "entweder" "oder" ** {n = Sg} ; - NeitherNor = sd2 "weder" "noch" ** {n = Sg} ; - IfSubj = ss "wenn" ; - WhenSubj = ss "wenn" ; - - PhrYes = ss ["Ja ."] ; - PhrNo = ss ["Nein ."] ; - - VeryAdv = ss "sehr" ; - TooAdv = ss "zu" ; - OtherwiseAdv = ss "sonst" ; - ThereforeAdv = ss "deshalb" ; -} ; diff --git a/grammars/resource/german/RestaurantDeu.gf b/grammars/resource/german/RestaurantDeu.gf deleted file mode 100644 index 8517533b1..000000000 --- a/grammars/resource/german/RestaurantDeu.gf +++ /dev/null @@ -1,26 +0,0 @@ ---# -path=.:../abstract:../../prelude - -concrete RestaurantDeu of Restaurant = - DatabaseDeu ** open Prelude,Paradigms,Deutsch,DatabaseRes in { - -lin - Restaurant = UseN (nAuto "Restaurant") ; - Bar = UseN (nAuto "Bar") ; --- ?? - French = apReg "Französisch" ; - Italian = apReg "Italienisch" ; - Indian = apReg "Indisch" ; - Japanese = apReg "Japanisch" ; - - address = funVon (nFrau "Adresse") ; - phone = funVon (nFrau "Rufnummer") ; --- - priceLevel = funVon (nFrau "Preisstufe") ; - - Cheap = aReg "billig" ; - Expensive = aDeg3 "teuer" "teurer" "teurest" ; - - WhoRecommend rest = mkSentSame (ss2 ["wer empfiehlt"] (rest.s ! accusative)) ; - WhoHellRecommend rest = - mkSentSame (ss2 ["wer zum Teufel empfiehlt"] (rest.s ! accusative)) ; - - LucasCarton = mkPN ["Lucas Carton"] ["Lucas Cartons"] ; -} ; diff --git a/grammars/resource/german/Syntax.gf b/grammars/resource/german/Syntax.gf deleted file mode 100644 index afaf1ad86..000000000 --- a/grammars/resource/german/Syntax.gf +++ /dev/null @@ -1,969 +0,0 @@ ---1 A Small German Resource Syntax --- --- Aarne Ranta 2002 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in German. --- --- The following modules are presupposed: - -resource Syntax = Morpho ** open Prelude, (CO = Coordination) in { - ---2 Common Nouns --- --- Simple common nouns are defined as the type $CommNoun$ in $morpho.Deu.gf$. - ---3 Common noun phrases - --- The need for this more complex type comes from the variation in the way in --- which a modifying adjective is inflected after different determiners. --- We use the $Adjf$ parameter for this ($Strong$/$Weak$). - -oper - - CommNounPhrase : Type = {s : Adjf => Number => Case => Str ; g : Gender} ; - - noun2CommNounPhrase : CommNoun -> CommNounPhrase = \haus -> - {s = \\_ => haus.s ; g = haus.g} ; - - n2n = noun2CommNounPhrase ; - - ---2 Noun phrases --- --- The worst case is pronouns, which have inflection in the possessive --- forms. Other noun phrases express all possessive forms with the genitive case. --- The parameter $pro$ tells if the $NP$ is a pronoun, which is needed in e.g. --- genitive constructions. - - NounPhrase : Type = { - s : NPForm => Str ; - n : Number ; - p : Person ; - pro : Bool - } ; - - pronNounPhrase : ProPN -> NounPhrase = \ich -> - ich ** {pro = True} ; - - caseNP : NPForm -> Case = \np -> case np of { - NPCase c => c ; - NPPoss _ _ => Gen - } ; - - normalNounPhrase : (Case => Str) -> Number -> NounPhrase = \cs,n -> - {s = \\c => cs ! caseNP c ; - n = n ; - p = P3 ; -- third person - pro = False -- not a pronoun - } ; - --- Proper names are a simple kind of noun phrases. They can usually --- be constructed from strings in a regular way. - - ProperName : Type = {s : Case => Str} ; - - nameNounPhrase : ProperName -> NounPhrase = \john -> - {s = \\np => john.s ! caseNP np ; n = Sg ; p = P3 ; pro = False} ; - - mkProperName : Str -> ProperName = \horst -> - {s = table {Gen => horst + "s" ; _ => horst}} ; - ---2 Mass nouns --- --- Mass nouns are morphologically similar to nouns, but they have one special --- rule of noun phrase formation, using the bare singular (in German). --- Example: "Bier ist gut". --- They can also be coerced to common nouns: "ein Mexikanisches Bier". - - MassNounPhrase : Type = CommNounPhrase ; - - massNounPhrase : MassNounPhrase -> NounPhrase = \bier -> { - s = \\c => let {nc = caseNP c} in - bier.s ! adjfCas Strong nc ! Sg ! nc ; - p = P3 ; - n = Sg ; - pro = False - } ; - - massCommNoun : MassNounPhrase -> CommNounPhrase = \x -> x ; - - ---2 Determiners --- --- Determiners are inflected according to the nouns they determine. --- The determiner determines the number and adjectival form from the determiner. - - Determiner : Type = {s : Gender => Case => Str ; n : Number ; a : Adjf} ; - - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \ein, mann -> { - s = \\c => let {nc = caseNP c} in - ein.s ! mann.g ! nc ++ mann.s ! adjfCas ein.a nc ! ein.n ! nc ; - p = P3 ; - n = ein.n ; - pro = False - } ; - - --- The adjectival form after a determiner depends both on the inferent form --- and on the case ("ein alter Mann" but "einem alten Mann"). - - adjfCas : Adjf -> Case -> Adjf = \a,c -> case <a,c> of { - <Strong,Nom> => Strong ; - <Strong,Acc> => Strong ; - _ => Weak - } ; - --- The following macros are sufficient to define most determiners, --- as shown by the examples that follow. - - DetSg = Gender => Case => Str ; - DetPl = Case => Str ; - - mkDeterminerSg : DetSg -> Adjf -> Determiner = \ein, a -> - {s = ein ; n = Sg ; a = a} ; - - mkDeterminerPl : DetPl -> Adjf -> Determiner = \alle, a -> - {s = \\_ => alle ; n = Pl ; a = a} ; - - detLikeAdj : Str -> Determiner = \jed -> mkDeterminerSg - (\\g,c => (adjReg jed).s ! AMod Strong (GSg g) c) Weak ; - - jederDet = detLikeAdj "jed" ; - alleDet = mkDeterminerPl (caselist "alle" "alle" "allen" "aller") Weak ; - einDet = mkDeterminerSg artIndef Strong ; - derDet = mkDeterminerSg (table {g => artDef ! GSg g}) Weak ; - dieDet = mkDeterminerPl (artDef ! GPl) Weak ; - - meistDet = mkDeterminerPl (table {c => artDef ! GPl ! c ++ "meisten"}) Weak ; - welcherDet = detLikeAdj "welch" ; - welcheDet = mkDeterminerPl (caselist "welche" "welche" "welchen" "welcher") Weak ; - --- Choose "welcher"/"welche" - - welchDet : Number -> Determiner = \n -> - case n of {Sg => welcherDet ; Pl => welcheDet} ; - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "mein Haus" - "meine Häuser". --- --- If the 'owner' is a pronoun, only one form is available "mein Haus". --- In other cases, two variants are available: "Johanns Haus" / "das Haus Johanns". - - npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase = \n,haus,Wein -> - let { - hauses : Case => Str = \\c => haus.s ! NPPoss (gNumber Wein.g n) c ; - wein : NPForm => Str = \\c => Wein.s ! Strong ! n ! caseNP c ; - derwein : NPForm => Str = (defNounPhrase n Wein).s - } - in - {s = \\c => variants { - hauses ! caseNP c ++ wein ! c ; - if_then_else Str haus.pro - nonExist - (derwein ! c ++ hauses ! Nom) -- the case does not matter - } ; - p = P3 ; - n = n ; - pro = False - } ; - --- *Bare plural noun phrases* like "Männer", "gute Häuser", are built without a --- determiner word. - - plurDet : CommNounPhrase -> NounPhrase = \cn -> - normalNounPhrase (cn.s ! Strong ! Pl) Pl ; - --- Macros for indef/def Sg/Pl noun phrases are needed in many places even --- if they might not be constituents. - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,haus -> case n of { - Sg => detNounPhrase einDet haus ; - Pl => plurDet haus - } ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,haus -> case n of { - Sg => detNounPhrase derDet haus ; - Pl => detNounPhrase dieDet haus - } ; - - indefNoun : Number -> CommNounPhrase -> Str = \n, mann -> case n of { - Sg => (detNounPhrase einDet mann).s ! NPCase Nom ; - Pl => (plurDet mann).s ! NPCase Nom - } ; - --- Constructions like "die Idee, dass zwei gerade ist" are formed at the --- first place as common nouns, so that one can also have "ein Vorschlag, dass...". - - nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idee,x -> - {s = \\a,n,c => idee.s ! a! n ! c ++ [", dass"] ++ x.s ! Sub ; - g = idee.g - } ; - ---2 Adjectives --- --- Adjectival phrases have a parameter $p$ telling if postposition is --- allowed (complex APs). - - AdjPhrase : Type = Adjective ** {p : Bool} ; - - adj2adjPhrase : Adjective -> AdjPhrase = \ny -> ny ** {p = False} ; - ---3 Comparison adjectives --- --- The type is defined in $types.Deu.gf$. - - AdjDegr : Type = AdjComp ; - --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("jung"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \jung -> - {s = jung.s ! Pos ; p = False} ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("besser als Rolf"). - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \besser,rolf -> - {s = \\a => besser.s ! Comp ! a ++ "als" ++ rolf.s ! NPCase Nom ; - p = True - } ; - --- Superlative forms are used with a common noun, picking out the --- maximal representative of a domain ("der Jüngste Mann"). - - superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \best,mann -> - let {gen = mann.g} in - {s = \\c => let {nc = caseNP c} in - artDef ! gNumber gen Sg ! nc ++ - best.s ! Sup ! aMod Weak gen Sg nc ++ - mann.s ! Weak ! Sg ! nc ; - p = P3 ; - n = Sg ; - pro = False - } ; - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a preposition used before --- the complement, and the complement case. - - AdjCompl = Adjective ** {s2 : Preposition ; c : Case} ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \verwandt,dich -> - {s = \\a => - bothWays (verwandt.s ! a) (verwandt.s2 ++ dich.s ! NPCase verwandt.c) ; - p = True - } ; - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("Johann ist jung") --- and in modification ("ein junger Mann"). Predication will be defined --- later, in the chapter on verbs. --- --- Modification must pay attention to pre- and post-noun --- adjectives: "gutes Haus"; "besseres als X haus" / "haus besseres als X" - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \gut,haus -> - {s = \\a,n,c => let { - gutes = gut.s ! aMod a haus.g n c ; - Haus = haus.s ! a ! n ! c - } in - if_then_else Str gut.p (bothWays gutes Haus) (gutes ++ Haus) ; - g = haus.g} ; - ---2 Function expressions - --- A function expression is a common noun together with the --- preposition prefixed to its argument ("Mutter von x"). --- The type is analogous to two-place adjectives and transitive verbs. - - Function = CommNounPhrase ** {s2 : Preposition ; c : Case} ; - --- The application of a function gives, in the first place, a common noun: --- "Mutter/Mütter von Johann". From this, other rules of the resource grammar --- give noun phrases, such as "die Mutter von Johann", "die Mütter von Johann", --- "die Mütter von Johann und Maria", and "die Mutter von Johann und Maria" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \mutter,uwe -> - {s = \\a,n,c => mutter.s ! a ! n ! c ++ mutter.s2 ++ uwe.s ! NPCase mutter.c ; - g = mutter.g - } ; - --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ; - --- The following is an aggregate corresponding to the original function application --- producing "Johanns Mutter" and "die Mutter von Johann". It does not appear in the --- resource grammar API any longer. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mutter, uwe -> - let {n = uwe.n ; g = mutter.g ; nf = if_then_else Number coll Sg n} in - variants { - defNounPhrase nf (appFunComm mutter uwe) ; - npGenDet nf uwe mutter - } ; - --- The commonest cases are functions with "von" and functions with Genitive. - - mkFunC : CommNounPhrase -> Preposition -> Case -> Function = \f,p,c -> - f ** {s2 = p ; c = c} ; - - funVonC : CommNounPhrase -> Function = \wert -> - mkFunC wert "von" Dat ; - - funGenC : CommNounPhrase -> Function = \wert -> - mkFunC wert [] Gen ; - --- Two-place functions add one argument place. - - Function2 = Function ** {s3 : Preposition ; c2 : Case} ; - --- There application starts by filling the first place. - - appFun2 : Function2 -> NounPhrase -> Function = \flug, paris -> - {s = \\a,n,c => flug.s ! a ! n ! c ++ flug.s2 ++ paris.s ! NPCase flug.c ; - g = flug.g ; - s2 = flug.s3 ; - c = flug.c2 - } ; - - ---2 Verbs --- ---3 Verb phrases --- --- Verb phrases are discontinuous: the parts of a verb phrase are --- (s) an inflected verb, (s2) particle, --- (s3) negation and complement, and (s4) sentential adverbial. --- This discontinuity is needed in sentence formation --- to account for word order variations. - - VerbPhrase = Verb ** {s3 : Number => Str ; s4 : Str} ; - --- A simple verb can be made into a verb phrase with an empty complement. --- There are two versions, depending on if we want to negate the verb. --- N.B. negation is *not* a function applicable to a verb phrase, since --- double negations with "nicht" are not grammatical. - - predVerb : Bool -> Verb -> VerbPhrase = \b,aussehen -> - aussehen ** { - s3 = \\_ => negation b ; - s4 = [] - } ; - - negation : Bool -> Str = \b -> if_then_else Str b [] "nicht" ; - --- Sometimes we want to extract the verb part of a verb phrase. - - verbOfPhrase : VerbPhrase -> Verb = \v -> {s = v.s ; s2 = v.s2} ; - --- Verb phrases can also be formed from adjectives ("ist gut"), --- common nouns ("ist ein Mann"), and noun phrases ("ist der jüngste Mann"). --- The third rule is overgenerating: "ist jeder Mann" has to be ruled out --- on semantic grounds. - - predAdjective : Bool -> Adjective -> VerbPhrase = \b,gut -> - verbSein ** { - s3 = \\_ => negation b ++ gut.s ! APred ; - s4 = [] - } ; - - predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,man -> - verbSein ** { - s3 = \\n => negation b ++ indefNoun n man ; - s4 = [] - } ; - - predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,dermann -> - verbSein ** { - s3 = \\n => negation b ++ dermann.s ! NPCase Nom ; - s4 = [] - } ; - ---3 Transitive verbs --- --- Transitive verbs are verbs with a preposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object* - which may still be accusative, --- dative, or genitive. - - TransVerb = Verb ** {s3 : Preposition ; c : Case} ; - - mkTransVerb : Verb -> Preposition -> Case -> TransVerb = - \v,p,c -> v ** {s3 = p ; c = c} ; - --- The rule for using transitive verbs is the complementization rule: - - complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = - \b,warten,dich -> - let { - aufdich = warten.s3 ++ dich.s ! NPCase warten.c ; - nicht = negation b - } in - {s = warten.s ; - s2 = warten.s2 ; - s3 = \\_ => bothWays aufdich nicht ; - s4 = [] - } ; - --- Transitive verbs with accusative objects can be used passively. --- The function does not check that the verb is transitive. --- Therefore, the function can also be used for "es wird gelaufen", etc. - - passVerb : Bool -> Verb -> VerbPhrase = \b,lieben -> - {s = verbumWerden ; - s2 = [] ; - s3 = \\_ => negation b ++ lieben.s ! VPart APred ; - s4 = [] - } ; - --- Transitive verb can be used elliptically as a verb. The semantics --- is left to applications. The definition is trivial, due to record --- subtyping. - - transAsVerb : TransVerb -> Verb = \lieben -> - lieben ; - --- *Ditransitive verbs* are verbs with three argument places. --- We treat so far only the rule in which the ditransitive --- verb takes both complements to form a verb phrase. - - DitransVerb = TransVerb ** {s4 : Preposition ; c2 : Case} ; - - mkDitransVerb : - Verb -> Preposition -> Case -> Preposition -> Case -> DitransVerb = - \v,p1,c1,p2,c2 -> v ** {s3 = p1 ; c = c1 ; s4 = p2 ; c2 = c2} ; - - complDitransVerb : - Bool -> DitransVerb -> NounPhrase -> NounPhrase -> VerbPhrase = - \b,geben,dir,bier -> - let { - zudir = geben.s3 ++ dir.s ! NPCase geben.c ; - dasbier = geben.s4 ++ bier.s ! NPCase geben.c2 ; - nicht = negation b - } in - {s = geben.s ; - s2 = geben.s2 ; - s3 = \\_ => variants { - nicht ++ zudir ++ dasbier ; - zudir ++ nicht ++ dasbier ; - zudir ++ dasbier ++ nicht - } ; - s4 = [] - } ; - - ---2 Adverbials --- --- Adverbials are not inflected (we ignore comparison, and treat --- compared adverbials as separate expressions; this could be done another way). - - Adverb : Type = SS ; - - mkAdverb : Str -> Adverb = ss ; - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \spielt, gut -> - {s = spielt.s ; - s2 = spielt.s2 ; - s3 = \\n => spielt.s3 ! n ++ gut.s ; - s4 = spielt.s4 - } ; - - advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \sehr, gut -> - {s = \\a => sehr.s ++ gut.s ! a ; - p = gut.p - } ; - --- Adverbials are typically generated by prefixing prepositions. --- The rule for creating locative noun phrases by the preposition "in" --- is a little shaky, since other prepositions may be preferred ("an", "auf"). - - prepPhrase : Case -> Preposition -> NounPhrase -> Adverb = \c,auf,ihm -> - ss (auf ++ ihm.s ! NPCase c) ; - - locativeNounPhrase : NounPhrase -> Adverb = - prepPhrase Dat "in" ; - --- This is a source of the "Mann mit einem Teleskop" ambiguity, and may produce --- strange things, like "Autos immer" (while "Autos heute" is OK). --- Semantics will have to make finer distinctions among adverbials. - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \haus,heute -> - {s = \\a, n, c => haus.s ! a ! n ! c ++ heute.s ; - g = haus.g} ; - - - ---2 Sentences --- --- Sentences depend on a *word order parameter* selecting between main clause, --- inverted, and subordinate clause. - - Sentence : Type = SS1 Order ; - --- This is the traditional $S -> NP VP$ rule. It takes care of both --- word order and agreement. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = - \Ich,LiebeDichNichtAus -> - let { - ich = Ich.s ! NPCase Nom ; - liebe = LiebeDichNichtAus.s ! VInd Ich.n Ich.p ; - aus = LiebeDichNichtAus.s2 ; - dichnichtgut = LiebeDichNichtAus.s3 ! Ich.n ; - wennesregnet = LiebeDichNichtAus.s4 - } in - {s = table { - Main => ich ++ liebe ++ dichnichtgut ++ aus ++ wennesregnet ; - Inv => liebe ++ ich ++ dichnichtgut ++ aus ++ wennesregnet ; - Sub => ich ++ dichnichtgut ++ aus ++ liebe ++ wennesregnet - } - } ; - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. - - SentenceVerb : Type = Verb ; - - complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase = \b,sage,duisst -> - sage ** { - s3 = table Number {_ => negation b} ; - s4 = "," ++ "dass" ++ duisst.s ! Sub - } ; - - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- Notice that the slash category has the same relation to sentences as --- transitive verbs have to verbs: it's like a *sentence taking a complement*. - - SentenceSlashNounPhrase : Type = Sentence ** {s2 : Preposition ; c : Case} ; - - slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = - \b, Ich, sehen -> - let { - ich = Ich.s ! NPCase Nom ; - sehe = sehen.s ! VInd Ich.n P3 ; - aus = sehen.s2 ; - nicht = negation b - } in - {s = table { - Main => ich ++ sehe ++ nicht ++ aus ; - Inv => sehe ++ ich ++ nicht ++ aus ; - Sub => ich ++ nicht ++ aus ++ sehe - } ; - s2 = sehen.s3 ; - c = sehen.c - } ; - ---2 Relative pronouns and relative clauses --- --- Relative pronouns are inflected in --- gender, number, and case just like adjectives. - -oper - identRelPron : RelPron = relPron ; - - funRelPron : Function -> RelPron -> RelPron = \wert, der -> - {s = \\gn,c => let {nu = numGenNum gn} in - artDef ! gNumber wert.g nu ! c ++ wert.s ! Weak ! nu ! c ++ - wert.s2 ++ der.s ! gn ! wert.c - } ; - --- Relative clauses can be formed from both verb phrases ("der schläft") and --- slash expressions ("den ich sehe", "auf dem ich sitze"). - - RelClause : Type = {s : GenNum => Str} ; - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \der, geht -> - {s = \\gn => (predVerbPhrase (normalNounPhrase (der.s ! gn) (numGenNum gn)) - geht - ).s ! Sub - } ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \den, ichSehe -> - {s = \\gn => ichSehe.s2 ++ den.s ! gn ! ichSehe.c ++ ichSehe.s ! Sub - } ; - --- A 'degenerate' relative clause is the one often used in mathematics, e.g. --- "Zahl x derart, dass x gerade ist". - - relSuch : Sentence -> RelClause = \A -> - {s = \\_ => "derart" ++ "dass" ++ A.s ! Sub} ; - --- The main use of relative clauses is to modify common nouns. --- The result is a common noun, out of which noun phrases can be formed --- by determiners. A comma is used before the relative clause. - - modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \mann,dergeht -> - {s = \\a,n,c => mann.s ! a ! n ! c ++ "," ++ dergeht.s ! gNumber mann.g n ; - g = mann.g - } ; - - ---2 Interrogative pronouns --- --- If relative pronouns are adjective-like, interrogative pronouns are --- noun-phrase-like. We use a simplified type, since we don't need the possessive --- forms. - - IntPron : Type = ProperName ** {n : Number} ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. - - funIntPron : Function -> IntPron -> IntPron = \wert, wer -> - let {n = wer.n} in - {s = \\c => - artDef ! gNumber wert.g n ! c ++ wert.s ! Weak ! n ! c ++ - wert.s2 ++ wer.s ! wert.c ; - n = n - } ; - --- There is a variety of simple interrogative pronouns: --- "welches Haus", "wer", "was". - - nounIntPron : Number -> CommNounPhrase -> IntPron = \n,cn -> - let {np = detNounPhrase (welchDet n) cn} in - {s = \\c => np.s ! NPCase c ; - n = np.n} ; - - intPronWho : Number -> IntPron = \num -> { - s = caselist "wer" "wen" "wem" "weren" ; - n = num - } ; - - intPronWhat : Number -> IntPron = \num -> { - s = caselist "was" "was" nonExist nonExist ; --- - n = num - } ; - - - ---2 Utterances - --- By utterances we mean whole phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> ss (x.s ! Main ++ ".") ; - interrogUtt : Question -> Utterance = \x -> ss (x.s ! DirQ ++ "?") ; - - ---2 Questions --- --- Questions are either direct ("bist du müde") or indirect --- ("ob du müde bist"). - -param - QuestForm = DirQ | IndirQ ; - -oper - Question = SS1 QuestForm ; - ---3 Yes-no questions --- --- Yes-no questions are used both independently ("bist du müde") --- and after interrogative adverbials ("warum bist du müde"). --- It is economical to handle with these two cases by the one --- rule, $questVerbPhrase'$. The only difference is if "ob" appears --- in the indirect form. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question = - questVerbPhrase' False ; - - questVerbPhrase' : Bool -> NounPhrase -> VerbPhrase -> Question = - \adv, du,gehst -> - let {dugehst = (predVerbPhrase du gehst).s} in - {s = table { - DirQ => dugehst ! Inv ; - IndirQ => (if_then_else Str adv [] "ob") ++ dugehst ! Sub - } - } ; - - ---3 Wh-questions --- --- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences, --- others that are line $S/NP - NP$ sentences. - - intVerbPhrase : IntPron -> VerbPhrase -> Question = \Wer,geht -> - let {wer : NounPhrase = normalNounPhrase Wer.s Wer.n ; - wergeht : Sentence = predVerbPhrase wer geht - } in - {s = table { - DirQ => wergeht.s ! Main ; - IndirQ => wergeht.s ! Sub - } - } ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \wer, ichSehe -> - let {zuwen = ichSehe.s2 ++ wer.s ! ichSehe.c} in - {s = table { - DirQ => zuwen ++ ichSehe.s ! Inv ; - IndirQ => zuwen ++ ichSehe.s ! Sub - } - } ; - - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "wann", "war", "wie", "warum", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding prepositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases. - - IntAdverb = SS ; - - prepIntAdverb : Case -> Preposition -> IntPron -> IntAdverb =\ c,auf,wem -> - ss (auf ++ wem.s ! c) ; - --- A question adverbial can be applied to anything, and whether this makes --- sense is a semantic question. - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = - \wie, du, tust -> - {s = \\q => wie.s ++ (questVerbPhrase du tust).s ! q} ; - - ---2 Imperatives --- --- We only consider second-person imperatives. No polite "Sie" form so far. - - Imperative = SS1 Number ; - - imperVerbPhrase : VerbPhrase -> Imperative = \komm -> - {s = \\n => komm.s ! VImp n ++ komm.s3 ! n ++ komm.s2 ++ komm.s4} ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! n ++ "!") ; - ---2 Sentence adverbials --- --- This class covers adverbials such as "sonst", "deshalb", which are prefixed --- to a sentence to form a phrase; the sentence gets inverted word order. - - advSentence : Adverb -> Sentence -> Utterance = \sonst,ist1gerade -> - ss (sonst.s ++ ist1gerade.s ! Inv ++ ".") ; - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("und", "oder") or distributed ("sowohl - als auch", "entweder - oder"). --- --- The conjunction has an inherent number, which is used when conjoining --- noun phrases: "John und Mary sind..." vs. "John oder Mary ist..."; in the --- case of "oder", the result is however plural if any of the disjuncts is. - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. - - ListSentence : Type = {s1,s2 : Order => Str} ; - - twoSentence : (_,_ : Sentence) -> ListSentence = - CO.twoTable Order ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consTable Order CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "du rauchst, er trinkt und ich esse". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = - CO.conjunctTable Order ; - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part (e.g. "entweder") in front of the first element, the second --- part ("oder") between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - CO.conjunctDistrTable Order ; - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. The result is a prefix adjective --- if and only if all elements are prefix. - - ListAdjPhrase : Type = - {s1,s2 : AForm => Str ; p : Bool} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable AForm x y ** {p = andB x.p y.p} ; - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable AForm CO.comma xs x ** {p = andB xs.p x.p} ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable AForm c xs ** {p = xs.p} ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctDistrTable AForm c xs ** {p = xs.p} ; - - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- or plural if any of the components is, depending on the conjunction. --- The result is a pronoun if all components are. - - ListNounPhrase : Type = - {s1,s2 : NPForm => Str ; n : Number ; p : Person ; pro : Bool} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - CO.twoTable NPForm x y ** - {n = conjNumber x.n y.n ; p = conjPerson x.p y.p ; pro = andB x.pro y.pro} ; - - consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x -> - CO.consTable NPForm CO.comma xs x ** - {n = conjNumber xs.n x.n ; p = conjPerson xs.p x.p ; pro = andB xs.pro x.pro} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs -> - CO.conjunctTable NPForm c xs ** - {n = conjNumber c.n xs.n ; p = xs.p ; pro = xs.pro} ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \c,xs -> - CO.conjunctDistrTable NPForm c xs ** - {n = conjNumber c.n xs.n ; p = xs.p ; pro = xs.pro} ; - --- We have to define a calculus of numbers of persons. For numbers, --- it is like the conjunction with $Pl$ corresponding to $False$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - --- For persons, we go in the descending order: --- "ich und dich sind stark", "er oder du bist stark". --- This is not always quite clear. - - conjPerson : Person -> Person -> Person = \p,q -> case <p,q> of { - <P3,P3> => P3 ; - <P1,_> => P1 ; - <_,P1> => P1 ; - _ => P2 - } ; - - ---2 Subjunction --- --- Subjunctions ("wenn", "falls", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = \if, A, B -> - let {As = A.s ! Sub} in - {s = table { - Main => variants {if.s ++ As ++ "," ++ B.s ! Inv ; - B.s ! Main ++ "," ++ if.s ++ As} ; - o => B.s ! o ++ "," ++ if.s ++ As - } - } ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \if, A, B -> - {s = \\n => subjunctVariants if A (B.s ! n)} ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = \if, A, B -> - {s = \\q => subjunctVariants if A (B.s ! q)} ; - --- There are uniformly two variant word orders, e.g. --- "wenn du rauchst, werde ish böse" --- and "ich werde böse, wenn du rauchst". - - subjunctVariants : Subjunction -> Sentence -> Str -> Str = \if,A,B -> - let {As = A.s ! Sub} in - variants {if.s ++ As ++ "," ++ B ; B ++ "," ++ if.s ++ As} ; - --- Subjunctions can be used for building adverbials, which can modify verb phrases --- ("ich lache wenn ich gehe und singe wenn ich laufe"). , noun phrases, etc. --- For reasons of word order, we treat this separately from other adverbials, --- but this could be remedied by an extra parameter in adverbials. - - subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = - \ruft,wenn,ergeht -> - {s = ruft.s ; - s2 = ruft.s2 ; - s3 = ruft.s3 ; - s4 = ruft.s4 ++ "," ++ wenn.s ++ ergeht.s ! Sub - } ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \john -> - postfixSS "." (defaultNounPhrase john) ; - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,car -> - useNounPhrase (indefNounPhrase n car) ; - --- Here are some default forms. - - defaultNounPhrase : NounPhrase -> SS = \john -> - ss (john.s ! NPCase Nom) ; - - defaultQuestion : Question -> SS = \whoareyou -> - ss (whoareyou.s ! DirQ) ; - - defaultSentence : Sentence -> Utterance = \x -> ss (x.s ! Main) ; - ---3 Puzzle --- --- Adding some lexicon, we can generate the sentence --- --- "der grösste alte Mann ist nicht ein Auto auf die Mutter von dem Männer warten" --- --- which looks completely ungrammatical! What you should do to decipher it is --- put parentheses around "auf die Mutter von dem". - -} ; diff --git a/grammars/resource/german/TestDeu.gf b/grammars/resource/german/TestDeu.gf deleted file mode 100644 index 9201f9c15..000000000 --- a/grammars/resource/german/TestDeu.gf +++ /dev/null @@ -1,49 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../abstract:../../prelude - -concrete TestDeu of TestAbs = ResDeu ** open Syntax in { - -flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; - --- a random sample from the lexicon - -lin - Big = adjCompReg3 "gross" "grösser" "grösst"; - Small = adjCompReg "klein" ; - Old = adjCompReg3 "alt" "älter" "ältest"; - Young = adjCompReg3 "jung" "jünger" "jüngst"; - American = adjReg "Amerikanisch" ; - Finnish = adjReg "Finnisch" ; - Married = adjReg "verheiratet" ** {s2 = "mit" ; c = Dat} ; - Man = declN2u "Mann" "Männer" ; - Woman = declN1 "Frau" ; - Car = declNs "Auto" ; - House = declN3uS "Haus" "Häuser" ; - Light = declN3 "Licht" ; - Walk = mkVerbSimple (verbLaufen "gehen" "geht" "gegangen") ; - Run = mkVerbSimple (verbLaufen "laufen" "läuft" "gelaufen") ; - Say = mkVerbSimple (regVerb "sagen") ; - Prove = mkVerbSimple (regVerb "beweisen") ; - Send = mkTransVerb (mkVerbSimple (verbLaufen "senden" "sendet" "gesandt")) [] Acc; - Love = mkTransVerb (mkVerbSimple (regVerb "lieben")) [] Acc ; - Wait = mkTransVerb (mkVerbSimple (verbWarten "warten")) "auf" Acc ; - Give = mkDitransVerb - (mkVerbSimple (verbLaufen "geben" "gibt" "gegeben")) [] Dat [] Acc ; - Prefer = mkDitransVerb - (mkVerb (verbLaufen "ziehen" "zieht" "gezogen") "vor") [] Acc "vor" Dat ; - Mother = mkFunC (n2n (declN2uF "Mutter" "Mütter")) "von" Dat ; - Uncle = mkFunC (n2n (declN2i "Onkel")) "von" Dat ; - Connection = mkFunC (n2n (declN1 "Verbindung")) "von" Dat ** - {s3 = "nach" ; c2 = Dat} ; - - Always = mkAdverb "immer" ; - Well = mkAdverb "gut" ; - - SwitchOn = mkTransVerb (mkVerb (verbWarten "schalten") "auf") [] Acc ; - SwitchOff = mkTransVerb (mkVerb (verbWarten "schalten") "aus") [] Acc ; - - John = mkProperName "Johann" ; - Mary = mkProperName "Maria" ; - -} ; - diff --git a/grammars/resource/german/Types.gf b/grammars/resource/german/Types.gf deleted file mode 100644 index d597223cd..000000000 --- a/grammars/resource/german/Types.gf +++ /dev/null @@ -1,98 +0,0 @@ ---1 German Word Classes and Morphological Parameters --- --- This is a resource module for German morphology, defining the --- morphological parameters and word classes of German. It is so far only --- complete w.r.t. the syntax part of the resource grammar. --- It does not include those parameters that are not needed for --- analysing individual words: such parameters are defined in syntax modules. --- - -resource Types = open Prelude in { - ---2 Enumerated parameter types --- --- These types are the ones found in school grammars. --- Their parameter values are atomic. - -param - Number = Sg | Pl ; - Gender = Masc | Fem | Neut ; - Person = P1 | P2 | P3 ; - Case = Nom | Acc | Dat | Gen ; - Adjf = Strong | Weak ; -- the main division in adjective declension - Order = Main | Inv | Sub ; -- word order: direct, indirect, subordinate - --- For abstraction and API compatibility, we define two synonyms: - -oper - singular = Sg ; - plural = Pl ; - ---2 Word classes and hierarchical parameter types --- --- Real parameter types (i.e. ones on which words and phrases depend) --- are mostly hierarchical. The alternative is cross-products of --- simple parameters, but this cannot be always used since it overgenerates. --- - ---3 Common nouns --- --- Common nouns are inflected in number and case and they have an inherent gender. - - CommNoun : Type = {s : Number => Case => Str ; g : Gender} ; - ---3 Pronouns --- --- Pronouns are an example - the worst-case one of noun phrases, --- which are properly defined in $syntax.Deu.gf$. --- Their inflection tables has, in addition to the normal genitive, --- the possessive forms, which are inflected like determiners. - -param - NPForm = NPCase Case | NPPoss GenNum Case ; - ---3 Adjectives --- --- Adjectives are a very complex class, and the full table has as many as --- 99 different forms. The major division is between the comparison degrees. --- There is no gender distinction in the plural, --- and the predicative forms ("X ist Adj") are not inflected. - -param - GenNum = GSg Gender | GPl ; - AForm = APred | AMod Adjf GenNum Case ; - -oper - Adjective : Type = {s : AForm => Str} ; - AdjComp : Type = {s : Degree => AForm => Str} ; - --- Comparison of adjectives: - -param Degree = Pos | Comp | Sup ; - ---3 Verbs --- --- We have a reduced conjugation with only the present tense infinitive, --- indicative, and imperative forms, and past participles. - -param VForm = VInf | VInd Number Person | VImp Number | VPart AForm ; - -oper Verbum : Type = VForm => Str ; - --- On the general level, we have to account for composite verbs as well, --- such as "aus" + "sehen" etc. - - Particle = Str ; - - Verb = {s : Verbum ; s2 : Particle} ; - - ---2 Prepositions --- --- We define prepositions simply as strings. Thus we do not capture the --- contractions "vom", "ins", etc. To define them in GF grammar we would need --- to introduce a parameter system, which we postpone. - - Preposition = Str ; - -} ; |
