1
0
forked from GitHub/gf-rgl

(Som) Better handling of AP and NP complements, remove redundant fields

This commit is contained in:
Inari Listenmaa
2019-09-26 15:11:20 +02:00
parent e63eae8519
commit 819bdacc65
4 changed files with 61 additions and 76 deletions

View File

@@ -88,15 +88,15 @@ concrete QuestionSom of Question = CatSom ** open
-- : IAdv -> IComp ; -- : IAdv -> IComp ;
CompIAdv iadv = { -- where (is it) CompIAdv iadv = { -- where (is it)
comp = \\_ => <[], []> ; aComp = \\_ => [] ;
npcomp = iadv.s ; nComp = iadv.s ;
stm = Waa NoCopula ; stm = Waa NoCopula ;
} ; } ;
-- : IP -> IComp ; -- : IP -> IComp ;
CompIP ip = { -- who (is it) CompIP ip = { -- who (is it)
comp = \\_ => <[], []> ; aComp = \\_ => [] ;
npcomp = ip.s ! Abs ; nComp = ip.s ! Abs ;
stm = Waa NoCopula ; stm = Waa NoCopula ;
} ; } ;

View File

@@ -726,8 +726,8 @@ oper
-- VP -- VP
Complement : Type = { Complement : Type = {
comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements aComp : Agreement => Str ;
npcomp : Str ; nComp : Str ;
stm : STM ; -- to choose right sentence type marker stm : STM ; -- to choose right sentence type marker
} ; } ;
@@ -736,19 +736,19 @@ oper
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 : {subjunc : Str ; -- "waa in" or subjunctive construction: "in" is placed here vComp : {subjunc : Str ; -- "waa in" or subjunctive construction: "in" is placed here
inf : Str ; -- auxiliary VV with infinitive argument inf : Str ; -- auxiliary VV with infinitive argument
subcl : Agreement => Str} -- VV complement if it's a subordinate clause subcl : Agreement => Str} -- VV complement if it's a subordinate clause
} ; } ;
VPSlash : Type = VerbPhrase ; VPSlash : Type = VerbPhrase ;
useV : Verb -> VerbPhrase = \v -> v ** { useV : Verb -> VerbPhrase = \v -> v ** {
comp = \\_ => <[],[]> ;
npcomp = [] ;
stm = case v.isCopula of { -- can change into Waxa in ComplVV stm = case v.isCopula of { -- can change into Waxa in ComplVV
True => Waa Copula ; True => Waa Copula ;
False => Waa NoPred False => Waa NoPred
} ; } ;
nComp = [] ;
aComp = \\_ => [] ;
vComp = {subjunc, inf = [] ; vComp = {subjunc, inf = [] ;
subcl = \\_ => []} ; subcl = \\_ => []} ;
berri,miscAdv = [] ; berri,miscAdv = [] ;
@@ -777,13 +777,6 @@ oper
_ => vp.c2 } _ => vp.c2 }
} ; } ;
complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** {
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.
-- if object is a pronoun, np.s is empty.
p2 = cmp.p2 ++ prepCombTable ! np.a ! vps.c2} -- object combines with the preposition of the verb.
} ;
insertRefl : VPSlash -> VPSlash = \vps -> vps ** { insertRefl : VPSlash -> VPSlash = \vps -> vps ** {
obj2 = vps.obj2 ** {a = Reflexive_Prep} ; obj2 = vps.obj2 ** {a = Reflexive_Prep} ;
@@ -861,8 +854,8 @@ oper
obj2 : NPLite ; obj2 : NPLite ;
secObj : Str ; secObj : Str ;
c2 : PrepCombination ; -- NB. QuestIAdv can add more prepositions c2 : PrepCombination ; -- NB. QuestIAdv can add more prepositions
comp : {p1,p2 : Str} ; aComp : Str ;
npcomp : Str ; nComp : Str ;
vComp : {inf,subcl,subjunc : Str} ; vComp : {inf,subcl,subjunc : Str} ;
-- Still open -- Still open
@@ -884,7 +877,6 @@ oper
in case <cltyp, p, t, vp.stm, subj.a> of { in case <cltyp, p, t, vp.stm, subj.a> of {
<Statement, Pos, Pres, Waa NoCopula, Sg3 _|Pl3> -- VP comes from CompNP/CompCN + P3 subject <Statement, Pos, Pres, Waa NoCopula, Sg3 _|Pl3> -- VP comes from CompNP/CompCN + P3 subject
=> [] ; => [] ;
<_, _, Pres, Waa (Copula|NoCopula), _> -- Comp* present tense + any subject <_, _, Pres, Waa (Copula|NoCopula), _> -- Comp* present tense + any subject
=> presCopula ! {agr=subj.a ; pol=p} ; => presCopula ! {agr=subj.a ; pol=p} ;
@@ -892,7 +884,7 @@ oper
} ; } ;
stm = mkStm subj.a vp.stm ; stm = mkStm subj.a vp.stm ;
comp = vp.comp ! subj.a ; aComp = vp.aComp ! subj.a ;
vComp = vp.vComp ** { vComp = vp.vComp ** {
subcl = vp.vComp.subcl ! subj.a subcl = vp.vComp.subcl ! subj.a
} }
@@ -912,15 +904,8 @@ oper
=> np.empty ; => np.empty ;
_ => (pronTable ! subj.a).s ! Nom _ => (pronTable ! subj.a).s ! Nom
} }
} ; } ;
-- just like complSlash but for Cl
complCl : ClSlash -> ClSlash = \cl -> let np = cl.obj2 in cl ** {
comp = {p1 = np.s ++ cl.comp.p1 ;
p2 = cl.comp.p2 ++ prepCombTable ! np.a ! cl.c2}
} ;
-- RelVP: subject pronoun is never included -- RelVP: subject pronoun is never included
cl2rcl : ClSlash -> Clause = cl2rcl : ClSlash -> Clause =
@@ -971,43 +956,43 @@ oper
} ; } ;
mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = \cltyp,isRel,hasSubjPron,hasSTM,incomplCl -> { mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause =
\cltyp,isRel,hasSubjPron,hasSTM,cl -> {
s = \\t,a,p => s = \\t,a,p =>
let -- Put all arguments in their right place let -- Put all arguments in their right place
cl : ClSlash = complCl incomplCl ; --cl : ClSlash = complCl incomplCl ;
prepComb = prepCombTable ! cl.obj2.a ! cl.c2 ;
-- Contractions -- Contractions
bind : Str = case <isPassive cl, cl.obj2.a, cl.c2> of { bind : Str = case <isPassive cl, cl.obj2.a, cl.c2> of {
<False,P3_Prep,Single NoPrep> => [] ; -- nothing to attach to the STM <False,P3_Prep,Single NoPrep> => [] ; -- nothing to attach to the STM
_ => BIND } ; -- something to attach, use BIND _ => BIND } ; -- something to attach, use BIND
obj : {p1,p2 : Str} = case <cltyp,p> of { prepCombNeg : Str = case <cltyp,p> of {
<Statement,Neg> -- object pronoun and prepositions contract with negation <Statement,Neg> => prepComb ++ bind ;
=> {p2 = [] ; p1 = cl.comp.p1 ++ cl.comp.p2 ++ bind} ; _ => []
_ => cl.comp } ; } ;
prepCombPos : Str = case <cltyp,p> of {
<Statement,Neg> => [] ;
_ => prepComb
} ;
-- Placement of object noun varies depending on type of clause -- Placement of object noun varies depending on type of clause
statementNounObj = case cltyp of { statementNounObj = case cltyp of {
Statement => obj.p1 ; Statement => cl.obj2.s ;
_ => [] } ; _ => [] } ;
statementNounComp = case cltyp of {
Statement => cl.nComp ;
_ => [] } ;
-- for subord and question, NP predicatives and objects behave the same
subordNounObj = case cltyp of { subordNounObj = case cltyp of {
Subord => obj.p1 ; Subord => cl.obj2.s ++ cl.nComp ;
_ => [] } ; _ => [] } ;
questionNounObj = case cltyp of { questionNounObj = case cltyp of {
PolarQuestion|WhQuestion => obj.p1 ; PolarQuestion|WhQuestion
=> cl.obj2.s ++ cl.nComp ;
_ => [] } ; _ => [] } ;
-- Placement of NP complement varies depending on type of clause
statementNPComp = case cltyp of {
Statement => cl.npcomp ;
_ => [] } ;
subordNPComp = case cltyp of {
Subord => cl.npcomp ;
_ => [] } ;
questionNPComp = case cltyp of {
PolarQuestion|WhQuestion => cl.npcomp ;
_ => [] } ;
-- Control whether to include subject pronoun and STM -- Control whether to include subject pronoun and STM
subjpron : Str = case <hasSubjPron,p,cl.subj.isP3,isRel> of { subjpron : Str = case <hasSubjPron,p,cl.subj.isP3,isRel> of {
<True,Pos,True,True> => [] ; <True,Pos,True,True> => [] ;
@@ -1021,21 +1006,23 @@ oper
++ cl.subj.noun -- subject if it's a noun ++ cl.subj.noun -- subject if it's a noun
++ statementNounObj -- noun object if it's a statement ++ statementNounObj -- noun object if it's a statement
++ prepCombNeg -- prepositions and pron. objects in negative statement
++ stm ++ stm
++ cl.vComp.subjunc -- "waa in" construction / ++ cl.vComp.subjunc -- "waa in" construction /
++ subjpron -- subject pronoun ++ subjpron -- subject pronoun
++ subordNPComp
++ subordNounObj -- noun object if it's subordinate clause: "timir aan /laf/ lahayn" (Saeed p. 210-211) ++ subordNounObj -- noun object if it's subordinate clause: "timir aan /laf/ lahayn" (Saeed p. 210-211)
++ obj.p2 -- object if it's a pronoun ++ cl.aComp -- AP complement, regardless of cltype
++ statementNPComp ++ statementNounComp -- NP complement if it's direct statement
++ prepCombPos -- prepositions + pron. objects in positive sentence
++ cl.sii -- restricted set of particles ++ cl.sii -- restricted set of particles
++ cl.dhex -- restricted set of nouns/adverbials ++ cl.dhex -- restricted set of nouns/adverbials
++ cl.secObj -- "second object" ++ cl.secObj -- "second object"
++ cl.vComp.inf -- VV complement, if it's infinitive ++ cl.vComp.inf -- VV complement, if it's infinitive
++ cl.pred ! cltyp ! t ! a ! p -- the inflecting verb ++ cl.pred ! cltyp ! t ! a ! p -- the inflecting verb
++ questionNPComp
++ questionNounObj -- noun object if it's a question ++ questionNounObj -- noun object if it's a question
++ cl.vComp.subcl -- VV complement, if it's subordinate clause ++ cl.vComp.subcl -- VV complement, if it's subordinate clause
++ cl.miscAdv ---- NB. Only used if there are several adverbs, or for "waa in" construction. ++ cl.miscAdv ---- NB. Only used if there are several adverbs, or for "waa in" construction.
@@ -1137,28 +1124,30 @@ oper
++ adv.np.s ++ adv.np.s
++ adv.miscAdv ; ++ adv.miscAdv ;
linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp -> linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp ->
let pred = vp.s ! vf ; let pred = vp.s ! vf ;
vp' = complSlash vp ; pr = prepCombTable ! vp.obj2.a ! vp.c2 ;
-- obj = {p1 = np.s ;
-- p2 = vp.aComp ! pagr2agr np.a ++ prepCombTable ! np.a ! vps.c2} ;
neg = case <cltyp,isNeg vf> of { neg = case <cltyp,isNeg vf> of {
<Subord,True> => "aan" ; <Subord,True> => "aan" ;
_ => [] _ => []
} ; } ;
in wordOrder cltyp neg pred (vp'.comp ! pagr2agr vp.obj2.a) vp' ; in wordOrder cltyp neg pred pr vp ;
wordOrder : ClType -> (neg,pred : Str) -> (obj : {p1,p2 : Str}) -> VerbPhrase -> Str = wordOrder : ClType -> (neg,pred,prepcomb : Str) -> VerbPhrase -> Str =
\cltyp,neg,pred,obj,vp -> \cltyp,neg,pred,pr,vp ->
vp.berri -- AdV vp.berri -- AdV
++ case cltyp of { ++ case cltyp of {
Subord => [] ; Subord => [] ;
_ => obj.p1 } -- noun object if it's a statement _ => vp.obj2.s {-obj.p1-} } -- noun object if it's a statement
++ neg ++ neg
++ vp.vComp.subjunc -- "waa in" construction ++ vp.vComp.subjunc -- "waa in" construction
++ case cltyp of { ++ case cltyp of {
Subord => obj.p1 ; -- noun object if it's subordinate clause Subord => vp.obj2.s ; -- noun object if it's subordinate clause
_ => [] } _ => [] }
++ obj.p2 -- object if it's a pronoun ++ vp.aComp ! pagr2agr vp.obj2.a -- AP complement agreeing with object
++ pr -- object if it's a pronoun
++ vp.sii -- restricted set of particles ++ vp.sii -- restricted set of particles
++ vp.dhex -- restricted set of nouns/adverbials ++ vp.dhex -- restricted set of nouns/adverbials
++ vp.secObj -- "second object" ++ vp.secObj -- "second object"

View File

@@ -79,7 +79,7 @@ lin
-- : V2A -> AP -> VPSlash ; -- paint (it) red -- : V2A -> AP -> VPSlash ; -- paint (it) red
-- TODO: is "red" plural in "paint them red"? -- TODO: is "red" plural in "paint them red"?
SlashV2A v2a ap = useVc v2a ** { SlashV2A v2a ap = useVc v2a ** {
comp = \\_ => (CompAP ap).comp ! Sg3 Masc aComp = \\_ => (CompAP ap).aComp ! Sg3 Masc
} ; } ;
-- : VPSlash -> NP -> VP -- : VPSlash -> NP -> VP
@@ -133,36 +133,32 @@ lin
-- Adjectival phrases, noun phrases, and adverbs can be used. -- Adjectival phrases, noun phrases, and adverbs can be used.
-- the house is big
-- the houses are big
-- I am [a house that sleeps here]
-- we are [houses that sleep here]
-- : AP -> Comp ; -- : AP -> Comp ;
CompAP ap = { CompAP ap = {
comp = \\a => <[], ap.s ! AF (getNum a) Abs> ; aComp = \\a => ap.s ! AF (getNum a) Abs ;
npcomp = [] ; nComp = [] ;
stm = Waa Copula ; stm = Waa Copula ;
} ; } ;
-- : CN -> Comp ; -- : CN -> Comp ;
CompCN cn = { CompCN cn = {
comp = \\a => <[], []> ; -- I am [a house that sleeps here] vs. we are [houses that sleep here]
npcomp = cn2str Sg Abs cn ; aComp = \\a => cn2str (getNum a) Abs cn ;
nComp = [] ;
stm = Waa NoCopula ; stm = Waa NoCopula ;
} ; } ;
-- NP -> Comp ; -- NP -> Comp ;
CompNP np = { CompNP np = {
comp = \\a => <[], []> ; aComp = \\a => [] ;
npcomp = np.s ! Abs ; nComp = np.s ! Abs ;
stm = Waa NoCopula ; stm = Waa NoCopula ;
} ; } ;
-- : Adv -> Comp ; -- : Adv -> Comp ;
CompAdv adv = { CompAdv adv = {
comp = \\a => <[], linAdv adv> ; aComp = \\a => linAdv adv ; -- TODO check placement
npcomp = [] ; nComp = [] ;
stm = Waa Copula ; stm = Waa Copula ;
} ; } ;

View File

@@ -66,5 +66,5 @@ Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAd
-- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? TODO why is there subject pronoun here? -- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? TODO why is there subject pronoun here?
--LangEng: what was the meat that was eaten --LangEng: what was the meat that was eaten
LangSom: TODO LangSom: maxaa uu ahaa hilib BIND ka la cunay
Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc