mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
(Eng) Move VP's inflection table into Cl
* Replaces 1300 fields with 50 fields + one new 2-valued parameter * Only construct the full table with Tense,Ant,Pol… in Cl
This commit is contained in:
@@ -185,7 +185,7 @@ concrete ExtendEng of Extend =
|
|||||||
mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {
|
mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {
|
||||||
s = \\o,a =>
|
s = \\o,a =>
|
||||||
let
|
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
|
compl = vp.s2 ! a ++ vp.ext
|
||||||
in {fin = verb.aux ++ t.s ++ p.s ;
|
in {fin = verb.aux ++ t.s ++ p.s ;
|
||||||
inf = verb.adv ++ vp.ad ! a ++ verb.fin ++ verb.inf ++ vp.p ++ compl} ;
|
inf = verb.adv ++ vp.ad ! a ++ verb.fin ++ verb.inf ++ vp.p ++ compl} ;
|
||||||
@@ -288,12 +288,8 @@ lin BaseImp = twoTable2 CPolarity ImpForm ;
|
|||||||
let
|
let
|
||||||
be = predAux auxBe ;
|
be = predAux auxBe ;
|
||||||
ppt = vps.ptp
|
ppt = vps.ptp
|
||||||
in {
|
in be ** {
|
||||||
s = be.s ;
|
|
||||||
p = [] ;
|
p = [] ;
|
||||||
prp = be.prp ;
|
|
||||||
ptp = be.ptp ;
|
|
||||||
inf = be.inf ;
|
|
||||||
ad = \\_ => [] ;
|
ad = \\_ => [] ;
|
||||||
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
|
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
|
||||||
isSimple = False ;
|
isSimple = False ;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ concrete ExtraEng of ExtraEngAbs = CatEng **
|
|||||||
MkVPS t p vp = {
|
MkVPS t p vp = {
|
||||||
s = \\a =>
|
s = \\a =>
|
||||||
let
|
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 ;
|
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
|
in t.s ++ p.s ++ vp.ad ! a ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext
|
||||||
} ;
|
} ;
|
||||||
@@ -180,12 +180,8 @@ lin
|
|||||||
let
|
let
|
||||||
be = predAux auxBe ;
|
be = predAux auxBe ;
|
||||||
ppt = vps.ptp
|
ppt = vps.ptp
|
||||||
in {
|
in be ** {
|
||||||
s = be.s ;
|
|
||||||
p = [] ;
|
p = [] ;
|
||||||
prp = be.prp ;
|
|
||||||
ptp = be.ptp ;
|
|
||||||
inf = be.inf ;
|
|
||||||
ad = \\_ => [] ;
|
ad = \\_ => [] ;
|
||||||
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
|
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
|
||||||
isSimple = False ;
|
isSimple = False ;
|
||||||
@@ -242,7 +238,7 @@ lin
|
|||||||
let
|
let
|
||||||
subj = np.s ! npNom ;
|
subj = np.s ! npNom ;
|
||||||
agr = np.a ;
|
agr = np.a ;
|
||||||
verb = vp.s ! t ! a ! b ! o ! agr ;
|
verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ;
|
||||||
compl = vp.s2 ! agr
|
compl = vp.s2 ! agr
|
||||||
in
|
in
|
||||||
case o of {
|
case o of {
|
||||||
@@ -256,7 +252,7 @@ lin
|
|||||||
let
|
let
|
||||||
subj = np.s ! npNom ;
|
subj = np.s ! npNom ;
|
||||||
agr = np.a ;
|
agr = np.a ;
|
||||||
verb = vp.s ! t ! a ! b ! o ! agr ;
|
verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ;
|
||||||
compl = vp.s2 ! agr
|
compl = vp.s2 ! agr
|
||||||
in
|
in
|
||||||
case o of {
|
case o of {
|
||||||
|
|||||||
@@ -44,4 +44,3 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -252,18 +252,59 @@ param
|
|||||||
Tense => Anteriority => CPolarity => Order => Agr =>
|
Tense => Anteriority => CPolarity => Order => Agr =>
|
||||||
{aux, adv, fin, inf : Str} ; -- would, not, sleeps, slept
|
{aux, adv, fin, inf : Str} ; -- would, not, sleeps, slept
|
||||||
|
|
||||||
|
{- 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 = {
|
VP : Type = {
|
||||||
s : VerbForms ;
|
-- The common parts
|
||||||
p : Str ; -- verb particle
|
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)
|
ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr)
|
||||||
s2 : Agr => Str ; -- complement
|
s2 : Agr => Str ; -- complement
|
||||||
ext : Str ; -- extreposed field such as S, QS, VP
|
ext : Str ; -- extreposed field such as S, QS, VP
|
||||||
isSimple : Bool -- regulates the place of participle used as adjective
|
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 ;
|
SlashVP = VP ** {c2 : Str ;
|
||||||
gapInMiddle : Bool;
|
gapInMiddle : Bool;
|
||||||
@@ -276,20 +317,57 @@ param
|
|||||||
cBind : Str -> Str = \s -> Predef.BIND ++ ("'" + s) ;
|
cBind : Str -> Str = \s -> Predef.BIND ++ ("'" + s) ;
|
||||||
|
|
||||||
predV : Verb -> VP = \verb -> {
|
predV : Verb -> VP = \verb -> {
|
||||||
s = \\t,ant,b,ord,agr =>
|
p = verb.p ; -- Common to all verbs
|
||||||
let
|
prp = verb.s ! VPresPart ;
|
||||||
|
ptp = verb.s ! VPPart ;
|
||||||
inf = verb.s ! VInf ;
|
inf = verb.s ! VInf ;
|
||||||
fin = presVerb verb agr ;
|
ad = \\_ => [] ;
|
||||||
part = verb.s ! VPPart ;
|
ext = [] ;
|
||||||
in
|
isSimple = True ; ---- but really depends on whether p == []
|
||||||
case <t,ant,b,ord> of {
|
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 <tns,ant,pol,ord> of {
|
||||||
<Pres,Simul,CPos,ODir _> => vff fin [] ;
|
<Pres,Simul,CPos,ODir _> => vff fin [] ;
|
||||||
<Pres,Simul,CPos,OQuest> => vf (does agr) inf ;
|
<Pres,Simul,CPos,OQuest> => vf (does agr) inf ;
|
||||||
<Pres,Anter,CPos,ODir True> => vf (haveContr agr) part ; --# notpresent
|
<Pres,Anter,CPos,ODir True> => vf (haveContr agr) part ; --# notpresent
|
||||||
<Pres,Anter,CPos,_> => vf (have agr) part ; --# notpresent
|
<Pres,Anter,CPos,_> => vf (have agr) part ; --# notpresent
|
||||||
<Pres,Anter,CNeg c,ODir True> => vfn c (haveContr agr) (haventContr agr) part ; --# notpresent
|
<Pres,Anter,CNeg c,ODir True> => vfn c (haveContr agr) (haventContr agr) part ; --# notpresent
|
||||||
<Pres,Anter,CNeg c,_> => vfn c (have agr) (havent agr) part ; --# notpresent
|
<Pres,Anter,CNeg c,_> => vfn c (have agr) (havent agr) part ; --# notpresent
|
||||||
<Past,Simul,CPos,ODir _> => vff (verb.s ! VPast) [] ; --# notpresent
|
<Past,Simul,CPos,ODir _> => vff past [] ; --# notpresent
|
||||||
<Past,Simul,CPos,OQuest> => vf "did" inf ; --# notpresent
|
<Past,Simul,CPos,OQuest> => vf "did" inf ; --# notpresent
|
||||||
<Past,Simul,CNeg c,_> => vfn c "did" "didn't" inf ; --# notpresent
|
<Past,Simul,CNeg c,_> => vfn c "did" "didn't" inf ; --# notpresent
|
||||||
<Past,Anter,CPos,ODir True> => vf (cBind "d") part ; --# notpresent
|
<Past,Anter,CPos,ODir True> => vf (cBind "d") part ; --# notpresent
|
||||||
@@ -314,18 +392,9 @@ param
|
|||||||
<Cond,Anter,CNeg c,_> => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent
|
<Cond,Anter,CNeg c,_> => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent
|
||||||
<Pres,Simul,CNeg c,_> => vfn c (does agr) (doesnt agr) inf
|
<Pres,Simul,CNeg c,_> => 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 -> {
|
auxVerbForms : Aux -> VerbForms = \verb ->
|
||||||
s = \\t,ant,cb,ord,agr =>
|
\\t,ant,cb,ord,agr =>
|
||||||
let
|
let
|
||||||
b = case cb of {
|
b = case cb of {
|
||||||
CPos => Pos ;
|
CPos => Pos ;
|
||||||
@@ -371,16 +440,6 @@ param
|
|||||||
<Pres,Simul,CPos, _> => vf fin [] ;
|
<Pres,Simul,CPos, _> => vf fin [] ;
|
||||||
<Pres,Simul,CNeg c,ODir True> => vfn c cfinp fin [] ;
|
<Pres,Simul,CNeg c,ODir True> => vfn c cfinp fin [] ;
|
||||||
<Pres,Simul,CNeg c, _> => vfn c finp fin []
|
<Pres,Simul,CNeg c, _> => 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 ->
|
vff : Str -> Str -> {aux, adv, fin, inf : Str} = \x,y ->
|
||||||
@@ -569,7 +628,7 @@ param
|
|||||||
\subj,agr,vp -> {
|
\subj,agr,vp -> {
|
||||||
s = \\t,a,b,o =>
|
s = \\t,a,b,o =>
|
||||||
let
|
let
|
||||||
verb = vp.s ! t ! a ! b ! o ! agr ;
|
verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ;
|
||||||
compl = vp.s2 ! agr ++ vp.ext
|
compl = vp.s2 ! agr ++ vp.ext
|
||||||
in
|
in
|
||||||
case o of {
|
case o of {
|
||||||
|
|||||||
Reference in New Issue
Block a user