diff --git a/grammars/resource/abstract/ResAbs.gf b/grammars/resource/abstract/ResAbs.gf index aba5ca216..f31cf59a9 100644 --- a/grammars/resource/abstract/ResAbs.gf +++ b/grammars/resource/abstract/ResAbs.gf @@ -58,7 +58,8 @@ cat V ; -- one-place verb, e.g. "walk" TV ; -- two-place verb, e.g. "love", "wait (for)", "switch on" - VS ; -- sentence-compl. verb e.g. "say", "prove" + V3 ; -- three-place verb, e.g. "give", "prefer (stg) (to stg)" + VS ; -- sentence-compl. verb, e.g. "say", "prove" VP ; -- verb phrase, e.g. "switch the light on" --3 Adverbials @@ -144,6 +145,8 @@ fun PosPassV, NegPassV : V -> VP ; -- "is seen", "is not seen" PosNP, NegNP : NP -> VP ; -- "is John", "is not John" PosVS, NegVS : VS -> S -> VP ; -- "says that I run", "doesn't say..." + PosV3, NegV3 : V3 -> NP -> NP -> VP ; -- "prefers wine to beer" + VTrans : TV -> V ; -- "loves" --3 Adverbials -- diff --git a/grammars/resource/abstract/TestAbs.gf b/grammars/resource/abstract/TestAbs.gf index c07ac4968..9605fd561 100644 --- a/grammars/resource/abstract/TestAbs.gf +++ b/grammars/resource/abstract/TestAbs.gf @@ -3,10 +3,13 @@ abstract TestAbs = ResAbs ** { -- a random sample of lexicon to test resource grammar with fun - Big, Small, Old, Young : AdjDeg ; + Big, Small, Old, Young : AdjDeg ; + American, Finnish : Adj1 ; + Married : Adj2 ; Man, Woman, Car, House, Light : N ; Walk, Run : V ; Send, Wait, Love, SwitchOn, SwitchOff : TV ; + Give, Prefer : V3 ; Say, Prove : VS ; Mother, Uncle : Fun ; Connection : Fun2 ; diff --git a/grammars/resource/english/Morpho.gf b/grammars/resource/english/Morpho.gf index 52779cd11..b5fcaa0fa 100644 --- a/grammars/resource/english/Morpho.gf +++ b/grammars/resource/english/Morpho.gf @@ -51,6 +51,7 @@ oper pronYouSg = mkPronoun "you" "you" "your" "yours" Sg P2 ; -- verb form still OK pronHe = mkPronoun "he" "him" "his" "his" Sg P3 ; pronShe = mkPronoun "she" "her" "her" "hers" Sg P3 ; + pronIt = mkPronoun "it" "it" "its" "it" Sg P3 ; pronWe = mkPronoun "we" "us" "our" "ours" Pl P1 ; pronYouPl = mkPronoun "you" "you" "your" "yours" Pl P2 ; @@ -111,29 +112,45 @@ oper --3 Verbs -- --- Except for "be", the worst case needs two forms. +-- Except for "be", the worst case needs four forms. - mkVerbP3 : (_,_: Str) -> VerbP3 = \goes,go -> - {s = table {InfImp => go ; Indic P3 => goes ; Indic _ => go}} ; + mkVerbP3 : (_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone -> + {s = table { + InfImp => go ; + Indic P3 => goes ; + Indic _ => go ; + Past _ => went ; + PPart => gone + } + } ; + + mkVerb : (_,_,_ : Str) -> VerbP3 = \ring,rang,rung -> + mkVerbP3 ring (ring + "s") rang rung ; regVerbP3 : Str -> VerbP3 = \walk -> - mkVerbP3 (walk + "s") walk ; + mkVerb walk (walk + "ed") (walk + "ed") ; verbP3s : Str -> VerbP3 = \kiss -> - mkVerbP3 (kiss + "es") kiss ; + mkVerbP3 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ; - verbP3y : Str -> VerbP3 = \fl -> - mkVerbP3 (fl + "ies") (fl + "y") ; + verbP3e : Str -> VerbP3 = \love -> + mkVerbP3 love (love + "s") (love + "d") (love + "d") ; - verbP3Have = mkVerbP3 "has" "have" ; + verbP3y : Str -> VerbP3 = \cr -> + mkVerbP3 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ; - verbP3Do = verbP3s "do" ; + verbP3Have = mkVerbP3 "have" "has" "had" "had" ; + + verbP3Do = mkVerbP3 "do" "does" "did" "done" ; verbBe : VerbP3 = {s = table { InfImp => "be" ; Indic P1 => "am" ; Indic P2 => "are" ; - Indic P3 => "is" + Indic P3 => "is" ; + Past Sg => "was" ; + Past Pl => "were" ; + PPart => "been" }} ; verbPart : VerbP3 -> Particle -> Verb = \v,p -> diff --git a/grammars/resource/english/Paradigms.gf b/grammars/resource/english/Paradigms.gf index 65e5c1297..ed54b4100 100644 --- a/grammars/resource/english/Paradigms.gf +++ b/grammars/resource/english/Paradigms.gf @@ -103,11 +103,11 @@ oper --2 Verbs -- --- The fragment only has present tense so far, but in all persons. --- Except for "be", the worst case needs two forms: the infinitive and --- the third person singular. +-- The fragment now has all verb forms, except the gerund/present participle. +-- Except for "be", the worst case needs four forms: the infinitive and +-- the third person singular present, the past indicative, and the past participle. - mkV : (go, goes : Str) -> V ; + mkV : (go, goes, went, gone : Str) -> V ; vReg : (walk : Str) -> V ; -- walk, walks vKiss : (kiss : Str) -> V ; -- kiss, kisses @@ -126,7 +126,7 @@ oper -- Verbs with a particle. - vPart : (go, goes, up : Str) -> V ; + vPart : (go, goes, went, gone, up : Str) -> V ; vPartReg : (get, up : Str) -> V ; -- Two-place verbs, and the special case with direct object. @@ -197,10 +197,11 @@ oper aRidiculous = adjDegrLong ; apReg = \s -> AdjP1 (mkAdj1 s) ; - mkV = \go,goes -> verbNoPart (mkVerbP3 goes go) ; - vReg = \run -> mkV run (run + "s") ; - vKiss = \kiss -> mkV kiss (kiss + "es") ; - vFly = \fly -> mkV fly (Predef.tk 1 fly + "ies") ; + mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) ; + vReg = \walk -> mkV walk (walk + "s") (walk + "ed") (walk + "ed") ; + vKiss = \kiss -> mkV kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ; + vFly = \cry -> let {cr = Predef.tk 1 cry} in + mkV cry (cr + "ies") (cr + "ied") (cr + "ied") ; vGo = vKiss ; vGen = \fly -> let { @@ -213,14 +214,14 @@ oper eqy "z" vKiss ( vReg))) fly ; - vPart = \go, goes, up -> verbPart (mkVerbP3 goes go) up ; + vPart = \go, goes, went, gone, up -> verbPart (mkVerbP3 go goes went gone) up ; vPartReg = \get, up -> verbPart (regVerbP3 get) up ; mkTV = \v,p -> v ** {s3 = p} ; tvPartReg = \get, along, with -> mkTV (vPartReg get along) with ; vBe = verbBe ; - vHave = mkV "have" "has" ; + vHave = verbP3Have ; tvGen = \s,p -> mkTV (vGen s) p ; tvDir = \v -> mkTV v [] ; diff --git a/grammars/resource/english/ResEng.gf b/grammars/resource/english/ResEng.gf index 412bcfae7..fc02ea4b1 100644 --- a/grammars/resource/english/ResEng.gf +++ b/grammars/resource/english/ResEng.gf @@ -31,7 +31,9 @@ lincat NP = {s : NPForm => Str ; n : Number ; p : Person} ; PN = {s : Case => Str} ; Det = {s : Str ; n : Number} ; - Fun = CommNounPhrase ** {s2 : Preposition} ; + Fun = Function ; + -- = CommNounPhrase ** {s2 : Preposition} ; + Fun2 = Function ** {s3 : Preposition} ; Adj1 = Adjective ; -- = {s : Str} @@ -42,7 +44,9 @@ lincat V = Verb ; -- = {s : VForm => Str ; s1 : Particle} VP = {s : VForm => Str ; s2 : Number => Str ; isAux : Bool} ; - TV = Verb ** {s3 : Preposition} ; + TV = TransVerb ; + -- = Verb ** {s3 : Preposition} ; + V3 = TransVerb ** {s4 : Preposition} ; VS = Verb ; AdV = {s : Str ; isPost : Bool} ; @@ -56,6 +60,7 @@ lincat Qu = {s : QuestForm => Str} ; Imp = {s : Number => Str} ; Phr = {s : Str} ; + Text = {s : Str} ; Conj = {s : Str ; n : Number} ; ConjD = {s1 : Str ; s2 : Str ; n : Number} ; @@ -74,6 +79,7 @@ lin UsePN = nameNounPhrase ; UseFun = funAsCommNounPhrase ; AppFun = appFunComm ; + AppFun2 = appFun2 ; AdjP1 = adj2adjPhrase ; ComplAdj = complAdj ; PositAdjP = positAdjPhrase ; @@ -86,6 +92,8 @@ lin DefOneNP = defNounPhrase singular ; DefManyNP = defNounPhrase plural ; + CNthatS = nounThatSentence ; + PredVP = predVerbPhrase ; PosV = predVerb True ; NegV = predVerb False ; @@ -95,18 +103,24 @@ lin NegCN = predCommNoun False ; PosTV = complTransVerb True ; NegTV = complTransVerb False ; + PosV3 = complDitransVerb True ; + NegV3 = complDitransVerb False ; + PosPassV = passVerb True ; + NegPassV = passVerb False ; PosNP = predNounPhrase True ; NegNP = predNounPhrase False ; PosVS = complSentVerb True ; NegVS = complSentVerb False ; - + VTrans = transAsVerb ; AdvVP = adVerbPhrase ; LocNP = locativeNounPhrase ; AdvCN = advCommNounPhrase ; + AdvAP = advAdjPhrase ; PosSlashTV = slashTransVerb True ; NegSlashTV = slashTransVerb False ; + OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ; IdRP = identRelPron ; FunRP = funRelPron ; @@ -135,6 +149,8 @@ lin ImperOne = imperUtterance singular ; ImperMany = imperUtterance plural ; + AdvS = advSentence ; + lin TwoS = twoSentence ; ConsS = consSentence ; @@ -161,12 +177,14 @@ lin PhrIP ip = ip ; PhrIAdv ia = ia ; + OnePhr p = p ; + ConsPhr = cc2 ; -lin INP = pronI ; ThouNP = pronYouSg ; HeNP = pronHe ; SheNP = pronShe ; + ItNP = pronIt ; WeNP = pronWe ; YeNP = pronYouPl ; YouNP = pronYouSg ; @@ -192,4 +210,10 @@ lin PhrYes = ss "Yes." ; PhrNo = ss "No." ; + + VeryAdv = ss "very" ; + TooAdv = ss "too" ; + OtherwiseAdv = ss "otherwise" ; + ThereforeAdv = ss "therefore" ; + } ; diff --git a/grammars/resource/english/Syntax.gf b/grammars/resource/english/Syntax.gf index 994b8722b..09969a28c 100644 --- a/grammars/resource/english/Syntax.gf +++ b/grammars/resource/english/Syntax.gf @@ -115,6 +115,14 @@ oper n = Pl } ; +-- Constructions like "the idea that two is even" are formed at the +-- first place as common nouns, so that one can also have "a suggestion that...". + + nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idea,x -> + {s = \\n,c => idea.s ! n ! c ++ "that" ++ x.s ; + g = idea.g + } ; + --2 Adjectives -- @@ -128,6 +136,7 @@ oper simpleAdjPhrase : Str -> AdjPhrase = \French -> adj2adjPhrase (simpleAdj French) ; + --3 Comparison adjectives -- -- Each of the comparison forms has a characteristic use: @@ -205,7 +214,7 @@ oper appFunComm : Function -> NounPhrase -> CommNounPhrase = \mother,john -> {s = \\n => table { - Gen => nonExist ; + Gen => nonExist ; --- ? _ => mother.s ! n ! Nom ++ mother.s2 ++ john.s ! GenSP } ; g = mother.g @@ -226,7 +235,7 @@ oper variants { defNounPhrase nf (appFunComm mother john) ; npGenDet nf john mother - } ; + } ; -- The commonest case is functions with the preposition "of". @@ -236,6 +245,17 @@ oper funOfReg : Str -> Gender -> Function = \mother,g -> funOf (nounReg mother ** {g = g}) ; +-- Two-place functions add one argument place. + + Function2 = Function ** {s3 : Preposition} ; + +-- There application starts by filling the first place. + + appFun2 : Function2 -> NounPhrase -> Function = \train, paris -> + {s = \\n,c => train.s ! n ! c ++ train.s2 ++ paris.s ! AccP ; + g = train.g ; + s2 = train.s3 + } ; --2 Verbs @@ -350,6 +370,46 @@ oper mkTransVerbDir : VerbP3 -> TransVerb = \love -> mkTransVerbPart love [] ; +-- 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 "he is swum", etc. +-- The syntax is the same as for adjectival predication. + + passVerb : Bool -> Verb -> VerbPhrase = \b,love -> + predAdjective b (adj2adjPhrase (ss (love.s ! PPart))) ; + +-- Transitive verbs can be used elliptically as verbs. The semantics +-- is left to applications. The definition is trivial, due to record +-- subtyping. + + transAsVerb : TransVerb -> Verb = \love -> + love ; + +-- *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} ; + + mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 -> + v ** {s3 = p1 ; s4 = p2} ; + + complDitransVerb : + Bool -> DitransVerb -> NounPhrase -> NounPhrase -> VerbPhrase = + \b,give,you,beer -> + let { + youbeer = give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP + } in + if_then_else VerbPhrase b + {s = give.s ; + s2 = \\_ => youbeer ; + isAux = False + } + {s = \\v => contractNot (verbP3Do.s ! v) ; + s2 = \\_ => give.s ! InfImp ++ youbeer ; + isAux = True + } ; + --2 Adverbials -- @@ -373,6 +433,11 @@ oper isAux = sings.isAux } ; + advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \very, good -> + {s = very.s ++ good.s ; + p = good.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 ("on", "at"). @@ -680,6 +745,14 @@ oper imperUtterance : Number -> Imperative -> Utterance = \n,I -> ss (I.s ! n ++ "!") ; +--2 Sentence adverbials +-- +-- This class covers adverbials such as "otherwise", "therefore", which are prefixed +-- to a sentence to form a phrase. + + advSentence : Adverb -> Sentence -> Utterance = \hence,itiseven -> + ss (hence.s ++ itiseven.s ++ ".") ; + --2 Coordination -- diff --git a/grammars/resource/english/TestEng.gf b/grammars/resource/english/TestEng.gf index 57d81d173..7e0391c2a 100644 --- a/grammars/resource/english/TestEng.gf +++ b/grammars/resource/english/TestEng.gf @@ -9,20 +9,27 @@ lin Small = adjDegrReg "small" ; Old = adjDegrReg "old" ; Young = adjDegrReg "young" ; + American = simpleAdj "American" ; + Finnish = simpleAdj "Finnish" ; + Married = simpleAdj "married" ** {s2 = "to"} ; Man = cnHum (mkNoun "man" "men" "man's" "men's") ; Woman = cnHum (mkNoun "woman" "women" "woman's" "women's") ; Car = cnNoHum (nounReg "car") ; House = cnNoHum (nounReg "house") ; Light = cnNoHum (nounReg "light") ; Walk = verbNoPart (regVerbP3 "walk") ; - Run = verbNoPart (regVerbP3 "run") ; - Say = verbNoPart (regVerbP3 "say") ; + Run = verbNoPart (mkVerb "run" "ran" "run") ; + Say = verbNoPart (mkVerb "say" "said" "said") ; Prove = verbNoPart (regVerbP3 "prove") ; - Send = mkTransVerbDir (regVerbP3 "send") ; - Love = mkTransVerbDir (regVerbP3 "love") ; - Wait = mkTransVerb (regVerbP3 "wait") "for" ; + Send = mkTransVerbDir (verbNoPart (mkVerb "send" "sent" "sent")) ; + Love = mkTransVerbDir (verbNoPart (verbP3e "love")) ; + Wait = mkTransVerb (verbNoPart (regVerbP3 "wait")) "for" ; + Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ; + Prefer = mkDitransVerb + (verbNoPart (mkVerb "prefer" "preferred" "preferred")) [] "to" ; Mother = funOfReg "mother" Hum ; Uncle = funOfReg "uncle" Hum ; + Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ; Always = advPre "always" ; Well = advPost "well" ; diff --git a/grammars/resource/english/Types.gf b/grammars/resource/english/Types.gf index a43ffd81b..dd6682882 100644 --- a/grammars/resource/english/Types.gf +++ b/grammars/resource/english/Types.gf @@ -55,12 +55,12 @@ oper --3 Verbs -- --- We limit the grammar so far to verbs in infinitive-imperative or present tense. +-- We treat the full conjugation now. -- The present tense is made to depend on person, which correspond to forms -- in the singular; plural forms are uniformly equal to the 2nd person singular. param - VForm = InfImp | Indic Person ; + VForm = InfImp | Indic Person | Past Number | PPart ; oper VerbP3 : Type = SS1 VForm ; diff --git a/grammars/resource/german/Morpho.gf b/grammars/resource/german/Morpho.gf index f286bc3b7..f62c2fcf5 100644 --- a/grammars/resource/german/Morpho.gf +++ b/grammars/resource/german/Morpho.gf @@ -396,4 +396,3 @@ oper -} } ; - diff --git a/grammars/resource/german/Paradigms.gf b/grammars/resource/german/Paradigms.gf index d31e3fecd..0562b544d 100644 --- a/grammars/resource/german/Paradigms.gf +++ b/grammars/resource/german/Paradigms.gf @@ -190,6 +190,11 @@ oper tvDir : V -> TV ; -- umbringen tvDirReg : Str -> TV ; -- lieben +-- Three-place verbs require two prepositions and cases. + + mkV3 : V -> Str -> Case -> Str -> Case -> TV ; -- geben,[],dative,[],accusative + + --2 Adverbials -- -- Adverbials for modifying verbs, adjectives, and sentences can be formed @@ -292,6 +297,7 @@ oper tvReg = \hören, zu, dat -> mkTV (vReg hören) zu dat ; tvDir = \v -> mkTV v [] accusative ; tvDirReg = \v -> tvReg v [] accusative ; + mkV3 = mkDitransVerb ; mkAdV = ss ; mkPP = prepPhrase ; diff --git a/grammars/resource/german/Predication.gf b/grammars/resource/german/Predication.gf index 9c05cc69b..283718498 100644 --- a/grammars/resource/german/Predication.gf +++ b/grammars/resource/german/Predication.gf @@ -13,16 +13,17 @@ 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" - 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" + 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 ; -- collective 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 ; -- collective noun: "John and Mary are lovers" + 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. @@ -42,9 +43,13 @@ oper -- Logical connectives on two sentences. - conjS : S -> S -> S ; - disjS : S -> S -> S ; - implS : S -> S -> S ; + 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. @@ -80,6 +85,8 @@ oper 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} ; --- 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 index dd2b160b3..871240cfb 100644 --- a/grammars/resource/german/ResDeu.gf +++ b/grammars/resource/german/ResDeu.gf @@ -46,7 +46,9 @@ lincat V = Verb ; -- = {s : VForm => Str ; s2 : Particle} ; VP = Verb ** {s3 : Number => Str} ; - TV = Verb ** {s3 : Preposition ; c : Case} ; + TV = TransVerb ; + -- = Verb ** {s3 : Preposition ; c : Case} ; + V3 = TransVerb ** {s4 : Preposition ; c2 : Case} ; VS = Verb ; AdV = {s : Str} ; @@ -110,6 +112,9 @@ lin NegNP = predNounPhrase False ; PosVS = complSentVerb True ; NegVS = complSentVerb False ; + PosV3 = complDitransVerb True ; + NegV3 = complDitransVerb False ; + VTrans = transAsVerb ; AdvVP = adVerbPhrase ; LocNP = locativeNounPhrase ; diff --git a/grammars/resource/german/Syntax.gf b/grammars/resource/german/Syntax.gf index 904cd1903..1d0a21e5f 100644 --- a/grammars/resource/german/Syntax.gf +++ b/grammars/resource/german/Syntax.gf @@ -29,7 +29,6 @@ oper n2n = noun2CommNounPhrase ; - --2 Noun phrases -- -- The worst case is pronouns, which have inflection in the possessive @@ -70,6 +69,26 @@ oper 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. @@ -77,14 +96,15 @@ oper Determiner : Type = {s : Gender => Case => Str ; n : Number ; a : Adjf} ; - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \ein, mann -> - {s = \\c => let {nc = caseNP c} in + 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"). @@ -400,6 +420,40 @@ oper s3 = \\_ => negation b ++ lieben.s ! VPart APred } ; +-- 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 + } + } ; + --2 Adverbials -- @@ -699,7 +753,7 @@ oper --2 Sentence adverbials -- --- This class covers adverbials such as "sonst", "folgelich", which are prefixed +-- 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 -> diff --git a/grammars/resource/german/TestDeu.gf b/grammars/resource/german/TestDeu.gf index e09b60d1f..b223714d0 100644 --- a/grammars/resource/german/TestDeu.gf +++ b/grammars/resource/german/TestDeu.gf @@ -9,6 +9,9 @@ lin 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" ; @@ -20,7 +23,11 @@ lin 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 ; + 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 **