diff --git a/src/english/ExtendEng.gf b/src/english/ExtendEng.gf index 44f944fd9..c2560268d 100644 --- a/src/english/ExtendEng.gf +++ b/src/english/ExtendEng.gf @@ -185,7 +185,7 @@ concrete ExtendEng of Extend = mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS { s = \\o,a => let - verb = vp.s ! t.t ! t.a ! p.p ! o ! a ; -- choice of Order determines aux or not + verb = mkVerbForms a vp ! t.t ! t.a ! p.p ! o ! a ; -- choice of Order determines aux or not compl = vp.s2 ! a ++ vp.ext in {fin = verb.aux ++ t.s ++ p.s ; inf = verb.adv ++ vp.ad ! a ++ verb.fin ++ verb.inf ++ vp.p ++ compl} ; @@ -288,16 +288,12 @@ lin BaseImp = twoTable2 CPolarity ImpForm ; let be = predAux auxBe ; ppt = vps.ptp - in { - s = be.s ; - p = [] ; - prp = be.prp ; - ptp = be.ptp ; - inf = be.inf ; - ad = \\_ => [] ; - s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent - isSimple = False ; - ext = vps.ext + in be ** { + p = [] ; + ad = \\_ => [] ; + s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent + isSimple = False ; + ext = vps.ext } ; lin diff --git a/src/english/ExtraEng.gf b/src/english/ExtraEng.gf index 248fb6665..24e5bd63f 100644 --- a/src/english/ExtraEng.gf +++ b/src/english/ExtraEng.gf @@ -75,7 +75,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 = mkVerbForms a vp ! t.t ! t.a ! p.p ! oDir ! a ; verbf = verb.aux ++ verb.adv ++ verb.fin ++ verb.inf ; in t.s ++ p.s ++ vp.ad ! a ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext } ; @@ -180,17 +180,13 @@ lin let be = predAux auxBe ; ppt = vps.ptp - in { - s = be.s ; - p = [] ; - prp = be.prp ; - ptp = be.ptp ; - inf = be.inf ; - ad = \\_ => [] ; - s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent - isSimple = False ; - ext = vps.ext - } ; + in be ** { + p = [] ; + ad = \\_ => [] ; + s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent + isSimple = False ; + ext = vps.ext + } ; lin PassVPSlash vps = passVPSlash vps [] ; @@ -242,7 +238,7 @@ lin let subj = np.s ! npNom ; agr = np.a ; - verb = vp.s ! t ! a ! b ! o ! agr ; + verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ; compl = vp.s2 ! agr in case o of { @@ -256,7 +252,7 @@ lin let subj = np.s ! npNom ; agr = np.a ; - verb = vp.s ! t ! a ! b ! o ! agr ; + verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ; compl = vp.s2 ! agr in case o of { diff --git a/src/english/IdiomEng.gf b/src/english/IdiomEng.gf index eefc0307b..be0fd811d 100644 --- a/src/english/IdiomEng.gf +++ b/src/english/IdiomEng.gf @@ -44,4 +44,3 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in { } ; } - diff --git a/src/english/ResEng.gf b/src/english/ResEng.gf index 7ea45ee49..1257ca98b 100644 --- a/src/english/ResEng.gf +++ b/src/english/ResEng.gf @@ -252,18 +252,59 @@ param Tense => Anteriority => CPolarity => Order => Agr => {aux, adv, fin, inf : Str} ; -- would, not, sleeps, slept - VP : Type = { - s : VerbForms ; - p : Str ; -- verb particle - prp : Str ; -- present participle - ptp : Str ; -- past participle - inf : Str ; -- the infinitive form ; VerbForms would be the logical place - ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr) - s2 : Agr => Str ; -- complement - ext : Str ; -- extreposed field such as S, QS, VP - isSimple : Bool -- regulates the place of participle used as adjective - } ; +{- IL 2022-04: reduce the fields in VP and make the grammar better suited for morphological analysis + All verbs except auxiliaries only need 6 forms inside VP, and other forms can be built in PredVP. + Auxiliaries need more forms. So we make VP an extension of Aux, and add a parameter that tells + which strategy to use when building a Cl: use the 4 forms, or use the fields in Aux. + (If we treat auxiliaries as normal verbs, we get "you don't be __" for "you aren't __".) + If we didn't care about morphological lexicon, we could just fill the Aux fields for all verbs: + morphologically distinct forms like "can't" for auxiliaries, and periphrastic constructions + like "doesn't sing/eat/play" for other verbs. However, then morphologically analysing the word + "doesn't" returns every single function that constructs a VP, which clutters morpho analysis. + + So we use two sets of fields and a parameter for which strategy to choose in PredVP. This results + in significantly fewer fields than previously, and is better for morphological analysis. +-} + VP : Type = { + -- The common parts + p : Str ; -- verb particle + ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr) + s2 : Agr => Str ; -- complement + ext : Str ; -- extreposed field such as S, QS, VP + prp : Str ; -- present participle + ptp : Str ; -- past participle + inf : Str ; -- the infinitive form + isSimple : Bool ; -- regulates the place of participle used as adjective + + -- The variable parts, depending on whether the main verb of the VP is auxiliary or not + isAux : Bool ; + auxForms : { -- nonExist when isAux=False + past, --# notpresent + contr, + pres : Polarity => Agr => Str ; + } ; + nonAuxForms : { -- nonExist when isAux=True + pres : Agr => Str ; -- sing/sings ; can be streamlined into two forms if needed + past : Str ; --# notpresent + } + } ; + + -- called from mkClause, when we finally put together all forms for a Cl + mkVerbForms : Agr -> VP -> VerbForms = \agr,vp -> case vp.isAux of { + True => + let aux : Aux = vp.auxForms ** { + inf = vp.inf ; + ppart = vp.ptp ; + prpart = vp.prp } ; + in auxVerbForms aux ; + False => + let fin : Str = vp.nonAuxForms.pres ! agr ; + inf : Str = vp.inf ; + part : Str = vp.ptp ; + in nonAuxVerbForms fin inf part + vp.nonAuxForms.past --# notpresent + } ; SlashVP = VP ** {c2 : Str ; gapInMiddle : Bool; @@ -276,20 +317,57 @@ param cBind : Str -> Str = \s -> Predef.BIND ++ ("'" + s) ; predV : Verb -> VP = \verb -> { - s = \\t,ant,b,ord,agr => - let - inf = verb.s ! VInf ; - fin = presVerb verb agr ; - part = verb.s ! VPPart ; - in - case of { + p = verb.p ; -- Common to all verbs + prp = verb.s ! VPresPart ; + ptp = verb.s ! VPPart ; + inf = verb.s ! VInf ; + ad = \\_ => [] ; + ext = [] ; + isSimple = True ; ---- but really depends on whether p == [] + s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] ; + + isAux = False ; -- Specific to non-Aux verbs + auxForms = { + contr, + past, --# notpresent + pres = \\_,_ => nonExist} ; + nonAuxForms = { + pres = \\agr => presVerb verb agr ; + past = verb.s ! VPast ; --# notpresent + } + } ; + + predAux : Aux -> VP = \aux -> { + p = [] ; -- Common to all verbs + prp = aux.prpart ; + ptp = aux.ppart ; + inf = aux.inf ; + ad = \\_ => [] ; + ext = [] ; + isSimple = True ; + s2 = \\_ => [] ; + + isAux = True ; -- Specific to Aux verbs + auxForms = aux ; + nonAuxForms = { + past = nonExist ; --# notpresent + pres = \\_ => nonExist} + } ; + + nonAuxVerbForms : (fin,inf,part : Str) -> + (past : Str) -> --# notpresent + VerbForms = \fin,inf,part + ,past --# notpresent + -> + \\tns,ant,pol,ord,agr => + case of { => 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 + => vff past [] ; --# notpresent => vf "did" inf ; --# notpresent => vfn c "did" "didn't" inf ; --# notpresent => vf (cBind "d") part ; --# notpresent @@ -314,18 +392,9 @@ param => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent => vfn c (does agr) (doesnt agr) inf } ; - p = verb.p ; - prp = verb.s ! VPresPart ; - ptp = verb.s ! VPPart ; - inf = verb.s ! VInf ; - ad = \\_ => [] ; - ext = [] ; - isSimple = True ; ---- but really depends on whether p == [] - s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] - } ; - predAux : Aux -> VP = \verb -> { - s = \\t,ant,cb,ord,agr => + auxVerbForms : Aux -> VerbForms = \verb -> + \\t,ant,cb,ord,agr => let b = case cb of { CPos => Pos ; @@ -371,17 +440,7 @@ param => vf fin [] ; => vfn c cfinp fin [] ; => vfn c finp fin [] - - } ; - p = [] ; - prp = verb.prpart ; - ptp = verb.ppart ; - inf = verb.inf ; - ad = \\_ => [] ; - ext = [] ; - isSimple = True ; - s2 = \\_ => [] - } ; + } ; vff : Str -> Str -> {aux, adv, fin, inf : Str} = \x,y -> {aux = [] ; adv = [] ; fin = x ; inf = y} ; @@ -569,7 +628,7 @@ param \subj,agr,vp -> { s = \\t,a,b,o => let - verb = vp.s ! t ! a ! b ! o ! agr ; + verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ; compl = vp.s2 ! agr ++ vp.ext in case o of {