From 855d04dee5c43c57110785cb08fe2447234e4b91 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 30 Jul 2019 11:18:19 +0200 Subject: [PATCH] (Som) Use PrepCombination in VP instead of c2,c3 : Preposition --- src/somali/ParamSom.gf | 44 +++++++++++++++++++++--------------------- src/somali/ResSom.gf | 40 +++++++++++++++++++++----------------- src/somali/VerbSom.gf | 2 +- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 13f0918bb..4127eeea9 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -202,28 +202,28 @@ param | Single Preposition ; oper - combine : (isPassive : Bool) -> Preposition -> Preposition -> PrepCombination = \isPass,p1,p2 -> - let oneWay : Preposition => Preposition => PrepCombination = - \\x,y => case of { - => Passive ; - => Lagu ; - => Laga ; - => Loo ; - => Single p ; -- TODO all combinations - => case of { - => Ugu ; - => Uga ; - => Ula ; - => Kaga ; - => Kula ; - => Kala ; - => Single p ; - => Single x ; - => Single x }} -- for trying both ways - in case oneWay ! p2 ! p1 of { - Single _ => oneWay ! p1 ! p2 ; - z => z } ; + combine : Preposition -> Preposition -> PrepCombination = \p1,p2 -> + let oneWay : Preposition => Preposition => PrepCombination = \\x,y => + case of { + => Ugu ; + => Uga ; + => Ula ; + => Kaga ; + => Kula ; + => Kala ; + => Single p ; + => Single x ; + => Single x } -- for trying both ways + in case oneWay ! p2 ! p1 of { + Single _ => oneWay ! p1 ! p2 ; + z => z } ; + + isPassive : {c2 : PrepCombination} -> Bool = \vp -> + case vp.c2 of { + Passive | Lagu | Laga | Loo | Lala => True ; + _ => False + } ; -------------------------------------------------------------------------------- -- Verbs diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index a4cf64052..799bfba9b 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -660,9 +660,7 @@ oper } ; VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** { - -- Prepositions can combine together and with object pronoun. - isPassive : Bool ; - c2,c3 : Preposition ; -- if c2 is Passive, the real preposition is in c3. + c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun. obj2 : NPLite ; -- {s : Str ; a : PrepAgr} secObj : Str ; -- if two overt pronoun objects vComp : Str ; -- VV complement @@ -675,32 +673,38 @@ oper comp = \\_ => <[],[]> ; pred = NoPred ; vComp,berri,miscAdv,refl = [] ; - c2, c3 = NoPrep ; - isPassive = False ; + c2 = Single NoPrep ; obj2 = {s = [] ; a = P3_Prep} ; secObj = [] } ; 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) ; 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 ** { 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 ++ 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 ** { obj2 = vps.obj2 ** {a = Reflexive_Prep} ; @@ -733,10 +737,10 @@ oper insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> case adv.c2 of { NoPrep => vp ** adv'' ; -- the adverb is not formed with PrepNP, e.g. "tomorrow" - _ => case of { + _ => case vp.c2 of { -- if free complement slots, introduce adv.np with insertComp - => insertCompAgrPlus (vp ** {c2 = adv.c2}) adv.np ** adv' ; - <_,NoPrep> => insertCompAgrPlus (vp ** {c3 = adv.c2}) adv.np ** adv' ; + Single NoPrep => insertCompAgrPlus (vp ** {c2 = Single 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. _ => vp ** adv'' @@ -786,8 +790,8 @@ oper subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ; obj : {p1,p2 : Str} = let o : {p1,p2 : Str} = vp.comp ! subj.a ; - bind : Str = case of { - => [] ; + bind : Str = case of { + => [] ; _ => BIND } ; in case of { => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} ; @@ -802,10 +806,10 @@ oper _ => stmarkerNoContr ! subj.a ! p }} ; in wordOrder subjnoun subjpron stm obj pred vp ; } where { - vp = case vps.isPassive of { + vp = case isPassive vps of { True => complSlash (insertComp vps np) ; _ => 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 = diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 3b7e707ae..8cff38ec5 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -40,7 +40,7 @@ lin -- : V3 -> NP -> VPSlash ; -- give it (to her) -- : V3 -> NP -> VPSlash ; -- give (it) to her Slash2V3, - Slash3V3 = \v3 -> insertComp (useVc v3) ; + Slash3V3 = \v3 -> insertComp (useVc3 v3) ; {- -- : V2V -> VP -> VPSlash ; -- beg (her) to go SlashV2V v2v vp = ;