forked from GitHub/gf-rgl
(Som) Use PrepCombination in VP instead of c2,c3 : Preposition
This commit is contained in:
@@ -202,28 +202,28 @@ param
|
|||||||
| Single Preposition ;
|
| Single Preposition ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
combine : (isPassive : Bool) -> Preposition -> Preposition -> PrepCombination = \isPass,p1,p2 ->
|
combine : Preposition -> Preposition -> PrepCombination = \p1,p2 ->
|
||||||
let oneWay : Preposition => Preposition => PrepCombination =
|
let oneWay : Preposition => Preposition => PrepCombination = \\x,y =>
|
||||||
\\x,y => case <isPass,x,y> of {
|
case <x,y> of {
|
||||||
<True,NoPrep,NoPrep> => Passive ;
|
<U,U|Ku> => Ugu ;
|
||||||
<True,Ku,NoPrep> => Lagu ;
|
<U,Ka> => Uga ;
|
||||||
<True,Ka,NoPrep> => Laga ;
|
<U,La> => Ula ;
|
||||||
<True,U,NoPrep> => Loo ;
|
<Ku|Ka,
|
||||||
<True,p,_> => Single p ; -- TODO all combinations
|
Ku|Ka> => Kaga ;
|
||||||
<False,_,_> => case <x,y> of {
|
<Ku,La> => Kula ;
|
||||||
<U,U|Ku> => Ugu ;
|
<Ka,La> => Kala ;
|
||||||
<U,Ka> => Uga ;
|
<NoPrep,p> => Single p ;
|
||||||
<U,La> => Ula ;
|
<p,NoPrep> => Single x ;
|
||||||
<Ku|Ka,
|
<p,_> => Single x } -- for trying both ways
|
||||||
Ku|Ka> => Kaga ;
|
in case oneWay ! p2 ! p1 of {
|
||||||
<Ku,La> => Kula ;
|
Single _ => oneWay ! p1 ! p2 ;
|
||||||
<Ka,La> => Kala ;
|
z => z } ;
|
||||||
<NoPrep,p> => Single p ;
|
|
||||||
<p,NoPrep> => Single x ;
|
isPassive : {c2 : PrepCombination} -> Bool = \vp ->
|
||||||
<p,_> => Single x }} -- for trying both ways
|
case vp.c2 of {
|
||||||
in case oneWay ! p2 ! p1 of {
|
Passive | Lagu | Laga | Loo | Lala => True ;
|
||||||
Single _ => oneWay ! p1 ! p2 ;
|
_ => False
|
||||||
z => z } ;
|
} ;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Verbs
|
-- Verbs
|
||||||
|
|||||||
@@ -660,9 +660,7 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** {
|
VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** {
|
||||||
-- Prepositions can combine together and with object pronoun.
|
c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun.
|
||||||
isPassive : Bool ;
|
|
||||||
c2,c3 : Preposition ; -- if c2 is Passive, the real preposition is in c3.
|
|
||||||
obj2 : NPLite ; -- {s : Str ; a : PrepAgr}
|
obj2 : NPLite ; -- {s : Str ; a : PrepAgr}
|
||||||
secObj : Str ; -- if two overt pronoun objects
|
secObj : Str ; -- if two overt pronoun objects
|
||||||
vComp : Str ; -- VV complement
|
vComp : Str ; -- VV complement
|
||||||
@@ -675,32 +673,38 @@ oper
|
|||||||
comp = \\_ => <[],[]> ;
|
comp = \\_ => <[],[]> ;
|
||||||
pred = NoPred ;
|
pred = NoPred ;
|
||||||
vComp,berri,miscAdv,refl = [] ;
|
vComp,berri,miscAdv,refl = [] ;
|
||||||
c2, c3 = NoPrep ;
|
c2 = Single NoPrep ;
|
||||||
isPassive = False ;
|
|
||||||
obj2 = {s = [] ; a = P3_Prep} ;
|
obj2 = {s = [] ; a = P3_Prep} ;
|
||||||
secObj = []
|
secObj = []
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** {
|
useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** {
|
||||||
c2 = v2.c2
|
c2 = Single v2.c2
|
||||||
|
} ;
|
||||||
|
|
||||||
|
useVc3 : Verb3 -> VPSlash = \v3 -> useV v3 ** {
|
||||||
|
c2 = combine v3.c2 v3.c3 ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
passV2 : Verb2 -> VerbPhrase = \v2 -> passVP (useV v2) ;
|
passV2 : Verb2 -> VerbPhrase = \v2 -> passVP (useV v2) ;
|
||||||
|
|
||||||
passVP : VerbPhrase -> VerbPhrase = \vp -> vp ** {
|
passVP : VerbPhrase -> VerbPhrase = \vp -> vp ** {
|
||||||
isPassive = True ;
|
c2 = case vp.c2 of {
|
||||||
|
Single NoPrep => Passive ;
|
||||||
|
Single Ku => Lagu ;
|
||||||
|
Single Ka => Laga ;
|
||||||
|
Single U => Loo ;
|
||||||
|
Single La => Lala ;
|
||||||
|
_ => vp.c2 }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** {
|
complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** {
|
||||||
comp = \\agr => let cmp = vps.comp ! agr in
|
comp = \\agr => let cmp = vps.comp ! agr in
|
||||||
{p1 = np.s ++ cmp.p1 ; -- if object is a noun, it will come before verb in the sentence.
|
{p1 = np.s ++ cmp.p1 ; -- if object is a noun, it will come before verb in the sentence.
|
||||||
-- if object is a pronoun, np.s is empty.
|
-- if object is a pronoun, np.s is empty.
|
||||||
p2 = cmp.p2 ++ compl np.a vps} -- object combines with the preposition of the verb.
|
p2 = cmp.p2 ++ prepCombTable ! np.a ! vps.c2} -- object combines with the preposition of the verb.
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
compl : PrepAgr -> VerbPhrase -> Str = \agr,vp ->
|
|
||||||
prepCombTable ! agr ! combine vp.isPassive vp.c2 vp.c3 ;
|
|
||||||
|
|
||||||
insertRefl : VPSlash -> VPSlash = \vps -> vps ** {
|
insertRefl : VPSlash -> VPSlash = \vps -> vps ** {
|
||||||
obj2 = vps.obj2 ** {a = Reflexive_Prep} ;
|
obj2 = vps.obj2 ** {a = Reflexive_Prep} ;
|
||||||
|
|
||||||
@@ -733,10 +737,10 @@ oper
|
|||||||
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
|
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
|
||||||
case adv.c2 of {
|
case adv.c2 of {
|
||||||
NoPrep => vp ** adv'' ; -- the adverb is not formed with PrepNP, e.g. "tomorrow"
|
NoPrep => vp ** adv'' ; -- the adverb is not formed with PrepNP, e.g. "tomorrow"
|
||||||
_ => case <vp.c2,vp.c3> of {
|
_ => case vp.c2 of {
|
||||||
-- if free complement slots, introduce adv.np with insertComp
|
-- if free complement slots, introduce adv.np with insertComp
|
||||||
<NoPrep,_> => insertCompAgrPlus (vp ** {c2 = adv.c2}) adv.np ** adv' ;
|
Single NoPrep => insertCompAgrPlus (vp ** {c2 = Single adv.c2}) adv.np ** adv' ;
|
||||||
<_,NoPrep> => insertCompAgrPlus (vp ** {c3 = adv.c2}) adv.np ** adv' ;
|
Single p => insertCompAgrPlus (vp ** {c2 = combine p adv.c2}) adv.np ** adv' ;
|
||||||
|
|
||||||
-- if complement slots are full, just insert strings.
|
-- if complement slots are full, just insert strings.
|
||||||
_ => vp ** adv''
|
_ => vp ** adv''
|
||||||
@@ -786,8 +790,8 @@ oper
|
|||||||
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ;
|
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ;
|
||||||
obj : {p1,p2 : Str} =
|
obj : {p1,p2 : Str} =
|
||||||
let o : {p1,p2 : Str} = vp.comp ! subj.a ;
|
let o : {p1,p2 : Str} = vp.comp ! subj.a ;
|
||||||
bind : Str = case <vp.isPassive,vp.obj2.a, vp.c2, vp.pred> of {
|
bind : Str = case <isPassive vp,vp.obj2.a, vp.c2, vp.pred> of {
|
||||||
<False,P3_Prep,NoPrep,NoPred> => [] ;
|
<False,P3_Prep,Single NoPrep,NoPred> => [] ;
|
||||||
_ => BIND } ;
|
_ => BIND } ;
|
||||||
in case <cltyp,p> of {
|
in case <cltyp,p> of {
|
||||||
<Statement,Neg> => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} ;
|
<Statement,Neg> => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} ;
|
||||||
@@ -802,10 +806,10 @@ oper
|
|||||||
_ => stmarkerNoContr ! subj.a ! p }} ;
|
_ => stmarkerNoContr ! subj.a ! p }} ;
|
||||||
in wordOrder subjnoun subjpron stm obj pred vp ;
|
in wordOrder subjnoun subjpron stm obj pred vp ;
|
||||||
} where {
|
} where {
|
||||||
vp = case vps.isPassive of {
|
vp = case isPassive vps of {
|
||||||
True => complSlash (insertComp vps np) ;
|
True => complSlash (insertComp vps np) ;
|
||||||
_ => complSlash vps } ;
|
_ => complSlash vps } ;
|
||||||
subj = case vps.isPassive of {True => impersNP ; _ => np}
|
subj = case isPassive vps of {True => impersNP ; _ => np}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
wordOrder : (sn,sp,stm : Str) -> {p1,p2 : Str} -> {fin,inf : Str} -> VerbPhrase -> BaseCl =
|
wordOrder : (sn,sp,stm : Str) -> {p1,p2 : Str} -> {fin,inf : Str} -> VerbPhrase -> BaseCl =
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ lin
|
|||||||
-- : V3 -> NP -> VPSlash ; -- give it (to her)
|
-- : V3 -> NP -> VPSlash ; -- give it (to her)
|
||||||
-- : V3 -> NP -> VPSlash ; -- give (it) to her
|
-- : V3 -> NP -> VPSlash ; -- give (it) to her
|
||||||
Slash2V3,
|
Slash2V3,
|
||||||
Slash3V3 = \v3 -> insertComp (useVc v3) ;
|
Slash3V3 = \v3 -> insertComp (useVc3 v3) ;
|
||||||
{-
|
{-
|
||||||
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
|
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
|
||||||
SlashV2V v2v vp = ;
|
SlashV2V v2v vp = ;
|
||||||
|
|||||||
Reference in New Issue
Block a user