From 302e2d3ebd224611ff68d6fe2ca2f4eced07f9e4 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 3 Dec 2013 13:54:57 +0000 Subject: [PATCH] introduced contracted auxiliaries in English. So far only available internally in the tables created from Cl. TODO: make them accessible on top level in Extra; use them as variants in Parse. Also the use in QCl needs some more work: we can say "he's here", "I'm here", "where's he" but not "'s he here", "where'm I". --- lib/src/english/CatEng.gf | 2 +- lib/src/english/ExtraEng.gf | 8 +- lib/src/english/ParseEng.gf | 4 +- lib/src/english/QuestionEng.gf | 6 +- lib/src/english/RelativeEng.gf | 6 +- lib/src/english/ResEng.gf | 126 +++++++++++++++++++++---------- lib/src/english/SentenceEng.gf | 4 +- lib/src/english/StructuralEng.gf | 2 +- 8 files changed, 103 insertions(+), 55 deletions(-) diff --git a/lib/src/english/CatEng.gf b/lib/src/english/CatEng.gf index d02235b7f..cd58eeb00 100644 --- a/lib/src/english/CatEng.gf +++ b/lib/src/english/CatEng.gf @@ -127,7 +127,7 @@ concrete CatEng of Cat = CommonX - [Pol] ** open ResEng, Prelude in { linref SSlash = \ss -> ss.s ++ ss.c2 ; - ClSlash = \cls -> cls.s ! Pres ! Simul ! CPos ! ODir ++ cls.c2 ; + ClSlash = \cls -> cls.s ! Pres ! Simul ! CPos ! oDir ++ cls.c2 ; VP = \vp -> infVP VVAux vp Simul CPos (agrP3 Sg) ; VPSlash = \vps -> infVP VVAux vps Simul CPos (agrP3 Sg) ++ vps.c2; diff --git a/lib/src/english/ExtraEng.gf b/lib/src/english/ExtraEng.gf index b20c980fa..b7c2d036f 100644 --- a/lib/src/english/ExtraEng.gf +++ b/lib/src/english/ExtraEng.gf @@ -15,11 +15,11 @@ concrete ExtraEng of ExtraEngAbs = CatEng ** StrandRelSlash rp slash = { s = \\t,a,p,ag => - rp.s ! RC (fromAgr ag).g NPAcc ++ slash.s ! t ! a ! p ! ODir ++ slash.c2 ; + rp.s ! RC (fromAgr ag).g NPAcc ++ slash.s ! t ! a ! p ! oDir ++ slash.c2 ; c = NPAcc } ; EmptyRelSlash slash = { - s = \\t,a,p,_ => slash.s ! t ! a ! p ! ODir ++ slash.c2 ; + s = \\t,a,p,_ => slash.s ! t ! a ! p ! oDir ++ slash.c2 ; c = NPAcc } ; @@ -77,7 +77,7 @@ concrete ExtraEng of ExtraEngAbs = CatEng ** MkVPS t p vp = { s = \\a => let - verb = vp.s ! t.t ! t.a ! p.p ! ODir ! a ; + verb = vp.s ! t.t ! t.a ! p.p ! oDir ! a ; verbf = verb.aux ++ verb.adv ++ verb.fin ++ verb.inf ; in t.s ++ p.s ++ vp.ad ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext } ; @@ -187,7 +187,7 @@ lin --- obsolete: use UncNeg : Pol UncNegCl t p cl = { - s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! unc p.p ! ODir + s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! unc p.p ! oDir } ; UncNegQCl t p cl = { s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! unc p.p ! q diff --git a/lib/src/english/ParseEng.gf b/lib/src/english/ParseEng.gf index ce09fc379..9a2306506 100644 --- a/lib/src/english/ParseEng.gf +++ b/lib/src/english/ParseEng.gf @@ -90,7 +90,7 @@ lin compl = vp.s2 ! np.a in case o of { - ODir => compl ++ frontComma ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ; + ODir _ => compl ++ frontComma ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ; OQuest => verb.aux ++ compl ++ frontComma ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf } } ; @@ -102,7 +102,7 @@ lin compl = vp.s2 ! np.a in case o of { - ODir => compl ++ frontComma ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ; + ODir _ => compl ++ frontComma ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ; OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom } } ; diff --git a/lib/src/english/QuestionEng.gf b/lib/src/english/QuestionEng.gf index 861d2100b..26666a5af 100644 --- a/lib/src/english/QuestionEng.gf +++ b/lib/src/english/QuestionEng.gf @@ -9,13 +9,13 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in { let cls = cl.s ! t ! a ! p in table { QDir => cls ! OQuest ; - QIndir => "if" ++ cls ! ODir + QIndir => "if" ++ cls ! oDir ---- } ---- "whether" in ExtEng } ; QuestVP qp vp = let cl = mkClause (qp.s ! npNom) (agrP3 qp.n) vp - in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; + in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! oDir} ; ---- QuestSlash ip slash = mkQuestion (ss (slash.c2 ++ ip.s ! NPAcc)) slash ; @@ -63,7 +63,7 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in { QuestQVP qp vp = let cl = mkClause (qp.s ! npNom) (agrP3 qp.n) vp - in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; + in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! oDir} ; ---- } diff --git a/lib/src/english/RelativeEng.gf b/lib/src/english/RelativeEng.gf index 8b799e712..28c8b8ec2 100644 --- a/lib/src/english/RelativeEng.gf +++ b/lib/src/english/RelativeEng.gf @@ -5,7 +5,7 @@ concrete RelativeEng of Relative = CatEng ** open ResEng in { lin RelCl cl = { - s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ; + s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! oDir ; c = npNom } ; @@ -18,7 +18,7 @@ concrete RelativeEng of Relative = CatEng ** open ResEng in { } ; cl = mkClause (rp.s ! RC (fromAgr agr).g npNom) agr vp in - cl.s ! t ! ant ! b ! ODir ; + cl.s ! t ! ant ! b ! oDir ; c = npNom } ; @@ -28,7 +28,7 @@ concrete RelativeEng of Relative = CatEng ** open ResEng in { RelSlash rp slash = { s = \\t,a,p,agr => - slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! ODir ; + slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! oDir ; c = NPAcc } ; diff --git a/lib/src/english/ResEng.gf b/lib/src/english/ResEng.gf index d2868c9de..c8ab2fe3e 100644 --- a/lib/src/english/ResEng.gf +++ b/lib/src/english/ResEng.gf @@ -64,12 +64,18 @@ resource ResEng = ParamX ** open Prelude in { | VVPastNeg --# notpresent ; --- The order of sentence is needed already in $VP$. +-- The order of sentence is needed already in $VP$ because the need of "do" depends on it. +-- $ODir True$ means contracted forms ("'s", "'d", "'ve". "'re"). +-- Notice that inverted forms ($OQuest$) don't allow verb contractions: *"'s he arrived". - Order = ODir | OQuest ; + Order = ODir Bool | OQuest ; + +oper + oDir = ODir False ; -- The type of complement of a VV +param VVType = VVAux | VVInf | VVPresPart ; -- can do / try to do / start doing --2 For $Adjective$ @@ -240,6 +246,8 @@ resource ResEng = ParamX ** open Prelude in { predVc : (Verb ** {c2 : Str}) -> SlashVP = \verb -> predV verb ** {c2 = verb.c2 ; gapInMiddle = True} ; + cBind : Str -> Str = \s -> Predef.BIND ++ ("'" + s) ; + predV : Verb -> VP = \verb -> { s = \\t,ant,b,ord,agr => let @@ -248,24 +256,36 @@ resource ResEng = ParamX ** open Prelude in { part = verb.s ! VPPart ; in case of { - => vff fin [] ; - => vf (does agr) inf ; - => vf (have agr) part ; --# notpresent - => vfn c (have agr) (havent agr) part ; --# notpresent - => vff (verb.s ! VPast) [] ; --# notpresent - => vf "did" inf ; --# notpresent - => vfn c "did" "didn't" inf ; --# notpresent - => vf "had" part ; --# notpresent - => vfn c "had" "hadn't" part ; --# notpresent - => vf "will" inf ; --# notpresent - => vfn c "will" "won't" inf ; --# notpresent - => vf "will" ("have" ++ part) ; --# notpresent - => vfn c "will" "won't"("have" ++ part) ; --# notpresent - => vf "would" inf ; --# notpresent - => vfn c "would" "wouldn't" inf ; --# notpresent - => vf "would" ("have" ++ part) ; --# notpresent - => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent - => vfn c (does agr) (doesnt agr) inf + => vff fin [] ; + => vf (does agr) inf ; + => vf (haveContr agr) part ; --# notpresent + => vf (have agr) part ; --# notpresent + => vfn c (haveContr agr) (haventContr agr) part ; --# notpresent + => vfn c (have agr) (havent agr) part ; --# notpresent + => vff (verb.s ! VPast) [] ; --# notpresent + => vf "did" inf ; --# notpresent + => vfn c "did" "didn't" inf ; --# notpresent + => vf (cBind "d") part ; --# notpresent + => vf "had" part ; --# notpresent + => vfn c (cBind "d") (cBind "d not") part ; --# notpresent + => vfn c "had" "hadn't" part ; --# notpresent + => vf (cBind "ll") inf ; --# notpresent + => vf "will" inf ; --# notpresent + => vfn c (cBind "ll") (cBind "ll not") inf ; --# notpresent + => vfn c "will" "won't" inf ; --# notpresent + => vf (cBind "ll") ("have" ++ part) ; --# notpresent + => vf "will" ("have" ++ part) ; --# notpresent + => vfn c (cBind "ll") (cBind "ll not") ("have" ++ part) ; --# notpresent + => vfn c "will" "won't" ("have" ++ part) ; --# notpresent + => vf (cBind "d") inf ; --# notpresent + => vf "would" inf ; --# notpresent + => vfn c (cBind "d") (cBind "d not") inf ; --# notpresent + => vfn c "would" "wouldn't" inf ; --# notpresent + => vf (cBind "d") ("have" ++ part) ; --# notpresent + => vf "would" ("have" ++ part) ; --# notpresent + => vfn c (cBind "d") (cBind "d not") ("have" ++ part) ; --# notpresent + => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent + => vfn c (does agr) (doesnt agr) inf } ; p = verb.p ; prp = verb.s ! VPresPart ; @@ -286,25 +306,44 @@ resource ResEng = ParamX ** open Prelude in { inf = verb.inf ; fin = verb.pres ! b ! agr ; finp = verb.pres ! Pos ! agr ; + cfin = verb.contr ! b ! agr ; + cfinp = verb.contr ! Pos ! agr ; part = verb.ppart ; in case of { - => vf (have agr) part ; --# notpresent - => vfn c (have agr) (havent agr) part ; --# notpresent + => vf (haveContr agr) part ; --# notpresent + => vf (have agr) part ; --# notpresent + => vfn c (haveContr agr) (haventContr agr) part ; --# notpresent + => vfn c (have agr) (havent agr) part ; --# notpresent + + => vf (cBind "d") part ; --# notpresent + => vf "had" part ; --# notpresent + => vfn c (cBind "d") (cBind "d not") part ; --# notpresent + => vfn c "had" "hadn't" part ; --# notpresent + => vf (cBind "ll") inf ; --# notpresent + => vf "will" inf ; --# notpresent + => vfn c (cBind "ll") (cBind "ll not") inf ; --# notpresent + => vfn c "will" "won't" inf ; --# notpresent + => vf (cBind "ll") ("have" ++ part) ; --# notpresent + => vf "will" ("have" ++ part) ; --# notpresent + => vfn c (cBind "ll") (cBind "ll not") ("have" ++ part) ; --# notpresent + => vfn c "will" "won't"("have" ++ part) ; --# notpresent + => vf (cBind "d") inf ; --# notpresent + => vf "would" inf ; --# notpresent + => vfn c (cBind "d") (cBind "d not") inf ; --# notpresent + => vfn c "would" "wouldn't" inf ; --# notpresent + => vf (cBind "d") ("have" ++ part) ; --# notpresent + => vf "would" ("have" ++ part) ; --# notpresent + => vfn c (cBind "d") (cBind "d not") ("have" ++ part) ; --# notpresent + => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent + => vf (verb.past ! b ! agr) [] ; --# notpresent => vfn c (verb.past!Pos!agr)(verb.past!Neg!agr) [] ; --# notpresent - => vf "had" part ; --# notpresent - => vfn c "had" "hadn't" part ; --# notpresent - => vf "will" inf ; --# notpresent - => vfn c "will" "won't" inf ; --# notpresent - => vf "will" ("have" ++ part) ; --# notpresent - => vfn c "will" "won't"("have" ++ part) ; --# notpresent - => vf "would" inf ; --# notpresent - => vfn c "would" "wouldn't" inf ; --# notpresent - => vf "would" ("have" ++ part) ; --# notpresent - => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent - => vf fin [] ; - => vfn c finp fin [] + => vf cfin [] ; + => vf fin [] ; + => vfn c cfinp fin [] ; + => vfn c finp fin [] + } ; p = [] ; prp = verb.prpart ; @@ -397,7 +436,7 @@ resource ResEng = ParamX ** open Prelude in { in case verb.typ of { VVAux => predAux { - pres = table { + pres,contr = table { Pos => \\_ => verbs ! VVF VPres ; Neg => \\_ => verbs ! VVPresNeg } ; @@ -443,9 +482,13 @@ resource ResEng = ParamX ** open Prelude in { does = agrVerb "does" "do" ; doesnt = agrVerb "doesn't" "don't" ; + haveContr = agrVerb (cBind "s") (cBind "ve") ; + haventContr = agrVerb (cBind "s not") (cBind "ve not") ; + Aux = { - pres : Polarity => Agr => Str ; - past : Polarity => Agr => Str ; --# notpresent + pres : Polarity => Agr => Str ; + contr : Polarity => Agr => Str ; -- contracted forms + past : Polarity => Agr => Str ; --# notpresent inf,ppart,prpart : Str } ; @@ -455,6 +498,11 @@ resource ResEng = ParamX ** open Prelude in { => ["am not"] ; --- am not I _ => agrVerb (posneg b "is") (posneg b "are") a } ; + contr = \\b,a => case of { + => cBind "m" ; + => cBind "m not" ; --- am not I + _ => agrVerb (posneg b (cBind "s")) (posneg b (cBind "re")) a + } ; past = \\b,a => case a of { --# notpresent AgP1 Sg | AgP3Sg _ => posneg b "was" ; --# notpresent _ => (posneg b "were") --# notpresent @@ -496,7 +544,7 @@ resource ResEng = ParamX ** open Prelude in { compl = vp.s2 ! agr ++ vp.ext in case o of { - ODir => subj ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ vp.p ++ compl ; + ODir _ => subj ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ vp.p ++ compl ; OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ vp.p ++ compl } } ; @@ -539,7 +587,7 @@ resource ResEng = ParamX ** open Prelude in { why = wh.s in table { QDir => why ++ cls ! OQuest ; - QIndir => why ++ cls ! ODir + QIndir => why ++ cls ! oDir ---- enable "why he's here" } } ; diff --git a/lib/src/english/SentenceEng.gf b/lib/src/english/SentenceEng.gf index 625c3295b..ee44e0684 100644 --- a/lib/src/english/SentenceEng.gf +++ b/lib/src/english/SentenceEng.gf @@ -42,7 +42,7 @@ concrete SentenceEng of Sentence = CatEng ** open Prelude, ResEng in { EmbedVP vp = {s = infVP VVInf vp Simul CPos (agrP3 Sg)} ; --- agr UseCl t p cl = { - s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! ODir + s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! oDir } ; UseQCl t p cl = { s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! q @@ -52,7 +52,7 @@ concrete SentenceEng of Sentence = CatEng ** open Prelude, ResEng in { c = cl.c } ; UseSlash t p cl = { - s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! ODir ; + s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! oDir ; c2 = cl.c2 } ; diff --git a/lib/src/english/StructuralEng.gf b/lib/src/english/StructuralEng.gf index d6e91cfa5..c0bc6a03d 100644 --- a/lib/src/english/StructuralEng.gf +++ b/lib/src/english/StructuralEng.gf @@ -29,7 +29,7 @@ concrete StructuralEng of Structural = CatEng ** VVF VPresPart => ["being able to"] ; VVF VPast => "could" ; --# notpresent VVPastNeg => "couldn't" ; --# notpresent - VVPresNeg => "can't" + VVPresNeg => "can't" | "cannot" ---- shouldn't be a variant, but replace "can not" } ; p = [] ; typ = VVAux