From 8c11c9e37287fb00a90ae2b99c6295a1d5a9c5d8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 19 Jul 2019 12:35:20 +0300 Subject: [PATCH 1/4] (Som) Add empty Str field to NP so every NP contributes with some string Otherwise parsing sentences with pronoun objects gives metavariables. --- src/somali/NounSom.gf | 5 +++-- src/somali/ResSom.gf | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index e1d7d12c..5ae95f4a 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -44,7 +44,8 @@ DetCN det cn = useN cn ** { -- : PN -> NP ; UsePN pn = pn ** { s = \\c => pn.s ; - isPron = False + isPron = False ; + empty = [] ; } ; -- : Pron -> NP ; @@ -73,7 +74,7 @@ DetCN det cn = useN cn ** { -- Determiners can form noun phrases directly. -- : Det -> NP ; - DetNP det = { + DetNP det = emptyNP ** { s = det.sp ! Masc ; ---- Any way to decide for gender here? a = getAgr det.n Masc ; isPron = False ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 7d677ccc..0529e6f0 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -136,6 +136,7 @@ oper BaseNP : Type = { a : Agreement ; isPron : Bool ; + empty : Str ; } ; NounPhrase : Type = BaseNP ** {s : Case => Str} ; @@ -143,12 +144,14 @@ oper useN : Noun -> CNoun ** BaseNP = \n -> n ** { mod = \\_,_ => [] ; hasMod = False ; a = Sg3 (gender n) ; isPron,isPoss = False ; + empty = [] ; } ; emptyNP : NounPhrase = { s = \\_ => [] ; a = Pl3 ; - isPron = False + isPron = False ; + empty = [] ; } ; impersNP : NounPhrase = emptyNP ** { @@ -172,46 +175,55 @@ oper Sg1 => { s = table {Nom => "aan" ; Abs => "i"} ; a = Sg1 ; isPron = True ; sp = "aniga" ; + empty = [] ; poss = {s = quantTable "ayg" "ayd" ; short = quantTable "ay" ; sp = gnTable "ayg" "ayd" "uwayg"} } ; Sg2 => { s = table {Nom => "aad" ; Abs => "ku"} ; a = Sg2 ; isPron = True ; sp ="adiga" ; + empty = [] ; poss = {s = quantTable "aag" "aad" ; short = quantTable "aa" ; sp = gnTable "aag" "aad" "uwaag"} } ; Sg3 Masc => { s = table {Nom => "uu" ; Abs => []} ; a = Sg3 Masc ; isPron = True ; sp ="isaga" ; + empty = [] ; poss = {s, short = quantTable "iis" ; sp = gnTable "iis" "iis" "uwiis"} } ; Sg3 Fem => { s = table {Nom => "ay" ; Abs => []} ; a = Sg3 Fem ; isPron = True ; sp = "iyada" ; + empty = [] ; poss = {s, short = quantTable "eed" ; sp = gnTable "eed" "eed" "uweed"} } ; Pl1 Excl => { s = table {Nom => "aan" ; Abs => "na"} ; a = Pl1 Excl ; isPron = True ; sp ="annaga" ; + empty = [] ; poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"} } ; Pl1 Incl => { s = table {Nom => "aynu" ; Abs => "ina"} ; a = Pl1 Incl ; isPron = True ; sp ="innaga" ; + empty = [] ; poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"} } ; Pl2 => { s = table {Nom => "aad" ; Abs => "idin"} ; a = Pl2 ; isPron = True ; sp ="idinka" ; + empty = [] ; poss = {s = quantTable "iinn" ; short = quantTable "iin" ; sp = gnTable "iinn" "iinn" "uwiinn"} } ; Pl3 => { s = table {Nom => "ay" ; Abs => []} ; a = Pl3 ; isPron = True ; sp = "iyaga" ; + empty = [] ; poss = {s, short = quantTable "ood" ; sp = gnTable "ood" "ood" "uwood"} } ; Impers => { s = table {Nom => "la" ; Abs => "??"} ; a = Impers ; isPron = True ; sp = "??" ; + empty = [] ; poss = {s, short = quantTable "??" ; sp = gnTable "??" "??" "??"} } } ; @@ -684,8 +696,8 @@ oper insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> let noun : Str = case of { => np.s ! Abs ; - -- => (pronTable ! np.a).sp ; -- uncomment if you want to add long object pronoun for 3rd person object - _ => [] } -- no long object for other pronouns + -- => 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 = { From 56be17ccf94f42ce5b597e87c11bc1912743de8c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 19 Jul 2019 13:53:58 +0300 Subject: [PATCH 2/4] (Som) Add GenericCl --- src/somali/IdiomSom.gf | 5 +++-- src/somali/ResSom.gf | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/somali/IdiomSom.gf b/src/somali/IdiomSom.gf index 641d03a3..19450eaf 100644 --- a/src/somali/IdiomSom.gf +++ b/src/somali/IdiomSom.gf @@ -6,13 +6,14 @@ concrete IdiomSom of Idiom = CatSom ** open Prelude, ResSom, VerbSom in { -- This module defines constructions that are formed in fixed ways, -- often different even in closely related languages. - --lin + lin -- : VP -> Cl ; -- it is hot --ImpersCl = ; -- : VP -> Cl ; -- one sleeps - --GenericCl = ; + GenericCl vp = predVP impersNP (passVP vp) ; + {- CleftNP : NP -> RS -> Cl ; -- it is I who did it CleftAdv : Adv -> S -> Cl ; -- it is here she slept diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 0529e6f0..663d13b1 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -671,9 +671,11 @@ oper c2 = P v2.c2 } ; - passV2 : Verb2 -> VerbPhrase = \v2 -> useV v2 ** { + passV2 : Verb2 -> VerbPhrase = \v2 -> passVP (useV v2) ; + + passVP : VerbPhrase -> VerbPhrase = \vp -> vp ** { c2 = Passive ; - c3 = v2.c2 ; + c3 = pp2prep vp.c2 ; } ; complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** { From c96ba57991798b17f31fca2e5d23306adb1e5d4d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 19 Jul 2019 13:54:57 +0300 Subject: [PATCH 3/4] (Som) New lexical items --- src/somali/LexiconSom.gf | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index 0a1f8b3a..fa1fe46f 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -4,7 +4,7 @@ concrete LexiconSom of Lexicon = CatSom ** ---- -- A --- lin add_V3 = +lin add_V3 = mkV3 "dar" ku NoPrep ; -- lin airplane_N = mkN "" ; -- lin alas_Interj = mkInterj "" ; -- lin already_Adv = mkA "" ; @@ -99,10 +99,10 @@ lin drink_V2 = mkV2 "cab" ; -- lin dry_A = mkA "" ; -- lin dull_A = mkA "" ; -- lin dust_N = mkN "" ; --- --- ---- --- -- E --- + +---- +-- E + -- lin ear_N = mkN "" ; -- lin earth_N = mkN "" ; lin eat_V2 = mkV2 "cun" ; @@ -110,10 +110,10 @@ lin eat_V2 = mkV2 "cun" ; -- lin empty_A = mkA "" ; -- lin enemy_N = mkN "" ; -- lin eye_N = mkN "" ; --- --- ---- --- -- F --- + +---- +-- F + -- lin factory_N = mkN "" ; -- lin fall_V = mkV "" ; -- lin far_Adv = mkA "" ; @@ -224,7 +224,7 @@ lin language_N = mkN "af" ; lin man_N = mkN "nin" ; -- lin married_A2 = mkA "" ; --- lin meat_N = mkN "" ; +lin meat_N = mkN "hilib" "hilbo" masc ; -- lin milk_N = mkN "" ; -- lin moon_N = mkN "" ; lin mother_N2 = mkN2 (shortPossN (mkN "hooyo")) ; @@ -294,11 +294,11 @@ lin read_V2 = mkV2 "akhri" ; -- lin rubber_N = mkN "" ; -- lin rule_N = mkN "" ; -- lin run_V = mkV "" ; --- --- ---- --- -- S --- --- lin salt_N = mkN "" ; + +---- +-- S + +lin salt_N = mkN "cusbo" ; -- lin sand_N = mkN "" ; -- lin say_VS = mkVS "" ; -- lin school_N = mkN "" ; From 404873802eef82d9f18bfe13e77c3682fb46a641 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 19 Jul 2019 13:55:24 +0300 Subject: [PATCH 4/4] (Som) Add unit tests about VPs --- src/somali/unittest/vp.gftest | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/somali/unittest/vp.gftest diff --git a/src/somali/unittest/vp.gftest b/src/somali/unittest/vp.gftest new file mode 100644 index 00000000..36ffe9ad --- /dev/null +++ b/src/somali/unittest/vp.gftest @@ -0,0 +1,39 @@ +-------------------------------------------------------------------------------- +-- Intransitive + +-- LangEng: they went +LangSom: waa ay tageen +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron they_Pron) (UseV go_V)))) NoVoc + +-------------------------------------------------------------------------------- +-- 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 were seen +LangSom: waa lagu arkay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron youSg_Pron) (PassV2 see_V2)))) NoVoc + +-------------------------------------------------------------------------------- +-- Ditransitive + +-- LangEng: mother gave you us +LangSom: hooyo waa ay na 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 +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 +LangSom: rooti waa uu is siiyey +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron he_Pron) (ReflVP (Slash2V3 give_V3 (MassNP (UseN bread_N))))))) NoVoc + +-- 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