From 7a545c25f13c70ea1c75be2316c57c7639568861 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 10 Jun 2019 15:57:23 +0200 Subject: [PATCH] (Som) WIP: Passive. --- src/somali/LexiconSom.gf | 6 +++--- src/somali/ParamSom.gf | 8 +++++++- src/somali/ResSom.gf | 33 ++++++++++++++++++++++++--------- src/somali/SentenceSom.gf | 27 ++++++++++++++++----------- src/somali/StructuralSom.gf | 1 + src/somali/VerbSom.gf | 11 +++++------ 6 files changed, 56 insertions(+), 30 deletions(-) diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index dfe9d3c2..345ff590 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -105,7 +105,7 @@ lin drink_V2 = mkV2 "cab" ; -- -- lin ear_N = mkN "" ; -- lin earth_N = mkN "" ; --- lin eat_V2 = mkV2 "" ; +lin eat_V2 = mkV2 "cun" ; -- lin egg_N = mkN "" ; -- lin empty_A = mkA "" ; -- lin enemy_N = mkN "" ; @@ -150,7 +150,7 @@ lin father_N2 = mkN2 (shortPossN (mkN "aabbe")) Gen ; lin girl_N = mkN "gabadh" "gabdho" fem ; lin give_V3 = mkV3 "sii" ; -- lin glove_N = mkN "" ; --- lin go_V = joan_V ; +lin go_V = mkV "tag" ; -- lin gold_N = mkN "" ; -- lin good_A = mkA "" ; -- lin grammar_N = mkN "" ; @@ -395,7 +395,7 @@ lin wait_V2 = mkV2 "sug" ; -- lin warm_A = mkA "" ; -- lin wash_V2 = mkV2 "" ; -- lin watch_V2 = mkV2 "" ; --- lin water_N = mkN "" ; +lin water_N = mkN "biya" ; -- lin wet_A = mkA "" ; -- lin white_A = mkA "" ; -- lin wide_A = mkA "" ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index f16a2f6c..d3d03a86 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -116,7 +116,7 @@ param -- Prepositions param - Preposition = u | ku | ka | la | noPrep ; + Preposition = u | ku | ka | la | noPrep | passive ; PrepCombination = ugu | uga | ula | kaga | kula | kala | Single Preposition ; @@ -177,4 +177,10 @@ oper if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f -> case p of {Pos => t ; Neg => f } ; + forceAgr : Agreement -> (VForm=>Str) -> (VForm=>Str) = \agr,tbl -> table { + VPres asp _a pol => tbl ! VPres asp agr pol ; + VPast asp _a => tbl ! VPast asp agr ; + x => tbl ! x + } ; + } diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 3588453f..72beed8d 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -140,6 +140,11 @@ oper isPron = False } ; + impersNP : NounPhrase = emptyNP ** { + a = Impers ; + isPron = True + } ; + -------------------------------------------------------------------------------- -- Pronouns @@ -244,7 +249,9 @@ oper ka => mkPrep "ka" "iga" "kaa" "naga" "idinka" "laga" ; la => mkPrep "la" "ila" "kula" "nala" "idinla" "lala" ; u => mkPrep "u" "ii" "kuu" "noo" "idiin" "loo" ; - noPrep => mkPrep [] "i" "ku" "na" "idin" "la" + noPrep => mkPrep [] "i" "ku" "na" "idin" "la" ; + -- impersonal subject clitic combining with object clitics. TODO find out the rest of the forms. + passive => mkPrep [] "la <1sg.obj>" "lagu" "la <1pl.obj>" "la <2pl.obj>" "la" } ; prepCombTable : Agreement => PrepCombination => Str = table { @@ -531,7 +538,7 @@ oper } ; VerbPhrase : Type = Verb ** Complement ** { - isPred : Bool ; -- to choose right sentence type marker + isPred : Bool ; -- to choose right sentence type marker adv : Str ; c2, c3 : Preposition ; -- can combine together and with object pronoun(s?) obj2 : {s : Str ; a : AgreementPlus} ; @@ -584,21 +591,27 @@ oper -- If the old object is 3rd person, we can safely replace its agreement. -- We keep both old and new string (=noun, if there was one) in obj2.s. - NotPronP3|IsPron (Sg3 _|Pl3) => + NotPronP3|IsPron (Sg3 _|Pl3|Impers) => vp ** {obj2 = { s = vp.obj2.s ++ noun ; a = agr2agrplus np.isPron np.a} ; -- } ; -- no secObj, because there's ≤1 non-3rd-person pronoun. -- If old object was non-3rd person, we keep its agreement. - _ => vp ** { - obj2 = vp.obj2 ** { - s = vp.obj2.s ++ noun - } ; - secObj = vp.secObj ++ secondObject ! np.a} + _ => + vp ** {obj2 = vp.obj2 ** { + s = vp.obj2.s ++ noun + } ; + secObj = vp.secObj ++ secondObject ! np.a} } ; + passV2 : Verb2 -> VerbPhrase = \v2 -> useVc v2 ** { + --s = forceAgr Impers v2.s ; + c2 = passive ; + c3 = v2.c2 ; + } ; + insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \adv,vp -> case adv.c2 of { noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP @@ -648,9 +661,11 @@ oper in stm ++ subjpron ! a ; subjpron : Agreement => Str = table { - Sg1|Pl1 _ => "aan" ; + Sg1|Pl1 Excl => "aan" ; + Pl1 Incl => "aynu" ; Sg2|Pl2 => "aad" ; Sg3 Masc => "uu" ; + Impers => [] ; _ => "ay" } ; -------------------------------------------------------------------------------- diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index 532f5044..406d718c 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -8,20 +8,25 @@ lin --2 Clauses -- : NP -> VP -> Cl - PredVP np vps = let vp = complSlash vps in { - s = \\t,a,p => - let pred : {fin : Str ; inf : Str} = vf t a p np.a vp ; - subj : Str = if_then_Str np.isPron [] (np.s ! Nom) ; - obj : {p1,p2 : Str} = vp.comp ! np.a ; + PredVP np vps = + let vp = case vps.c2 of { + passive => complSlash (insertComp vps np) ; + _ => complSlash vps } ; + subj = case vps.c2 of {passive => impersNP ; _ => np} ; + in { s = \\t,a,p => + let pred : {fin : Str ; inf : Str} = vf t a p subj.a vp ; + subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ; + subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) [] ; + obj : {p1,p2 : Str} = vp.comp ! subj.a ; stm : Str = - case of { - => "waa" ; + case of { + => "waa" ; -- _ => stmarker ! np.a ! b } -- marker+pronoun contract _ => case of { - => "waa" ++ np.s ! Nom ; -- to force some string from NP to show in the tree - => "ma" ++ np.s ! Nom ; - => stmarkerNoContr ! np.a ! p }} ; - in subj -- subject if it's a noun + => "waa" ++ subjpron ; -- to force some string from NP to show in the tree + => "ma" ++ subjpron ; + => stmarkerNoContr ! subj.a ! p }} ; + in subjnoun -- subject if it's a noun ++ obj.p1 -- object if it's a noun ++ stm -- sentence type marker + possible subj. pronoun ++ vp.adv ---- TODO word order diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index a7970abe..647778ff 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -131,6 +131,7 @@ lin with_Prep = prep la ; a = Sg2 ; isPron = True ; poss = {s = "aa" ; v = vA ; sp = gnTable "aag" "aad" "uwaag"} } ; + it_Pron = he_Pron ** {s = \\_ => []} ; he_Pron = { s = table {Nom => "uu" ; Voc => "isaga" ; _Abs => []} ; a = Sg3 Masc ; isPron = True ; diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 3f9b0b4c..8ac8e54b 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -7,10 +7,10 @@ lin -- VP -- : V -> VP UseV = ResSom.useV ; -{- - -- : V2 -> VP ; -- be loved - PassV2 v2 = + -- : V2 -> VP ; -- be loved + PassV2 = ResSom.passV2 ; +{- -- : VV -> VP -> VP ; ComplVV vv vp = ; @@ -31,10 +31,9 @@ lin SlashV2a = useVc ; -- : V3 -> NP -> VPSlash ; -- give it (to her) - Slash2V3 v3 np = insertComp (useVc v3) np ; - -- : V3 -> NP -> VPSlash ; -- give (it) to her - Slash3V3 v3 np = insertComp (useVc v3) np ; + Slash2V3, + Slash3V3 = \v3 -> insertComp (useVc v3) ; {- -- : V2V -> VP -> VPSlash ; -- beg (her) to go SlashV2V v2v vp = ;