From 490e5a4e8f5d27738714371fe94564ad3ea53f7f Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 16 Feb 2006 22:34:00 +0000 Subject: [PATCH] English auxiliaries and AdV --- lib/resource-1.0/english/CatEng.gf | 4 +- lib/resource-1.0/english/ParadigmsEng.gf | 6 ++- lib/resource-1.0/english/PhraseEng.gf | 4 +- lib/resource-1.0/english/ResEng.gf | 48 +++++++++++++++++++---- lib/resource-1.0/english/SentenceEng.gf | 11 +++--- lib/resource-1.0/english/StructuralEng.gf | 18 ++++++--- lib/resource-1.0/english/VerbEng.gf | 6 +-- 7 files changed, 72 insertions(+), 25 deletions(-) diff --git a/lib/resource-1.0/english/CatEng.gf b/lib/resource-1.0/english/CatEng.gf index b1b729c18..c505ddbed 100644 --- a/lib/resource-1.0/english/CatEng.gf +++ b/lib/resource-1.0/english/CatEng.gf @@ -36,6 +36,7 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in { VP = { s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ; + ad : Str ; s2 : Agr => Str } ; Comp = {s : Agr => Str} ; @@ -73,8 +74,9 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in { -- Open lexical classes, e.g. Lexicon V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ; - V2, VV, V2A = Verb ** {c2 : Str} ; + V2, V2A = Verb ** {c2 : Str} ; V3 = Verb ** {c2, c3 : Str} ; + VV = {s : VVForm => Str ; isAux : Bool} ; A = {s : AForm => Str} ; A2 = {s : AForm => Str ; c2 : Str} ; diff --git a/lib/resource-1.0/english/ParadigmsEng.gf b/lib/resource-1.0/english/ParadigmsEng.gf index 3a5006f46..0ca711c4d 100644 --- a/lib/resource-1.0/english/ParadigmsEng.gf +++ b/lib/resource-1.0/english/ParadigmsEng.gf @@ -42,7 +42,6 @@ oper human : Gender ; nonhuman : Gender ; masculine : Gender ; - feminite : Gender ; -- To abstract over number names, we define the following. @@ -439,7 +438,10 @@ oper dirdirV3 v = dirV3 v [] ; mkVS v = v ** {lock_VS = <>} ; - mkVV v = v ** {c2 = "to" ; lock_VV = <>} ; + mkVV v = { + s = table {VVF vf => v.s ! vf ; _ => variants {}} ; + isAux = False ; lock_VV = <> + } ; mkVQ v = v ** {lock_VQ = <>} ; V0 : Type = V ; diff --git a/lib/resource-1.0/english/PhraseEng.gf b/lib/resource-1.0/english/PhraseEng.gf index 328ac5949..0c46df574 100644 --- a/lib/resource-1.0/english/PhraseEng.gf +++ b/lib/resource-1.0/english/PhraseEng.gf @@ -1,4 +1,4 @@ -concrete PhraseEng of Phrase = CatEng ** open ResEng in { +concrete PhraseEng of Phrase = CatEng ** open Prelude, ResEng in { lin PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; @@ -11,7 +11,7 @@ concrete PhraseEng of Phrase = CatEng ** open ResEng in { UttIP ip = {s = ip.s ! Nom} ; --- Acc also UttIAdv iadv = iadv ; UttNP np = {s = np.s ! Acc} ; - UttVP vp = {s = "to" ++ infVP vp (agrP3 Sg)} ; + UttVP vp = {s = infVP False vp (agrP3 Sg)} ; UttAdv adv = adv ; NoPConj = {s = []} ; diff --git a/lib/resource-1.0/english/ResEng.gf b/lib/resource-1.0/english/ResEng.gf index 3a43688ee..95e7fd9e8 100644 --- a/lib/resource-1.0/english/ResEng.gf +++ b/lib/resource-1.0/english/ResEng.gf @@ -36,6 +36,10 @@ resource ResEng = ParamX ** open Prelude in { param VForm = VInf | VPres | VPast | VPPart | VPresPart ; +-- Auxiliary verbs have special negative forms. + + VVForm = VVF VForm | VVPresNeg | VVPastNeg ; + -- The order of sentence is needed already in $VP$. Order = ODir | OQuest ; @@ -159,9 +163,13 @@ resource ResEng = ParamX ** open Prelude in { VP : Type = { s : VerbForms ; + ad : Str ; s2 : Agr => Str } ; +--- The order gets wrong with AdV, but works around a parser +--- generation bug. + predV : Verb -> VP = \verb -> { s = \\t,ant,b,ord,agr => let @@ -173,12 +181,12 @@ resource ResEng = ParamX ** open Prelude in { {fin = x ; inf = y} ; in case of { - => vf fin [] ; + => vf fin [] ; --- should be opp => vf (does agr) inf ; => vf (doesnt agr) inf ; => vf (have agr) part ; => vf (havent agr) part ; - => vf past [] ; + => vf past [] ; --- should be opp => vf "did" inf ; => vf "didn't" inf ; => vf "had" part ; @@ -192,6 +200,7 @@ resource ResEng = ParamX ** open Prelude in { => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; + ad = [] ; s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] } ; @@ -221,25 +230,50 @@ resource ResEng = ParamX ** open Prelude in { => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; + ad = [] ; s2 = \\_ => [] } ; insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { s = vp.s ; + ad = vp.ad ; s2 = \\a => vp.s2 ! a ++ obj ! a } ; ---- This is not functional. +--- The adverb should be before the finite verb. insertAdV : Str -> VP -> VP = \adv,vp -> { s = vp.s ; - s2 = vp.s2 + ad = vp.ad ++ adv ; + s2 = \\a => vp.s2 ! a } ; +-- + + predVV : {s : VVForm => Str ; isAux : Bool} -> VP = \verb -> + let verbs = verb.s + in + case verb.isAux of { + True => predAux { + pres = table { + Pos => \\_ => verbs ! VVF VPres ; + Neg => \\_ => verbs ! VVPresNeg + } ; + past = table { + Pos => \\_ => verbs ! VVF VPast ; + Neg => \\_ => verbs ! VVPastNeg + } ; + inf = verbs ! VVF VInf ; + ppart = verbs ! VVF VPPart + } ; + _ => predV {s = \\vf => verbs ! VVF vf ; isRefl = False} + } ; + presVerb : {s : VForm => Str} -> Agr -> Str = \verb -> agrVerb (verb.s ! VPres) (verb.s ! VInf) ; - infVP : VP -> Agr -> Str = \vp,a -> + infVP : Bool -> VP -> Agr -> Str = \isAux,vp,a -> + if_then_Str isAux [] "to" ++ (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ; agrVerb : Str -> Str -> Agr -> Str = \has,have,agr -> @@ -299,8 +333,8 @@ resource ResEng = ParamX ** open Prelude in { compl = vp.s2 ! agr in case o of { - ODir => subj ++ verb.fin ++ verb.inf ++ compl ; - OQuest => verb.fin ++ subj ++ verb.inf ++ compl + ODir => subj ++ verb.fin ++ vp.ad ++ verb.inf ++ compl ; + OQuest => verb.fin ++ subj ++ vp.ad ++ verb.inf ++ compl } } ; diff --git a/lib/resource-1.0/english/SentenceEng.gf b/lib/resource-1.0/english/SentenceEng.gf index 6b3ac5ac7..1588393cc 100644 --- a/lib/resource-1.0/english/SentenceEng.gf +++ b/lib/resource-1.0/english/SentenceEng.gf @@ -1,4 +1,4 @@ -concrete SentenceEng of Sentence = CatEng ** open ResEng in { +concrete SentenceEng of Sentence = CatEng ** open Prelude, ResEng in { flags optimize=all_subs ; @@ -12,7 +12,7 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in { s = \\pol,n => let agr = {n = n ; p = P2} ; - verb = infVP vp agr ; + verb = infVP True vp agr ; dont = case pol of { Neg => "don't" ; _ => [] @@ -25,8 +25,9 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in { mkClause (np.s ! Nom) np.a (predV v2) ** {c2 = v2.c2} ; SlashVVV2 np vv v2 = - mkClause (np.s ! Nom) np.a (insertObj (\\_ => "to" ++ v2.s ! VInf) (predV vv)) ** - {c2 = v2.c2} ; + mkClause (np.s ! Nom) np.a + (insertObj (\\a => infVP vv.isAux (predV v2) a) (predVV vv)) ** + {c2 = v2.c2} ; AdvSlash slash adv = { s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; @@ -37,7 +38,7 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in { EmbedS s = {s = conjThat ++ s.s} ; EmbedQS qs = {s = qs.s ! QIndir} ; - EmbedVP vp = {s = "to" ++ infVP vp (agrP3 Sg)} ; --- agr + EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr UseCl t a p cl = {s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! ODir} ; UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ; diff --git a/lib/resource-1.0/english/StructuralEng.gf b/lib/resource-1.0/english/StructuralEng.gf index b75cdc554..fb4979ae3 100644 --- a/lib/resource-1.0/english/StructuralEng.gf +++ b/lib/resource-1.0/english/StructuralEng.gf @@ -1,5 +1,5 @@ concrete StructuralEng of Structural = CatEng ** - open MorphoEng, Prelude in { + open MorphoEng, (P = ParadigmsEng), Prelude in { flags optimize=all ; @@ -19,8 +19,11 @@ concrete StructuralEng of Structural = CatEng ** but_PConj = ss "but" ; by8agent_Prep = ss "by" ; by8means_Prep = ss "by" ; - can8know_VV = verbPart (mkVerbIrreg "know" "knew" "known") "how"** {c2 = "to"} ;--- - can_VV = verbGen "manage" ** {c2 = "to"} ; --- + can8know_VV, can_VV = { + s = table VVForm [["be able to"] ; "can" ; "could" ; + ["been able to"] ; ["being able to"] ; "can't" ; "couldn't"] ; + isAux = True + } ; during_Prep = ss "during" ; either7or_DConj = sd2 "either" "or" ** {n = Sg} ; everybody_NP = regNP "everybody" Sg ; @@ -45,7 +48,11 @@ concrete StructuralEng of Structural = CatEng ** more_CAdv = ss "more" ; most_Predet = ss "most" ; much_Det = mkDeterminer Sg "much" ; - must_VV = mkVerb4 "have" "has" "had" "had" ** {c2 = "to"} ; --- + must_VV = { + s = table VVForm [["be have to"] ; "must" ; ["had to"] ; + ["had to"] ; ["having to"] ; "mustn't" ; ["hadn't to"]] ; ---- + isAux = True + } ; no_Phr = ss "no" ; on_Prep = ss "on" ; one_Quant = mkDeterminer Sg "one" ; @@ -69,6 +76,7 @@ concrete StructuralEng of Structural = CatEng ** there7to_Adv = ss "there" ; there7from_Adv = ss ["from there"] ; therefore_PConj = ss "therefore" ; + these_NP = regNP "these" Pl ; they_Pron = mkNP "they" "them" "their" Pl P3 ; this_Quant = mkQuant "this" "these" ; this_NP = regNP "this" Sg ; @@ -78,7 +86,7 @@ concrete StructuralEng of Structural = CatEng ** to_Prep = ss "to" ; under_Prep = ss "under" ; very_AdA = ss "very" ; - want_VV = verbGen "want" ** {c2 = "to"} ; + want_VV = P.mkVV (P.regV "want") ; we_Pron = mkNP "we" "us" "our" Pl P1 ; whatPl_IP = mkIP "what" "what" "what's" Sg ; whatSg_IP = mkIP "what" "what" "what's" Sg ; diff --git a/lib/resource-1.0/english/VerbEng.gf b/lib/resource-1.0/english/VerbEng.gf index a8f840849..230c04fe3 100644 --- a/lib/resource-1.0/english/VerbEng.gf +++ b/lib/resource-1.0/english/VerbEng.gf @@ -8,7 +8,8 @@ concrete VerbEng of Verb = CatEng ** open ResEng in { ComplV3 v np np2 = insertObj (\\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc) (predV v) ; - ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ; + ComplVV v vp = insertObj (\\a => infVP v.isAux vp a) (predVV v) ; + ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; @@ -20,8 +21,7 @@ concrete VerbEng of Verb = CatEng ** open ResEng in { AdvVP vp adv = insertObj (\\_ => adv.s) vp ; ---- This rule destroys parsing... ----- AdVVP adv vp = insertAdV adv.s vp ; + AdVVP adv vp = insertAdV adv.s vp ; ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;