From e911ad7cb3afdfbbd89869cfacaa71f7448be0a8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 21 Nov 2018 16:20:44 +0100 Subject: [PATCH] (Ara) replace NP with just its string and isPron:Bool for ClSlash --- src/arabic/ResAra.gf | 47 ++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index d1d74c9d1..0311148ce 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1559,18 +1559,34 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative True => np.s ! sc.c } ; + } in wordOrder o + vp.obj.a.isPron np.a.isPron + (vStr t p) + subj + + (case of { + => BIND ++ vp.obj.s ; + _ => vp.obj.s }) + + (pred t p) + vp.s2 - } in - case o of { - Verbal => vStr t p ++ case vp.obj.a.isPron of { - True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb - False => subj ++ vp.obj.s } - ++ vp.s2 ++ pred t p ; - VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ subj ; - Nominal|Subord => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p - } } ; + -- seems complicated, but this is to share code between PredVP and ClSlash-using funs + wordOrder : Order -> (objIsPron,subjIsPron : Bool) -> (verb,subj,obj,pred,adv : Str) -> Str = + \o,objIsPron,subjIsPron,verb,subj,obj,pred,adv -> + case o of { + VOS => verb ++ obj ++ pred ++ adv ++ subj ; + Verbal => verb ++ + case objIsPron of { + True => obj ++ subj ; -- obj. clitic attaches directly to the verb + False => subj ++ obj } ++ adv ++ pred ; + Nominal => subj ++ verb ++ obj ++ adv ++ pred ; + Subord => if_then_Str subjIsPron BIND [] -- in subord. clause, subj. pronoun binds to the main verb + ++ subj ++ verb ++ obj ++ adv ++ pred + } ; + -- in verbal sentences, the verb agrees with the subject -- in Gender but not in number verbalAgr : PerGenNum -> PerGenNum = \pgn -> @@ -1591,6 +1607,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> a : Agr -- default Agr in a VP without real Obj is Per3 Masc Sg. }; -- need isPron for word order in predVP, and pgn for ImpersCl + Subj : Type = {s : Case => Str ; isPron : Bool} ; + + np2subj : NP -> Subj = \np -> np ** {isPron = np.a.isPron} ; + subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ; emptyObj : Obj = emptyNP ** {s=[]} ; insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** @@ -1616,7 +1636,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- Slash categories VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ; - ClSlash : Type = VPSlash ** {subj : NP} ; + ClSlash : Type = VPSlash ** {subj : Subj} ; slashV2 : Verb2 -> VPSlash = \v -> predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ; @@ -1625,14 +1645,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- but keep the structure as VP, because later on -- we might need different word orders for the ClSlash. predVPSlash : NP -> VPSlash -> ClSlash = \np,v -> v ** { - subj = np + subj = np2subj np ; + s = \\_pgn,vf => v.s ! np.a.pgn ! vf -- so we can throw away subject's pgn } ; complClSlash = overload { complClSlash : NP -> ClSlash -> Cl = \obj,cls -> - predVP cls.subj (insertObj obj cls) ; + predVP (subj2np cls.subj) (insertObj obj cls) ; complClSlash : ClSlash -> Cl = \cls -> - predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object + predVP (subj2np cls.subj) (insertObj emptyNP cls) -- Empty subject and object } ; Cl : Type = {s : Tense => Polarity => Order => Str} ;