From 2efd8435ae87ee59dadfe3170f629880b9f578a3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 20 Jul 2019 18:33:14 +0300 Subject: [PATCH 1/3] (Som) More unit tests --- src/somali/unittest/vp.gftest | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/somali/unittest/vp.gftest b/src/somali/unittest/vp.gftest index 36ffe9ad..a5abd65a 100644 --- a/src/somali/unittest/vp.gftest +++ b/src/somali/unittest/vp.gftest @@ -7,27 +7,44 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron the -------------------------------------------------------------------------------- -- Transitive + -- LangEng: they saw you LangSom: waa ay idin arkeen Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron they_Pron) (ComplSlash (SlashV2a see_V2) (UsePron youPl_Pron))))) NoVoc --- LangEng: you saw yourself -LangSom: waa aad is aragtay -Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron youSg_Pron) (ReflVP (SlashV2a see_V2))))) NoVoc +-- LangEng: you taught yourself +LangSom: waa aad is &+ ku bartay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron youSg_Pron) (ReflVP (SlashV2a teach_V2))))) NoVoc + +-- LangEng: you don't teach yourself +LangSom: is &+ ku &+ ma barto +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron youSg_Pron) (ReflVP (SlashV2a teach_V2))))) NoVoc + +-- LangEng: one saw you +LangSom: waa lagu arkay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (GenericCl (ComplSlash (SlashV2a see_V2) (UsePron youSg_Pron))))) NoVoc -- LangEng: you were seen LangSom: waa lagu arkay Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron youSg_Pron) (PassV2 see_V2)))) NoVoc +-- LangEng: we were seen +LangSom: waa inala arkay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron we_Pron) (PassV2 see_V2)))) NoVoc + +-- LangEng: you were seen +LangSom: waa laydin arkay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron youPl_Pron) (PassV2 see_V2)))) NoVoc + -------------------------------------------------------------------------------- -- Ditransitive -- LangEng: mother gave you us -LangSom: hooyo waa ay na kaa siisey +LangSom: hooyo waa ay ina kaa siisey Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (MassNP (UseN2 mother_N2)) (ComplSlash (Slash3V3 give_V3 (UsePron we_Pron)) (UsePron youSg_Pron))))) NoVoc -- LangEng: mother didn't give you us -LangSom: hooyo na &+ ma ay kaa siin +LangSom: hooyo ina &+ ma ay kaa siin Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PNeg (PredVP (MassNP (UseN2 mother_N2)) (ComplSlash (Slash3V3 give_V3 (UsePron we_Pron)) (UsePron youSg_Pron))))) NoVoc -- LangEng: he gave himself bread @@ -37,3 +54,18 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron he_ -- LangEng: one adds salt to the meat LangSom: hilib &+ ka cusbo waa lagu daraa Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (Slash3V3 add_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))) (MassNP (UseN salt_N)))))) NoVoc + +-- LangEng: one can add salt to meat +LangSom: hilib cusbo waa lagu dari karaa +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplVV can_VV (ComplSlash (Slash3V3 add_V3 (MassNP (UseN meat_N))) (MassNP (UseN salt_N))))))) NoVoc + +-------------------------------------------------------------------------------- +-- Adverbials + +-- LangEng: I can jump above it +LangSom: waa aan ka dul boodi karaa +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV can_VV (UseV jump_V)) (PrepNP above_Prep (UsePron it_Pron)))))) NoVoc + +-- LangEng: you can't jump above me +LangSom: iga &+ ma dul boodi karto +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron youSg_Pron) (AdvVP (ComplVV can_VV (UseV jump_V)) (PrepNP above_Prep (UsePron i_Pron)))))) NoVoc From 89b52b89f9d8fbb411254295a7b5805c8907e56d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 20 Jul 2019 18:35:19 +0300 Subject: [PATCH 2/3] (Som) Shaving off parameters here and there --- src/somali/AdverbSom.gf | 2 +- src/somali/LexiconSom.gf | 2 +- src/somali/NounSom.gf | 18 ++-- src/somali/ParadigmsSom.gf | 2 +- src/somali/ParamSom.gf | 82 +++++++++----- src/somali/ResSom.gf | 206 +++++++++++++++++------------------- src/somali/StructuralSom.gf | 6 +- src/somali/VerbSom.gf | 6 +- 8 files changed, 177 insertions(+), 147 deletions(-) diff --git a/src/somali/AdverbSom.gf b/src/somali/AdverbSom.gf index 329d17a0..cf422525 100644 --- a/src/somali/AdverbSom.gf +++ b/src/somali/AdverbSom.gf @@ -11,7 +11,7 @@ lin -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- : Prep -> NP -> Adv ; - PrepNP prep np = prep ** {s = [] ; np = np} ; + PrepNP prep np = prep ** {s = [] ; np = nplite np} ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index fa1fe46f..faee825e 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -187,7 +187,7 @@ lin house_N = mkN "guri" ; -- lin industry_N = mkN "" ; -- lin iron_N = mkN "" ; -- lin john_PN = mkPN "Jon" ; --- lin jump_V = mkV "" ; +lin jump_V = mkV "bood" ; -- lin kill_V2 = mkV2 "" ; -- lin king_N = mkN "" ; -- lin knee_N = mkN "" ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index 5ae95f4a..41b08eaf 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -7,11 +7,11 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { --2 Noun phrases -- : Det -> CN -> NP -DetCN det cn = useN cn ** { - s = sTable ; - a = getAgr det.n (gender cn) } where { - sTable : Case => Str = \\c => - let nfc : {nf : NForm ; c : Case} = + DetCN det cn = useN cn ** { + s = sTable ; + a = getAgr det.n (gender cn) } where { + sTable : Case => Str = \\c => + let nfc : {nf : NForm ; c : Case} = case of { -- Numbers => {nf=Numerative ; c=c} ; @@ -26,7 +26,7 @@ DetCN det cn = useN cn ** { <_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ; _ => {nf=Def det.n ; c=c} -- TODO check } ; - art = case det.n of {Sg => cn.sg ; Pl => cn.pl} ; + art = gda2da cn.gda ! det.n ; num = case det.isNum of {True => Sg ; _ => det.n} ; dt : {pref,s : Str} = case of { @@ -159,7 +159,7 @@ DetCN det cn = useN cn ** { -} -- : Quant - DefArt = defQuant "a" "kan" "tan" "kuwan" NA ; + DefArt = defQuant "a" "kan" "tan" "kuwan" False ; -- : Quant IndefArt = indefQuant ** {sp = \\gn,c => "1"} ; -- TODO sp forms @@ -190,11 +190,11 @@ DetCN det cn = useN cn ** { Def n => n ; Indef n => n ; _ => Sg } ; - art = case num of {Sg => cn.sg ; Pl => cn.pl} ; + art = gda2da cn.gda ! num ; qnt = PossPron (pronTable ! np.a) ; det = case cn.shortPoss of { True => qnt.shortPoss ! art ; - _ => qnt.s ! n2.sg ! Abs } ; + _ => qnt.s ! sg n2.gda ! Abs } ; noun = case np.isPron of { True => (pronTable ! np.a).sp ; -- long subject pronoun False => np.s ! Abs } diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index 4a814fce..06860c3f 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -123,7 +123,7 @@ oper mkAdv : Str -> Adv = \s -> lin Adv { berri = s ; c2 = noPrep ; - np = emptyNP ; + np = {s = [] ; a = NotPronP3} ; sii,dhex = [] } ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 78269ad6..458b923d 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -27,16 +27,43 @@ param -- Allomorphs for the definite article DefTA = TA | DA | SHA | DHA ; DefKA = KA | GA | A_ | HA ; - DefArticle = M DefKA | F DefTA ; + DefArticle = F DefTA | M DefKA ; + GenderDefArt = FM DefTA DefKA + | MF DefKA DefTA + | MM DefKA DefKA ; oper - defAllomorph : Str -> DefArticle = \wiilka -> - case wiilka of { - _ + "ta" => F DA ; _ + "sha" => F SHA ; - _ + "da" => F DA ; _ + "dha" => F DHA ; - _ + "ka" => M KA ; _ + "aha" => M HA ; - _ + "ga" => M GA ; _ => M A_ } ; + sg : GenderDefArt -> DefArticle = \gda -> gda2da gda ! Sg ; + pl : GenderDefArt -> DefArticle = \gda -> gda2da gda ! Pl ; + + gda2da : GenderDefArt -> Number => DefArticle = \gda -> + let da : {sg,pl:DefArticle} = case gda of { + FM s p => {sg = F s ; pl = M p} ; + MM s p => {sg = M s ; pl = M p} ; + MF s p => {sg = M s ; pl = F p} } ; + in table {Sg => da.sg ; Pl => da.pl} ; + + defAllomorph : (_,_ : Str) -> GenderDefArt = \wiilka,wiilasha -> + case of { + => MF (allomM wiilka) (allomF wiilasha) ; + => MM (allomM wiilka) (allomM wiilasha) ; + _ => FM (allomF wiilka) (allomM wiilasha) + } where { + allomF : Str -> DefTA = \wiilka -> + case wiilka of { + _ + "ta" => DA ; _ + "sha" => SHA ; + _ + "da" => DA ; _ + "dha" => DHA } ; + allomM : Str -> DefKA = \wiilka -> + case wiilka of { + _ + "ka" => KA ; _ + "aha" => HA ; + _ + "ga" => GA ; _ + "a" => A_ } ; + getGender : Str -> Gender = \word -> + case word of { + _ + ("ta"|"sha"|"da"|"dha") => Fem ; + _ + "a" => Masc ; + _ => Predef.error ("defAllomorph: expecting definite form, given" ++ word)} + } ; -- Use always via quantTable! defStems : DefArticle => Str = table { @@ -97,7 +124,6 @@ oper param Case = Nom | Abs ; Gender = Masc | Fem ; - Vowel = vA | vE | vI | vO | vU | NA ; -- For vowel assimilation GenNum = SgMasc | SgFem | PlInv ; -- For Quant Inclusion = Excl | Incl ; @@ -111,8 +137,7 @@ param | Impers ; -- Verb agrees with Sg3, but needed for preposition contraction AgreementPlus = - Unassigned -- Dummy value: shows that the slot for object hasn't been filled. - | IsPron Agreement -- Any of Sg1 … Pl3 can be a pronoun. + IsPron Agreement -- Any of Sg1 … Pl3 can be a pronoun. | NotPronP3 ; -- Sg3 Gender and Pl3 can be pronouns or not. State = Definite | Indefinite ; @@ -130,6 +155,9 @@ oper agr2agrplus : (isPron : Bool) -> Agreement -> AgreementPlus = \isPron,a -> case isPron of {True => IsPron a ; False => NotPronP3} ; + agrplus2agr : AgreementPlus -> Agreement = \a -> + case a of {IsPron a => a ; _ => Pl3} ; + isP3 = overload { isP3 : Agreement -> Bool = \agr -> case agr of {Sg3 _ | Pl3 | Impers => True ; _ => False} ; @@ -137,18 +165,12 @@ oper case agr of { IsPron (Sg3 _ | Pl3 | Impers) => True ; NotPronP3 => True ; - Unassigned => True ; -- meaningful for "does it leave an overt pronoun" +-- Unassigned => True ; -- meaningful for "does it leave an overt pronoun" _ => False} } ; - -- gn2gennum : Gender -> Number -> GenNum = \g,n -> - -- case of { - -- => SgMasc ; - -- => SgFem ; - -- _ => PlInv } ; - - gender : {sg : DefArticle} -> Gender = \n -> - case n.sg of {M _ => Masc ; F _ => Fem} ; + gender : {gda : GenderDefArt} -> Gender = \n -> + case n.gda of {FM _ _ => Fem ; _ => Masc} ; -------------------------------------------------------------------------------- -- Numerals @@ -179,7 +201,7 @@ oper let oneWay : PrepositionPlus => Preposition => PrepCombination = \\x,y => case of { => Single Passive ; - => Single (P p) ; -- TODO check if this ever happens + => Single (P p) ; -- FIXME p "waa lagu arkay" gives infinitely many trees now, because the passive is ignored here. Is there a combination for passive + personal pronoun + preposition?

=> case of { => Ugu ; => Uga ; @@ -226,12 +248,19 @@ param VForm = VInf - | VPres Aspect Agreement Polarity + | VPres Aspect VAgr Polarity | VNegPast Aspect - | VPast Aspect Agreement + | VPast Aspect VAgr | VRel -- "som är/har/…" TODO is this used in other verbs? | VImp Number Polarity ; + VAgr = + Sg1_Sg3Masc + | Sg2_Sg3Fem + | Pl1_ + | Pl2_ + | Pl3_ ; + PredType = NoPred | Copula | NoCopula ; oper @@ -239,9 +268,14 @@ oper 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 ; + VPres asp _a pol => tbl ! VPres asp (agr2vagr agr) pol ; + VPast asp _a => tbl ! VPast asp (agr2vagr agr) ; x => tbl ! x } ; + agr2vagr : Agreement -> VAgr = \agr -> case agr of { + Sg1|Sg3 Masc|Impers => Sg1_Sg3Masc ; + Sg2|Sg3 Fem => Sg2_Sg3Fem ; + Pl1 _ => Pl1_ ; Pl2 => Pl2_ ; Pl3 => Pl3_ + } ; } diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 663d13b1..20803a68 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -6,8 +6,7 @@ oper Noun : Type = { s : NForm => Str ; - sg, - pl : DefArticle ; + gda : GenderDefArt ; shortPoss : Bool ; } ; Noun2 : Type = Noun ; -- TODO eventually more parameters? @@ -33,8 +32,7 @@ oper -- Special forms for feminine nouns NomSg => bisadi ; Numerative => bisadood } ; - sg = defAllomorph wiilka ; - pl = defAllomorph wiilasha ; + gda = defAllomorph wiilka wiilasha ; shortPoss = False } where { hooya : Str = case wiilka of { @@ -141,6 +139,15 @@ oper NounPhrase : Type = BaseNP ** {s : Case => Str} ; + NPLite : Type = {s : Str ; a : AgreementPlus} ; -- Used in Adv and as an object in VP + + nplite : NounPhrase -> NPLite = \np -> + let aplus : AgreementPlus = agr2agrplus np.isPron np.a in + case of { + => {s = np.s ! Abs ; a = aplus} ; + -- => {s = np.empty ++ (pronTable ! np.a).sp ; a = aplus} ; -- uncomment if you want to add long object pronoun for 3rd person object + _ => {s = np.empty ; a = aplus} } ; -- no long object for other pronouns + useN : Noun -> CNoun ** BaseNP = \n -> n ** { mod = \\_,_ => [] ; hasMod = False ; a = Sg3 (gender n) ; isPron,isPoss = False ; @@ -228,15 +235,13 @@ oper } } ; - -- Second series object pronouns, Sayeed p. 74-75 - -- For two non-3rd person object pronouns, e.g. "They took you away from me" - secondObject : Agreement => Str = table { - Sg1 => "kay" ; - Sg2 => "kaa" ; - Pl1 Excl => "kayo" ; - Pl1 Incl => "keen" ; - Pl2 => "kiin" ; - _ => [] + secondObject : AgreementPlus => Str = table { + IsPron Sg1 => "kay" ; + IsPron Sg2 => "kaa" ; + IsPron (Pl1 Excl) => "kayo" ; + IsPron (Pl1 Incl) => "keen" ; + IsPron Pl2 => "kiin" ; + _ => [] } ; -------------------------------------------------------------------------------- @@ -291,11 +296,11 @@ oper defQuant = defQuantBind True ; - defQuantBind : (bind : Bool) -> (s, kan, tan, kuwan : Str) -> Vowel -> Quant = \b,s,spm,spf,spp,v -> + defQuantBind : (bind : Bool) -> (s, kan, tan, kuwan : Str) -> (vowIsI : Bool) -> Quant = \b,s,spm,spf,spp,v -> let bind : Str -> Str = \x -> case b of {False => x ; True => BIND ++ x} ; in baseQuant ** { s = \\allomorph,c => - let nom = case v of {NA => "u" ; _ => s + "i"} + let nom = case v of {False => "u" ; _ => s + "i"} in case c of { Nom => bind (quantTable nom ! allomorph) ; _ => bind (quantTable s ! allomorph) } ; @@ -312,15 +317,11 @@ oper s = \\da,c => [] ; sp = \\gn,c => [] ; st = Indefinite ; --- v = NA ; -- Will be ignored in DetQuant } ; -------------------------------------------------------------------------------- -- Prepositions --- Prepositionen u dras obligatoriskt samman med föregående pronomen --- så att /a/ + /u/ > /oo/. - Prep : Type = {s : Agreement => Str} ; mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,loo -> { @@ -486,36 +487,36 @@ oper _ => "in" } ; in { s = table { - VPres Simple (Sg1|Sg3 Masc|Impers) pol + VPres Simple Sg1_Sg3Masc pol => qaat + if_then_Pol pol "aa" "o" ; - VPres Simple (Sg2|Sg3 Fem) pol + VPres Simple Sg2_Sg3Fem pol => arag + t + if_then_Pol pol "aa" "o" ; - VPres Simple (Pl1 _) pol => arag + n + if_then_Pol pol "aa" "o" ; - VPres Simple Pl2 pol => arag + t + "aan" ; - VPres Simple Pl3 pol => qaat + "aan" ; + VPres Simple Pl1_ pol => arag + n + if_then_Pol pol "aa" "o" ; + VPres Simple Pl2_ pol => arag + t + "aan" ; + VPres Simple Pl3_ pol => qaat + "aan" ; - VPres Progressive (Sg1|Sg3 Masc|Impers) pol - => progr + if_then_Pol pol "aa" "o" ; - VPres Progressive (Sg2|Sg3 Fem) pol - => progr + if_then_Pol pol "saa" "so" ; - VPres Progressive (Pl1 _) pol - => progr + if_then_Pol pol "naa" "no" ; - VPres Progressive Pl2 pol => progr + "saan" ; - VPres Progressive Pl3 pol => progr + "aan" ; + VPres Progressive Sg1_Sg3Masc pol + => progr + if_then_Pol pol "aa" "o" ; + VPres Progressive Sg2_Sg3Fem pol + => progr + if_then_Pol pol "saa" "so" ; + VPres Progressive Pl1_ pol + => progr + if_then_Pol pol "naa" "no" ; + VPres Progressive Pl2_ pol => progr + "saan" ; + VPres Progressive Pl3_ pol => progr + "aan" ; - VPast Simple (Sg1|Sg3 Masc|Impers) + VPast Simple Sg1_Sg3Masc => qaat + ay ; - VPast Simple (Sg2|Sg3 Fem) => arag + t + ay ; -- t, d or s - VPast Simple (Pl1 _) => arag + n + ay ; - VPast Simple Pl2 => arag + t + "een" ; -- t, d or s - VPast Simple Pl3 => qaat + "een" ; + VPast Simple Sg2_Sg3Fem => arag + t + ay ; -- t, d or s + VPast Simple Pl1_ => arag + n + ay ; + VPast Simple Pl2_ => arag + t + "een" ; -- t, d or s + VPast Simple Pl3_ => qaat + "een" ; - VPast Progressive (Sg1|Sg3 Masc|Impers) + VPast Progressive Sg1_Sg3Masc => progr + "ey" ; - VPast Progressive (Sg2|Sg3 Fem) => progr + "sey" ; - VPast Progressive (Pl1 _) => progr + "ney" ; - VPast Progressive Pl2 => progr + "seen" ; - VPast Progressive Pl3 => progr + "een" ; + VPast Progressive Sg2_Sg3Fem => progr + "sey" ; + VPast Progressive Pl1_ => progr + "ney" ; + VPast Progressive Pl2_ => progr + "seen" ; + VPast Progressive Pl3_ => progr + "een" ; VNegPast Simple => arkin ; VNegPast Progressive => progr + "n" ; @@ -569,46 +570,44 @@ oper ------------------ -- Irregular verbs + presCopula : {agr:Agreement ; pol:Polarity} => Str = + \\a => case of { + => if_then_Pol pol "ahay" "ihi" ; + => if_then_Pol pol "tahay" "ihid" ; + <(Sg3 Masc|Impers),pol> => if_then_Pol pol "yahay" "aha" ; + <(Sg3 Fem),pol> => if_then_Pol pol "tahay" "aha" ; + <(Pl1 _),pol> => if_then_Pol pol "nahay" "ihin" ; + => if_then_Pol pol "tihiin" "ihidin" ; + => if_then_Pol pol "yihiin" "aha" + } ; copula : Verb = { s = table { - VPres _ Sg1 pol => if_then_Pol pol "ahay" "ihi" ; - VPres _ Sg2 pol => if_then_Pol pol "tahay" "ihid" ; - VPres _ (Sg3 Masc|Impers) pol => if_then_Pol pol "yahay" "aha" ; - VPres _ (Sg3 Fem) pol => if_then_Pol pol "tahay" "aha" ; - VPres _ (Pl1 _) pol => if_then_Pol pol "nahay" "ihin" ; - VPres _ Pl2 pol => if_then_Pol pol "tihiin" "ihidin" ; - VPres _ Pl3 pol => if_then_Pol pol "yihiin" "aha" ; - VImp Sg pol => if_then_Pol pol "ahaw" "ahaanin" ; - VImp Pl pol => if_then_Pol pol "ahaada" "ahaanina" ; - - VPast _ (Sg1|Sg3 Masc|Impers) + VPast _ Sg1_Sg3Masc => "ahaa" ; - VPast _ (Sg2|Sg3 Fem) + VPast _ Sg2_Sg3Fem => "ahayd" ; - VPast _ (Pl1 _) => "ahayn" ; - VPast _ Pl2 => "ahaydeen" ; - VPast _ Pl3 => "ahaayeen" ; - VNegPast _ => "ahi" ; + VPast _ Pl1_ => "ahayn" ; + VPast _ Pl2_ => "ahaydeen" ; + VPast _ Pl3_ => "ahaayeen" ; + VNegPast _ => "ahi" ; VRel => "ah" ; - VInf => "ahaan" } ; + VInf => "ahaan" ; + VImp Sg pol => if_then_Pol pol "ahaw" "ahaanin" ; + VImp Pl pol => if_then_Pol pol "ahaada" "ahaanina" ; + VPres _ _ _ => nonExist -- use presCopula instead + } ; sii, dhex = [] } ; - -- I somaliskan används inte något kopulaverb motsvarande svenskans är mellan - -- två substantivfraser som utgör subjekt respektive predikatsfyllnad. - -- Observera också att kopulaverbet vara alltid hamnar efter det adjektiv - -- som utgör predikatsfyllnaden. + have_V : Verb = let hold_V = mkVerb "hayso" "haysat" "haysa" in hold_V ** { s = table { - VPres _ Sg1 Pos => "leeyahay" ; - VPres _ Sg2 Pos => "leedahay" ; - VPres _ (Sg3 Fem) Pos => "leedahay" ; - VPres _ (Sg3 Masc|Impers) Pos - => "leeyahay" ; - VPres _ (Pl1 _) Pos => "leenahay" ; - VPres _ Pl2 Pos => "leedihiin" ; - VPres _ Pl3 Pos => "leeyihiin" ; + VPres _ Sg1_Sg3Masc Pos => "leeyahay" ; + VPres _ Sg2_Sg3Fem Pos => "leedahay" ; + VPres _ Pl1_ Pos => "leenahay" ; + VPres _ Pl2_ Pos => "leedihiin" ; + VPres _ Pl3_ Pos => "leeyihiin" ; VPast asp agr => "l" + copula.s ! VPast asp agr ; VRel => "leh" ; x => hold_V.s ! x } @@ -636,7 +635,7 @@ oper Adverb : Type = BaseAdv ** { c2 : Preposition ; -- adverbs can contribute to preposition contraction. - np : NounPhrase -- NP from PrepNP can be promoted into a core argument. + np : NPLite ; -- NP from PrepNP can be promoted into a core argument. } ; Complement : Type = { @@ -648,7 +647,7 @@ oper -- Prepositions can combine together and with object pronoun. c2 : PrepositionPlus ; -- hack to implement passives more efficiently: c3 : Preposition ; -- if c2 is Passive, the real preposition is in c3. - obj2 : {s : Str ; a : AgreementPlus} ; + obj2 : NPLite ; -- {s : Str ; a : AgreementPlus} secObj : Str ; -- if two overt pronoun objects vComp : Str ; -- VV complement refl : Str ; -- reflexive is put here, if the verb has an obj2. @@ -663,7 +662,7 @@ oper vComp,berri,miscAdv,refl = [] ; c2 = P NoPrep ; c3 = NoPrep ; - obj2 = {s = [] ; a = Unassigned} ; + obj2 = {s = [] ; a = NotPronP3} ; secObj = [] } ; @@ -696,42 +695,35 @@ oper } ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> - let noun : Str = case of { - => np.s ! Abs ; - -- => np.empty ++ (pronTable ! np.a).sp ; -- uncomment if you want to add long object pronoun for 3rd person object - _ => np.empty } -- no long object for other pronouns - in case vp.obj2.a of { - Unassigned => - vp ** {obj2 = { - s = noun ; - a = agr2agrplus np.isPron np.a} - } ; + insertCompAgrPlus vp (nplite np) ; - -- If the old object is 3rd person, we can safely replace its agreement. + insertCompAgrPlus : VPSlash -> NPLite -> VerbPhrase = \vp,nplite -> + case vp.obj2.a of { + -- If the old object is 3rd person (or nonexistent), we replace its agreement. -- We keep both old and new string (=noun, if there was one) in obj2.s. 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. + vp ** {obj2 = nplite ** { + s = vp.obj2.s ++ nplite.s} + } ; -- no secObj, because there's ≤1 non-3rd-person pronoun. -- If old object was non-3rd person, we keep its agreement. + -- The new object is put in the secondObject field. _ => vp ** {obj2 = vp.obj2 ** { - s = vp.obj2.s ++ noun + s = vp.obj2.s ++ nplite.s } ; - secObj = vp.secObj ++ secondObject ! np.a} + secObj = vp.secObj ++ secondObject ! nplite.a} } ; insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> - case of { - => vp ** adv'' ; -- a) the adverb is not formed with PrepNP, e.g. "tomorrow" - <_,True,False> => vp ** adv'' ; -- b) is formed with PrepNP, and has 3rd person obj, which is a noun. - _ => case of { + case of { --isP3 adv.np.a, adv.np.isPron> of { + => vp ** adv'' ; -- a) the adverb is not formed with PrepNP, e.g. "tomorrow" + <_,NotPronP3> => vp ** adv'' ; -- b) is formed with PrepNP, and has 3rd person obj, which is a noun. + _ => case of { -- if free complement slots, introduce adv.np with insertComp -

=> insertComp (vp ** {c2 = P adv.c2}) adv.np ** adv' ; - <_ ,_ ,NoPrep> => insertComp (vp ** {c3 = adv.c2}) adv.np ** adv' ; +

=> insertCompAgrPlus (vp ** {c2 = P adv.c2}) adv.np ** adv' ; + <_ ,_ ,NoPrep> => insertCompAgrPlus (vp ** {c3 = adv.c2}) adv.np ** adv' ; -- if complement slots are full, just insert strings. _ => vp ** adv'' @@ -739,8 +731,8 @@ oper } where { adv' : {sii,dhex,berri : Str} = adv ; -- adv.np done with insertComp adv'' : {sii,dhex,berri,miscAdv : Str} -- adv.np inserted into miscAdv - = adv ** {dhex = (prepTable ! P adv.c2).s ! adv.np.a ++ adv.dhex ; - miscAdv = adv.np.s ! Abs} -- TODO: check case + = adv ** {dhex = (prepTable ! P adv.c2).s ! agrplus2agr adv.np.a ++ adv.dhex ; + miscAdv = adv.np.s} } ; -------------------------------------------------------------------------------- -- Sentences etc. @@ -755,10 +747,11 @@ oper let predRaw : {fin : Str ; inf : Str} = vf t a p subj.a vp ; pred : {fin : Str ; inf : Str} = case of { => {fin,inf = []} ; + <_ , _,Copula> => {fin = presCopula ! {agr=subj.a ; pol=p} ; inf=[]} ; _ => predRaw } ; - subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ; - subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) [] ; + subjnoun : Str = if_then_Str np.isPron np.empty (subj.s ! Nom) ; + 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 { @@ -804,8 +797,8 @@ oper -> {fin : Str ; inf : Str} = \t,ant,p,agr,vp -> case of { => {fin = presV vp ; inf = [] } ; - => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing => {fin = pastV vp ; inf = [] } ; + => {fin = presCopula ! agrPol ; inf = vp.s ! VInf } ; ---- just guessing => {fin = pastV (cSug "jir") ; inf = vp.s ! VInf} ; => {fin = presV (cSug "doon") ; inf = vp.s ! VInf} ; => {fin = pastV (cSug "doon") ; inf = vp.s ! VInf} ; @@ -813,11 +806,12 @@ oper => {fin = pastV have_V ; inf = vp.s ! VInf} -- TODO check } where { + agrPol : {agr:Agreement ; pol:Polarity} = {agr=agr; pol=p} ; pastV : Verb -> Str = \v -> case p of { Neg => v.s ! VNegPast Simple ; - Pos => v.s ! VPast Simple agr } ; + Pos => v.s ! VPast Simple (agr2vagr agr) } ; - presV : Verb -> Str = \v -> v.s ! VPres Simple agr p ; + presV : Verb -> Str = \v -> v.s ! VPres Simple (agr2vagr agr) p ; } ; infVP : VerbPhrase -> Str = \vp -> @@ -849,8 +843,8 @@ oper linAdv : Adverb -> Str = \adv -> adv.berri ++ adv.sii - ++ (prepTable ! P adv.c2).s ! adv.np.a + ++ (prepTable ! P adv.c2).s ! Pl3 --adv.np.a ++ adv.dhex - ++ adv.np.s ! Abs ; + ++ adv.np.s ; } diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index 4715ec0b..320e89f5 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -70,8 +70,8 @@ lin someSg_Det = R.indefDet "" sg ; lin no_Quant = mkPrep no_Quant -} -lin that_Quant = defQuant "aas" "kaas" "taas" "kuwaas" vA ; -lin this_Quant = defQuant "an" "kan" "tan" "kuwan" vA ; +lin that_Quant = defQuant "aas" "kaas" "taas" "kuwaas" True ; +lin this_Quant = defQuant "an" "kan" "tan" "kuwan" True ; --lin which_IQuant = defQuant {- @@ -125,7 +125,7 @@ lin with_Prep = mkPrep la ; youSg_Pron = pronTable ! Sg2 ; he_Pron = pronTable ! Sg3 Masc ; she_Pron = pronTable ! Sg3 Fem ; - we_Pron = pronTable ! Pl1 Excl ; + we_Pron = pronTable ! Pl1 Incl ; youPl_Pron = pronTable ! Pl2 ; they_Pron = pronTable ! Pl3 ; {- diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 1c20a6e4..3b7e707a 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -15,8 +15,10 @@ lin ReflVP = ResSom.insertRefl ; -- : VV -> VP -> VP ; - ComplVV vv vp = useV vv ** { -- check Sayeed p. 169 - vComp = infVP vp + ComplVV vv vp = vp ** { -- check Sayeed p. 169 + s = vv.s ; + vComp = vp.vComp ++ vp.s ! VInf ; + pred = NoPred ; } ; {- -- : VS -> S -> VP ; From 6817734f8d2a4e375797b884a1579504492d4e57 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 22 Jul 2019 21:42:40 +0300 Subject: [PATCH 3/3] (Som) Remove already implemented functions from MissingSom --- src/somali/MissingSom.gf | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/somali/MissingSom.gf b/src/somali/MissingSom.gf index 16f6358c..6d3ad2ee 100644 --- a/src/somali/MissingSom.gf +++ b/src/somali/MissingSom.gf @@ -18,8 +18,6 @@ oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ; oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ; oper AdvS : Adv -> S -> S = notYet "AdvS" ; oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; -oper AdvVP : VP -> Adv -> VP = notYet "AdvVP" ; -oper AdvVPSlash : VPSlash -> Adv -> VPSlash = notYet "AdvVPSlash" ; oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ; oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ; oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ; @@ -33,22 +31,17 @@ oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; oper CompAdv : Adv -> Comp = notYet "CompAdv" ; -oper CompCN : CN -> Comp = notYet "CompCN" ; oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; oper CompIP : IP -> IComp = notYet "CompIP" ; -oper CompNP : NP -> Comp = notYet "CompNP" ; oper ComparA : A -> NP -> AP = notYet "ComparA" ; oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ; -oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ; oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; -oper ComplSlash : VPSlash -> NP -> VP = notYet "ComplSlash" ; oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ; oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ; oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; -oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ; oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ; oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ; oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ; @@ -86,7 +79,6 @@ oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ; oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; oper GenericCl : VP -> Cl = notYet "GenericCl" ; oper IdRP : RP = notYet "IdRP" ; -oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ; oper IdetIP : IDet -> IP = notYet "IdetIP" ; oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ; @@ -118,7 +110,6 @@ oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ; oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ; oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ; oper ReflA2 : A2 -> AP = notYet "ReflA2" ; -oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; oper RelCN : CN -> RS -> CN = notYet "RelCN" ; oper RelCl : Cl -> RCl = notYet "RelCl" ; oper RelNP : NP -> RS -> NP = notYet "RelNP" ; @@ -131,15 +122,12 @@ oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ; oper SelfNP : NP -> NP = notYet "SelfNP" ; oper SentAP : AP -> SC -> AP = notYet "SentAP" ; oper SentCN : CN -> SC -> CN = notYet "SentCN" ; -oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; -oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ; oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ; oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ; oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; -oper SlashV2a : V2 -> VPSlash = notYet "SlashV2a" ; oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ; oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ; @@ -150,10 +138,8 @@ oper UseA2 : A2 -> AP = notYet "UseA2" ; oper UseComparA : A -> AP = notYet "UseComparA" ; oper UseN2 : N2 -> CN = notYet "UseN2" ; oper UsePN : PN -> NP = notYet "UsePN" ; -oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ; oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ; oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; -oper UseV : V -> VP = notYet "UseV" ; oper UttCard : Card -> Utt = notYet "UttCard" ; oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ; oper UttIP : IP -> Utt = notYet "UttIP" ; @@ -163,7 +149,6 @@ oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ; oper UttInterj : Interj -> Utt = notYet "UttInterj" ; oper UttQS : QS -> Utt = notYet "UttQS" ; oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ; -oper above_Prep : Prep = notYet "above_Prep" ; oper active2passive : Cl -> Cl = notYet "active2passive" ; oper add_V3 : V3 = notYet "add_V3" ; oper after_Prep : Prep = notYet "after_Prep" ;