From 4009dface9f67234678fb0559b972cabdbcc66fd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 3 Jun 2019 16:31:55 +0200 Subject: [PATCH 1/6] (Som) More forms for verbs and nouns --- src/somali/IdiomSom.gf | 9 +- src/somali/LexiconSom.gf | 8 +- src/somali/NounSom.gf | 49 ++++----- src/somali/ParadigmsSom.gf | 10 +- src/somali/ParamSom.gf | 44 ++++++--- src/somali/RelativeSom.gf | 6 ++ src/somali/ResSom.gf | 191 ++++++++++++++++++++++-------------- src/somali/StructuralSom.gf | 28 +++--- 8 files changed, 211 insertions(+), 134 deletions(-) diff --git a/src/somali/IdiomSom.gf b/src/somali/IdiomSom.gf index 726568e9..641d03a3 100644 --- a/src/somali/IdiomSom.gf +++ b/src/somali/IdiomSom.gf @@ -32,11 +32,12 @@ concrete IdiomSom of Idiom = CatSom ** open Prelude, ResSom, VerbSom in { -- : VP -> VP ; --ProgrVP vp = vp ** { } ; - -- : VP -> Utt ; -- let's go - --ImpPl1 vp = { } ; -{- - ImpP3 : NP -> VP -> Utt ; -- let John walk + {- TODO: Sayeed p. 92 optative + -- : VP -> Utt ; -- let's go + ImpPl1 vp = { } ; + + ImpP3 : NP -> VP -> Utt ; -- let John walk -- 3/12/2013 non-reflexive uses of "self" diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index 8ff7f2d6..83dbbb40 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -1,5 +1,5 @@ concrete LexiconSom of Lexicon = CatSom ** - open ParadigmsSom in { + open ParadigmsSom,ResSom in { ---- -- A @@ -118,7 +118,7 @@ lin drink_V2 = mkV2 "cab" ; -- lin fall_V = mkV "" ; -- lin far_Adv = mkA "" ; -- lin fat_N = mkN "" ; -lin father_N2 = mkN2 (shortPossN (mkN "aabbe")) noPrep ; +lin father_N2 = mkN2 (shortPossN (mkN "aabbe")) Gen ; -- lin fear_V2 = mkV2 "" ; -- lin fear_VS = mkVS "" ; -- lin feather_N = mkN "" ; @@ -227,7 +227,7 @@ lin man_N = mkN "nin" ; -- lin meat_N = mkN "" ; -- lin milk_N = mkN "" ; -- lin moon_N = mkN "" ; -lin mother_N2 = mkN2 (shortPossN (mkN "hooyo")) noPrep ; +lin mother_N2 = mkN2 (shortPossN (mkN "hooyo")) Gen ; -- lin mountain_N = mkN "" ; -- lin mouth_N = mkN "" ; -- lin music_N = mkN "" ; @@ -389,7 +389,7 @@ lin teach_V2 = mkV2 "baray" ku ; -- I suppose this creates progressive forms? TO -------- -- W - Y --- lin wait_V2 = mkV2 "" ; +lin wait_V2 = mkV2 "sug" ; -- lin walk_V = mkV "" ; -- lin war_N = mkN "" ; -- lin warm_A = mkA "" ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index 0c15dc43..0cce3c74 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -9,24 +9,28 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { -- : Det -> CN -> NP DetCN det cn = useN cn ** { s = sTable ; - a = getAgr det.d cn.g ; - sp = sTable ! Nom } - where { + a = getAgr det.d cn.g } where { sTable : Case => Str = \\c => let nfc : {nf : NForm ; c : Case} = case of { - => {nf=IndefNom ; c=Nom} ; -- special form for fem. nouns - => {nf=Def x vU ; c=Nom} ; -- special case for DefArt - => {nf=det.d ; c=Abs} ; -- If cn has modifier, the Nom ending attaches to the modifier + -- special form for fem. nouns + => {nf=GenSg ; c=c} ; + => {nf=GenPl ; c=c} ; + => {nf=NomSg ; c=c} ; + -- special case for DefArt+Nom: override vowel + => {nf=Def x vU ; c=c} ; + -- If cn has modifier, Nom ending attaches to the modifier + => {nf=det.d ; c=Abs} ; _ => {nf=det.d ; c=c} } ; + nf : NForm = case det.isNum of {True => Numerative ; _ => nfc.nf} ; detStr : Str = case of { => det.shortPoss ; _ => det.s ! nfc.c } ; in det.pref -- if det is numeral. TODO find out if gender/case/other distinction. - ++ cn.s ! nfc.nf + ++ cn.s ! nf ++ detStr -- non-numeral det ++ cn.mod ! getNum (getAgr det.d Masc) ! c } ; @@ -34,11 +38,11 @@ DetCN det cn = useN cn ** { -- : PN -> NP ; UsePN pn = pn ** { s = \\c => pn.s ; - isPron = False ; - sp = pn.s } ; + isPron = False + } ; -- : Pron -> NP ; - UsePron pron = lin NP pron ; + UsePron pron = pron ; -- : Predet -> NP -> NP ; -- only the man PredetNP predet np = np ** { @@ -66,13 +70,14 @@ DetCN det cn = useN cn ** { DetNP det = { s = det.sp ! Masc ; ---- Any way to decide for gender here? a = getAgr det.d Masc ; - isPron = False ; sp = [] + isPron = False ; } ; -- MassNP : CN -> NP ; MassNP cn = useN cn ** { - s = table { Nom => cn.s ! IndefNom ++ cn.mod ! Sg ! Nom ; - Abs => cn.s ! Indef Sg ++ cn.mod ! Sg ! Abs } + s = table { Nom => cn.s ! NomSg ++ cn.mod ! Sg ! Nom ; + -- Gen => cn.s ! PlGen ++ cn.mod ! Sg ! Gen ; -- TODO Do we ever need plural genitive? + c => cn.s ! Indef Sg ++ cn.mod ! Sg ! c } } ; @@ -87,12 +92,13 @@ DetCN det cn = useN cn ** { sp = \\g => case of { => quant.sp ! SgMasc ; => quant.sp ! SgFem ; - => quant.sp ! InvarPl } ; + => quant.sp ! PlInv } ; d = case of { => Numerative ; => Def num.n quant.v ; => Indef num.n } ; + isNum = num.isNum ; } ; -- : Quant -> Num -> Ord -> Det ; -- these five best @@ -150,14 +156,14 @@ DetCN det cn = useN cn ** { let p = pron.poss ; gntbl = gnTable (BIND ++ p.sp ! SgMasc) (BIND ++ p.sp ! SgFem) - (BIND ++ p.sp ! InvarPl) + (BIND ++ p.sp ! PlInv) in DefArt ** { shortPoss = BIND ++ p.s ; isPoss = True ; - s = \\c => let casevow = case c of {Nom => "u" ; Abs => "a"} + s = \\c => let casevow = case c of {Nom => "u" ; Abs => "a" ; _ => "TODO:case"} in gntbl ! SgMasc ++ BIND ++ casevow ; sp = \\gn,c => let prefix = case gn of {SgFem => "t" ; _ => "k"} ; - casevow = case c of {Nom => "u" ; Abs => "a"} + casevow = case c of {Nom => "u" ; Abs => "a"; _ => "TODO:case"} in prefix ++ gntbl ! gn ++ BIND ++ casevow ; v = p.v } ; @@ -168,12 +174,11 @@ DetCN det cn = useN cn ** { -- : N2 -> CN ; UseN,UseN2 = ResSom.useN ; -{- -- : N2 -> NP -> CN ; -- mother of the king ComplN2 n2 np = - let compl = applyPost n2.compl1 np ; - in useN n2 ** { s = \\agr => compl ++ n2.s } ; - + let cn = useN n2 in + cn ** {s = \\c => cn.s ! c ++ np.s ! n2.c2 } ; +{- -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) ComplN3 n3 np = let compl = applyPost n3.c3 np ; @@ -187,7 +192,7 @@ DetCN det cn = useN cn ** { Use3N3 n3 = lin N2 n3 ; -- : AP -> CN -> CN AdjCN ap cn = cn ** { - s = table { IndefNom => cn.s ! Indef Sg ; -- When an adjective is added, noun loses case marker. + s = table { NomSg => cn.s ! Indef Sg ; -- When an adjective is added, noun loses case marker. x => cn.s ! x } ; mod = \\n,c => cn.mod ! n ! Abs -- If there was something before, it is now in Abs ++ ap.s ! AF n c ; diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index 63ea6ab5..f26412ca 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -44,8 +44,8 @@ oper mkN2 : overload { mkN2 : Str -> N2 ; -- Predictable N2, no preposition - mkN2 : Str -> Preposition -> N2 ; -- Predictable N2, given preposition - mkN2 : N -> Preposition -> N2 -- N2 out of noun and preposition + mkN2 : Str -> Case -> N2 ; -- Predictable N2, given preposition + mkN2 : N -> Case -> N2 -- N2 out of noun and preposition } ; mkPN : overload { @@ -165,9 +165,9 @@ oper = \n -> n ** {shortPoss = True} ; mkN2 = overload { - mkN2 : Str -> N2 = \s -> lin N2 (mkN1 s ** {c2 = noPrep}) ; - mkN2 : Str -> Preposition -> N2 = \s,p -> lin N2 (mkN1 s ** {c2 = p}) ; - mkN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2=p}) + mkN2 : Str -> N2 = \s -> lin N2 (mkN1 s ** {c2 = Gen}) ; + mkN2 : Str -> Case -> N2 = \s,p -> lin N2 (mkN1 s ** {c2 = p}) ; + mkN2 : N -> Case -> N2 = \n,p -> lin N2 (n ** {c2=p}) } ; mkPN = overload { diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index f39d307f..851e9a71 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -60,10 +60,10 @@ oper -- Nouns param - Case = Nom | Abs ; + Case = Nom | Abs | Gen ; -- | Voc exists for some words Gender = Masc | Fem ; Vowel = vA | vE | vI | vO | vU | NA ; -- For vowel assimilation - GenNum = SgMasc | SgFem | InvarPl ; -- For Quant + GenNum = SgMasc | SgFem | PlInv ; -- For Quant Inclusion = Excl | Incl ; Agreement = @@ -80,9 +80,9 @@ param NForm = Indef Number | Def Number Vowel -- Stems for definite and determinative suffixes - | Numerative -- When modified by a number (only distinct for some feminine nouns) - | IndefNom ; -- Special form, only fem. nouns ending in consonant - + -- Special forms only for fem. nouns ending in consonant. + | Numerative -- When modified by a number: either pl gen or sg abs + | NomSg | GenSg | GenPl ; oper getAgr : NForm -> Gender -> Agreement = \n,g -> @@ -133,20 +133,40 @@ oper -------------------------------------------------------------------------------- -- Verbs +-- Sayeed p. 84-85 +-- Tense: Past/Present/Future +-- Aspect: Simple/Progressive/Habitual +-- Mood: Declarative/Imperative/Conditional/Optative/Potential +-- Negation: Positive/Negative +-- Sentence subordination: Main/Subordinate +-- Not every possible combination of these categories occurs, as we shall see: for example, tense and aspect are only marked in declarative sentences; there is no negation in potential sentences, etc. We can group the possible combinations into the twelve verbal paradigms below, details of which are given in the next three sections for suffix verbs, prefix verbs and yahay 'be': +-- 1. Imperative +-- 2. Infinitive +-- 3. Past simple +-- 4. Past progressive +-- 5. Past habitual +-- 6. Present habitual +-- 7. Present progressive +-- 8. Future +-- 9. Conditional +-- 10. Optative +-- 11. Potential +-- 12. Subordinate clause forms -- same as negative present. But they carry subject markers when made into SC. + param + + Aspect = Simple | Progressive ; + VForm = VInf - | VPres Agreement Polarity - | VNegPast - | VPast Agreement + | VPres Aspect Agreement Polarity + | VNegPast Aspect + | VPast Aspect Agreement | VRel -- "som är/har/…" TODO is this used in other verbs? - | VImp Number Polarity ; -- TODO negation + | VImp Number Polarity ; oper if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f -> case p of {Pos => t ; Neg => f } ; --- TODO: --- tre aspekter (enkel, progressiv, habituell), --- fem modus (indikativ, imperativ, konjunktiv, kontiditonalis, optativ) } diff --git a/src/somali/RelativeSom.gf b/src/somali/RelativeSom.gf index 4d5fbf96..a820850d 100644 --- a/src/somali/RelativeSom.gf +++ b/src/somali/RelativeSom.gf @@ -6,6 +6,12 @@ lin -- : Cl -> RCl ; -- such that John loves her RelCl cl = { } ; + -- Sayeed p. 95-96 + ch 8 +Reduced present general in relative clauses; as absolutive +1/2SG/3SG M/2PL/3PL sugá -- same as imperative (TODO check if for all conjugations) +3 SG F sugtá -- doesn't exist +1PL sugná -- doesn't exist + -- : RP -> VP -> RCl ; RelVP rp vp = ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 950d9416..d63c1854 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -5,8 +5,8 @@ resource ResSom = ParamSom ** open Prelude, Predef, ParamSom in { oper Noun : Type = {s : NForm => Str ; g : Gender ; shortPoss : Bool} ; - Noun2 : Type = Noun ** {c2 : Preposition} ; - Noun3 : Type = Noun2 ** {c3 : Preposition} ; + Noun2 : Type = Noun ** {c2 : Case} ; + Noun3 : Type = Noun2 ** {c3 : Case} ; CNoun : Type = Noun ** {mod : Number => Case => Str ; hasMod : Bool} ; @@ -18,9 +18,11 @@ oper let bisadi = case gender of { Fem => case wiil of { _ + #c => wiil+"i" ; _ => wiil} ; Masc => wiil } ; - bisadood = case gender of - { Fem => case wiilal of { _ + "o" => wiilal+"od" ; _ => wiil} ; - Masc => wiil } ; + genforms : {p1, p2 : Str} = case gender of + { Fem => case wiilal of {_ + "o" => ; _ => } ; + Masc => } ; + shimbireed = genforms.p1 ; + bisadood = genforms.p2 ; defStems : Str -> Vowel => Str = \s -> case s of { ilk + "aha" => table { vE => ilk+"eh" ; @@ -35,10 +37,14 @@ oper in { s = table { Indef Sg => wiil ; Indef Pl => wiilal ; - IndefNom => bisadi ; - Numerative => bisadood ; Def Sg vow => defStems wiilka ! vow ; - Def Pl vow => defStems wiilasha ! vow } ; + Def Pl vow => defStems wiilasha ! vow ; + -- Special forms for fem. nouns ending in consonant + NomSg => bisadi ; + GenSg => shimbireed ; + GenPl => bisadood ; + Numerative => case bisadood of {_+"ood" => bisadood ; _ => wiil} + } ; g = gender ; shortPoss = False} ; @@ -119,7 +125,7 @@ oper BaseNP : Type = { a : Agreement ; isPron : Bool ; - sp : Str } ; + } ; NounPhrase : Type = BaseNP ** {s : Case => Str} ; @@ -161,7 +167,8 @@ oper Determiner : Type = BaseQuant ** { pref : Str ; -- Numerals ? sp : Gender => Case => Str ; - d : NForm -- a combination of number, state and vowel + d : NForm ; -- combination of number, state and vowel + isNum : Bool ; -- whether to choose Numerative as the value of NForm } ; Quant : Type = BaseQuant ** { @@ -189,9 +196,9 @@ oper in baseQuant ** { s = \\c => let nom = case v of {NA => "u" ; _ => s + "i"} - in case c of {Abs => bind s ; Nom => bind nom} ; + in case c of {Nom => bind nom ; _ => bind s} ; sp = \\gn,c => - let i = case c of {Nom => "i"; Abs => []} + let i = case c of {Nom => "i"; _ => []} in gnTable (spm + i) (spf + i) (spp + i) ! gn ; st = Definite ; v = v ; @@ -285,7 +292,7 @@ oper -- ugu horrayntii (det att komma) allra först Adjective : Type = {s : AForm => Str} ; - Adjective2 : Type = Adjective ** { c2 : Preposition } ; + Adjective2 : Type = Adjective ** {c2 : Preposition} ; duplA : Str -> Adjective = \yar -> @@ -294,10 +301,10 @@ oper mkAdj : (str,pl : Str) -> Adjective = \sg,pl -> { s = table { - AF Sg Abs => sg ; - AF Pl Abs => pl ; AF Sg Nom => sg + "i" ; - AF Pl Nom => pl + "i" } + AF Pl Nom => pl + "i" ; + AF Sg _ => sg ; + AF Pl _ => pl } } ; duplicate : Str -> Str = \sg -> case sg of { @@ -327,6 +334,7 @@ oper Verb2 : Type = Verb ** {c2 : Preposition} ; Verb3 : Type = Verb2 ** {c3 : Preposition} ; + -- Saeed page 79: -- "… the reference form is the imperative singular form -- since it corresponds to the form of the basic root." @@ -346,6 +354,14 @@ oper "n" => arki ; -- if infinitive ends in n, no change; _ => arki + "n" } ; -- otherwise add n. + + progr : Str = case qaat of { -- Progressive + _ + "eey" => stems.p2 + "nay" ; -- bireey -> bireynay + _ + ("y"|"n") => init qaat + "nay" ; -- akhriy -> akhrinay ; gashad -> gashanay + _ + #v + "t" => qaat + "ay" ; + _ + #c + "t" => init qaat + "anay" ; + _ => qaat + "ay" } ; + -- Some predictable sound changes t : Str = case arag of { -- kari+seen, bixi noq+deen, (sug|joogsa|qaada)+teen, _ + ("i"|"y") => "s" ; -- t changes into s in front of i/y @@ -360,32 +376,50 @@ oper an : Str = case qaado of { _ + "o" => "an" ; -- Allomorph for imperatives _ => "in" } ; + in { s = table { - VPres (Sg1|Sg3 Masc|Impers) pol - => qaat + if_then_Pol pol "aa" "o" ; - VPres (Sg2|Sg3 Fem) pol - => arag + t + if_then_Pol pol "aa" "o" ; - VPres (Pl1 _) pol - => arag + n + if_then_Pol pol "aa" "o" ; - VPres Pl2 pol => arag + t + "aan" ; - VPres Pl3 pol => qaat + "aan" ; + VPres Simple (Sg1|Sg3 Masc|Impers) pol + => qaat + if_then_Pol pol "aa" "o" ; + VPres Simple (Sg2|Sg3 Fem) 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" ; - VPast (Sg1|Sg3 Masc|Impers) - => qaat + ay ; - VPast (Sg2|Sg3 Fem) - => arag + t + ay ; -- t, d or s - VPast (Pl1 _) => arag + n + ay ; - VPast Pl2 => arag + t + "een" ; -- t, d or s - VPast Pl3 => qaat + "een" ; + 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" ; - VImp Sg Pos => qaado ; + VPast Simple (Sg1|Sg3 Masc|Impers) + => 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 Progressive (Sg1|Sg3 Masc|Impers) + => progr + "ey" ; + VPast Progressive (Sg2|Sg3 Fem) => progr + "sey" ; + VPast Progressive (Pl1 _) => progr + "ney" ; + VPast Progressive Pl2 => progr + "seen" ; + VPast Progressive Pl3 => progr + "een" ; + + VNegPast Simple => arkin ; + VNegPast Progressive => progr + "n" ; + + + VImp Sg Pos => arag ; VImp Pl Pos => qaat + "a" ; VImp Sg Neg => arag + an ; VImp Pl Neg => qaat + "ina" ; VInf => arki ; - VRel => arki ; -- TODO does this exist? - VNegPast => arkin } + VRel => arki } ; -- TODO does this exist? } ; ------------------------- @@ -393,18 +427,26 @@ oper cSug, cKari, cYaree, cJoogso, cQaado : Str -> Verb ; + -- 1: Root verbs with no lexical affixes, e.g. sug TR 'wait for', kar INTR 'boil, cook'; cSug sug = let cabb : Str = case sug of { _ + "b" => sug + "b" ; -- TODO: more duplication patterns _ => sug } in mkVerb sug cabb sug ; + -- 2A: Verbs derived from root verbs by the causative affix -i/-is, e.g. kari TR 'cook' (from conjugation 1 kar INTR 'boil, cook'); + -- 2B: Verbs derived from nouns and adjectives by the causative/factitive affix -eel-ayn, e.g. yaree 'make small' (from yar ADJ 'small'); cKari, cYaree = \kari -> mkVerb kari (kari+"y") kari ; + -- 3A: Verbs derived from verbal stems by the middle voice affix -ol­/at + -- e.g. karsó 'cook for oneself (from conjugation 2 kâri TR 'cook'); cJoogso joogso = let joogsa = init joogso + "a" ; in mkVerb joogso (joogsa + "d") joogsa ; + -- 3B: As conjugation 3A but verbs whose syllable structure triggers + -- stem contraction and subsequent sandhi rules, e.g. qaadó 'take for oneself + -- (from conjugation 1 qàad TR 'take'). cQaado qaado = let qaa = init (init qaado) in mkVerb qaado -- Imperative sg, with the vowel @@ -421,24 +463,24 @@ oper 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" ; + 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|Sg3 Masc|Impers) => "ahaa" ; - VPast (Sg2|Sg3 Fem) + VPast _ (Sg2|Sg3 Fem) => "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" } } ; @@ -449,15 +491,15 @@ oper have_V : Verb = let hold_V = mkVerb "hayso" "haysat" "haysa" in { s = table { - VPres Sg1 Pos => "leeyahay" ; - VPres Sg2 Pos => "leedahay" ; - VPres (Sg3 Fem) Pos => "leedahay" ; - VPres (Sg3 Masc|Impers) Pos + 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" ; - VPast x => "l" + copula.s ! VPast x ; + 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 } } ; @@ -508,25 +550,28 @@ oper ClSlash, Sentence : Type = SS ; ---- TODO - doonaa : Str -> Verb = \inf -> - let doon : Verb = cSug "doon" in {s = \\vf => inf ++ doon.s ! vf} ; - vf : Tense -> Anteriority -> Polarity -> Agreement -> Verb -> {fin : Str ; inf : Str} = \t,ant,p,agr,vp -> - let pastV : Verb -> Str = \v -> - case p of { Neg => v.s ! VNegPast ; - Pos => v.s ! VPast agr } ; - presV : Verb -> Str = \v -> v.s ! VPres agr p ; - in case of { - => {fin = presV vp ; inf = [] } ; - => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing - => {fin = pastV vp ; inf = [] } ; - => {fin = pastV copula ; inf = vp.s ! VInf } ; ---- TODO: habitual aspect - => {fin = presV (doonaa (vp.s ! VInf)) ; inf = []} ; - => {fin = pastV (doonaa (vp.s ! VInf)) ; inf = []} ; - <_,Simul> => {fin = presV vp ; inf = []} ; -- TODO conditional - <_,Anter> => {fin = pastV vp ; inf = []} -- TODO conditional - } ; + case of { + => {fin = presV vp ; inf = [] } ; + => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing + => {fin = pastV vp ; inf = [] } ; + => {fin = pastV (aux "jir" vp) ; inf = []} ; + => {fin = presV (aux "doon" vp) ; inf = []} ; + => {fin = pastV (aux "doon" vp) ; inf = []} ; + <_,Simul> => {fin = presV vp ; inf = []} ; -- TODO conditional + <_,Anter> => {fin = pastV vp ; inf = []} -- TODO conditional + } + where { + pastV : Verb -> Str = \v -> + case p of { Neg => v.s ! VNegPast Simple ; + Pos => v.s ! VPast Simple agr } ; + + presV : Verb -> Str = \v -> v.s ! VPres Simple agr p ; + + aux : Str -> Verb -> Verb = \jir,v -> + let jir : Verb = cSug jir in {s = \\vf => v.s ! VInf ++ jir.s ! vf} + } ; stmarker : Agreement => Polarity => Str = \\a,b => let stm = if_then_Pol b "w" "m" @@ -547,5 +592,5 @@ oper oper linVP : VerbPhrase -> Str = \vp -> vp.s ! VInf ; ---- - linCN : CNoun -> Str = \cn -> cn.s ! IndefNom ; + linCN : CNoun -> Str = \cn -> cn.s ! NomSg ; } diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index 4951b194..8a856652 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -121,39 +121,39 @@ lin with_Prep = prepTable ! la ; -- Pronouns are closed class, no constructor in ParadigmsSom. i_Pron = { - s = table {Nom => "aan" ; Abs => "i"} ; - a = Sg1 ; isPron = True ; sp = "aniga" ; + s = table {Nom => "aan" ; Voc => "aniga" ; _Abs => "i"} ; + a = Sg1 ; isPron = True ; poss = {s = "ay" ; v = vA ; sp = gnTable "ayg" "ayd" "uwayg"} } ; youPol_Pron, -- TODO check youSg_Pron = { - s = table {Nom => "aad" ; Abs => "ku"} ; - a = Sg2 ; isPron = True ; sp = "adiga" ; + s = table {Nom => "aad" ; Voc => "adiga" ; _Abs => "ku"} ; + a = Sg2 ; isPron = True ; poss = {s = "aa" ; v = vA ; sp = gnTable "aag" "aad" "uwaag"} } ; he_Pron = { - s = table {Nom => "uu" ; Abs => []} ; - a = Sg3 Masc ; isPron = True ; sp = "isaga" ; + s = table {Nom => "uu" ; Voc => "isaga" ; _Abs => []} ; + a = Sg3 Masc ; isPron = True ; poss = {s = "iis" ; v = vI ; sp = gnTable "iis" "iis" "uwiis"} } ; she_Pron = { - s = table {Nom => "ay" ; Abs => []} ; - a = Sg3 Fem ; isPron = True ; sp = "iyada" ; + s = table {Nom => "ay" ; Voc => "iyada" ; _Abs => []} ; + a = Sg3 Fem ; isPron = True ; poss = {s = "eed" ; v = vE ; sp = gnTable "eed" "eed" "uweed"} } ; we_Pron = { - s = table {Nom => "aan" ; Abs => "na"} ; - a = Pl1 Incl ; isPron = True ; sp = "innaga" ; + s = table {Nom => "aan" ; Voc => "innaga" ; _Abs => "na"} ; + a = Pl1 Incl ; isPron = True ; poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} } ; youPl_Pron = { - s = table {Nom => "aad" ; Abs => "idin"} ; - a = Pl2 ; isPron = True ; sp = "idinka" ; + s = table {Nom => "aad" ; Voc => "idinka" ; _Abs => "idin"} ; + a = Pl2 ; isPron = True ; poss = {s = "iin" ; v = vI ; sp = gnTable "iinn" "iinn" "uwiinn"} } ; they_Pron = { - s = table {Nom => "ay" ; Abs => []} ; - a = Pl3 ; isPron = True ; sp = "iyaga" ; + s = table {Nom => "ay" ; Voc => "iyaga" ; _Abs => []} ; + a = Pl3 ; isPron = True ; poss = {s = "ood" ; v = vO ; sp = gnTable "ood" "ood" "uwood"} } ; {- From a9bd48ccdd334b2ddf887964e4f153ba885a3198 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 7 Jun 2019 18:44:29 +0200 Subject: [PATCH 2/6] (Som) VP, VPSlash, ComplSlash etc. --- src/somali/AdverbSom.gf | 4 +- src/somali/CatSom.gf | 4 +- src/somali/ParadigmsSom.gf | 8 ++-- src/somali/ParamSom.gf | 8 ++++ src/somali/ResSom.gf | 75 ++++++++++++++++++++++++++++++++----- src/somali/SentenceSom.gf | 5 +-- src/somali/StructuralSom.gf | 6 +-- src/somali/VerbSom.gf | 33 ++++++++-------- 8 files changed, 103 insertions(+), 40 deletions(-) diff --git a/src/somali/AdverbSom.gf b/src/somali/AdverbSom.gf index 0eaaabbd..5c77c658 100644 --- a/src/somali/AdverbSom.gf +++ b/src/somali/AdverbSom.gf @@ -11,12 +11,12 @@ lin -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- : Prep -> NP -> Adv ; - PrepNP prep np = {s = prep.s ! np.a ; s2 = np.s ! Abs} ; ---- ? + PrepNP prep np = prep ** {s = [] ; np = np} ; -- Adverbs can be modified by 'adadjectives', just like adjectives. --AdAdv : AdA -> Adv -> Adv ; -- very quickly - AdAdv ada adv = adv ** { s = ada.s ++ adv.s } ; + AdAdv ada adv = adv ** {s = ada.s ++ adv.s} ; -- Like adverbs, adadjectives can be produced by adjectives. -- : A -> AdA ; -- extremely diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 57eaded8..ee325a07 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -90,7 +90,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { -- Constructed in StructuralSom. Conj = { s1,s2 : Str ; n : Number } ; Subj = { s : Str ; isPre : Bool } ; --ba+dut vs. dut+en - Prep = ResSom.Prep ; + Prep = ResSom.Prep ** {c2 : Preposition} ; @@ -121,7 +121,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { N3 = ResSom.Noun3 ; PN = ResSom.PNoun ; - Adv = ResSom.Adverb ; + Adv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb. linref -- Cl = linCl ; diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index f26412ca..8fd6f78c 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -104,11 +104,11 @@ oper mkPrep = overload { mkPrep : Str -> CatSom.Prep = \s -> - lin Prep (ResSom.mkPrep s s s s s s) ; + lin Prep ((ResSom.mkPrep s s s s s s) ** {c2=noPrep}) ; mkPrep : (x1,_,_,_,_,x6 : Str) -> CatSom.Prep = \a,b,c,d,e,f -> - lin Prep (ResSom.mkPrep a b c d e f) ; + lin Prep ((ResSom.mkPrep a b c d e f) ** {c2=noPrep}) ; mkPrep : Preposition -> CatSom.Prep = \p -> - lin Prep (prepTable ! p) ; + lin Prep (prep p) ; } ; -- mkConj : (_,_ : Str) -> Number -> Conj = \s1,s2,num -> @@ -117,7 +117,7 @@ oper -- mkSubj : Str -> Bool -> Subj = \s,b -> -- lin Subj { } ; - mkAdv : Str -> Adv = \s -> lin Adv {s = s ; s2 = []} ; + mkAdv : Str -> Adv = \s -> lin Adv {s = s ; c2 = noPrep ; np = emptyNP} ; mkAdV : Str -> AdV = \s -> lin AdV {s = s} ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 851e9a71..f16a2f6c 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -75,6 +75,11 @@ param | Pl3 | 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. + | NotPronP3 ; -- Sg3 Gender and Pl3 can be pronouns or not. + State = Definite | Indefinite ; NForm = @@ -91,6 +96,9 @@ oper getNum : Agreement -> Number = \a -> case a of { Sg1|Sg2|Sg3 _ => Sg ; _ => Pl } ; + agr2agrplus : (isPron : Bool) -> Agreement -> AgreementPlus = \isPron,a -> + case isPron of {True => IsPron a ; False => NotPronP3} ; + -------------------------------------------------------------------------------- -- Adjectives diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index d63c1854..441c2f43 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -133,6 +133,12 @@ oper { mod = \\_,_ => [] ; hasMod = False ; a = Sg3 n.g ; isPron = False ; sp = [] } ; + + emptyNP : NounPhrase = { + s = \\_ => [] ; + a = Pl3 ; + isPron = False + } ; -------------------------------------------------------------------------------- -- Pronouns -- De somaliska possessiva pronomenen, precis som de svenska, har två olika genusformer i singular och en enda form i plural. @@ -232,6 +238,7 @@ oper _ => ku } } ; + prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! p ** {c2 = p} ; prepTable : Preposition => Prep = table { ku => mkPrep "ku" "igu" "kugu" "nagu" "idinku" "lagu" ; @@ -270,7 +277,6 @@ oper ula => "loola" ; kaga => "lagaga" ; kula => "lagula" ; kala => "lagala" ; Single p => (prepTable ! p).s ! Impers } ; --- a => table { ugu => "ugu" ; uga => "uga" ; ula => "ula" ; kaga => "kaga" ; kula => "kula" ; kala => "kala" ; @@ -517,7 +523,9 @@ oper ------------------ -- VP - Adverb : Type = {s,s2 : Str} ; + Adverb : Type = { + s : Str ; + c2 : Preposition ; np : NounPhrase} ; -- So that adverbs can also contribute to preposition contraction Complement : Type = { comp : Agreement => {p1,p2 : Str} -- Agreement for AP complements @@ -525,24 +533,71 @@ oper VerbPhrase : Type = Verb ** Complement ** { isPred : Bool ; -- to choose right sentence type marker - adv : Adverb ; -- they're ~complicated~ - c2, c3 : Preposition -- can combine together and with object pronouns + adv : Str ; + c2, c3 : Preposition ; -- can combine together and with object pronoun(s?) + obj2 : {s : Str ; a : AgreementPlus} ; } ; - VPSlash : Type = VerbPhrase ; ---- TODO more fields + VPSlash : Type = VerbPhrase ; useV : Verb -> VerbPhrase = \v -> v ** { comp = \\_ => <[],[]> ; isPred = False ; - adv = {s,s2 = []} ; + adv = [] ; c2,c3 = noPrep ; + obj2 = {s = [] ; a = Unassigned} ; } ; - compl : NounPhrase -> VerbPhrase -> Str = \np,vp -> - prepCombTable ! np.a ! combine vp.c2 vp.c3 ; + useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** { + c2 = v2.c2 + } ; - complV2 : NounPhrase -> Verb2 -> Str = \np,vp -> - prepCombTable ! np.a ! combine vp.c2 noPrep ; + complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** { + comp = \\a => + case np.a of { + Unassigned => vps.comp ! a ; + IsPron ag => {p1 = [] ; -- object is a pronoun => nothing is placed before the verb + p2 = compl np.a vps} ; -- object combines with the preposition of the verb + NotPronP3 => {p1 = np.s ; -- object is a noun => it will come before verb in the sentence + p2 = compl np.a vps} -- object combines with the preposition of the verb + } + } ; + + compl : AgreementPlus -> VerbPhrase -> Str = \a,vp -> + let agr = case a of {IsPron x => x ; _ => Pl3} ; + in "<" ++ prepCombTable ! agr ! combine vp.c2 vp.c3 ++ ">" ; + + insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> + let nps = if_then_Str np.isPron [] (np.s ! Abs) ; + in case vp.obj2.a of { + Unassigned => + vp ** {obj2 = {s = nps ; + a = agr2agrplus np.isPron np.a} + } ; + + -- If the old object in obj2 is 3rd person, we can safely replace its agreement, but keep its string. + NotPronP3|IsPron (Sg3 _|Pl3) => + vp ** {obj2 = vp.obj2 ** {a = agr2agrplus np.isPron np.a} ; + adv = vp.adv ++ nps} ; + + -- This happens in two cases: + -- 1) insertAdv placed the preposition into vp.adv and called insertComp. + -- 2) ditransitive verb where both objects are non-3rd person. (Not implemented yet.) + _ => vp ** {adv = vp.adv ++ nps} + } ; + + insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \adv,vp -> + case adv.c2 of { + noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP + prep => insertComp vp' adv.np } + where { vp' : VerbPhrase = + case of { -- NB. This is a safe assumption only for AdvVP, no guarantees for AdvVPSlash. + => vp ** {c2 = adv.c2} ; -- should cover for obligatory argument that is not introduced with a preposition + <_,_,noPrep> => vp ** {c3 = adv.c2} ; + -- if complement slots are full, put preposition just as a string. TODO check word order. + _ => vp ** {adv = (prepTable ! adv.c2).s ! adv.np.a} --only preposition inserted here, adv.np.s ! Abs will be inserted in insertComp! + } + } ; -------------------------------------------------------------------------------- -- Sentences etc. Clause : Type = {s : Tense => Anteriority => Polarity => Str} ; diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index 5714f975..532f5044 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -8,7 +8,7 @@ lin --2 Clauses -- : NP -> VP -> Cl - PredVP np vp = { + 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) ; @@ -24,11 +24,10 @@ lin in subj -- subject if it's a noun ++ obj.p1 -- object if it's a noun ++ stm -- sentence type marker + possible subj. pronoun - ++ vp.adv.s ---- TODO: can it contract with obj. pronoun? + ++ vp.adv ---- TODO word order ++ obj.p2 -- object if it's a pronoun ++ pred.fin -- the verb inflected ++ pred.inf -- potential participle - ++ vp.adv.s2 ---- I have no idea /IL } ; {- -- : SC -> VP -> Cl ; -- that she goes is good diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index 8a856652..d65643c2 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -104,14 +104,14 @@ oper -- lin for_Prep = mkPrep ; -- lin from_Prep = mkPrep "" ; -- lin in8front_Prep = mkPrep "" ; -lin in_Prep = prepTable ! ku ; -lin on_Prep = prepTable ! ku ; +lin in_Prep = prep ku ; +lin on_Prep = prep ku ; -- lin part_Prep = mkPrep ; -- lin possess_Prep = mkPrep ; -- lin through_Prep = mkPrep ; -- lin to_Prep = mkPrep ; -- lin under_Prep = mkPrep "" ; -lin with_Prep = prepTable ! la ; +lin with_Prep = prep la ; -- lin without_Prep = mkPrep ; diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index d9da0934..b5c3a509 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -5,13 +5,15 @@ lin ----- -- VP - + -- : V -> VP UseV = ResSom.useV ; {- + -- : V2 -> VP ; -- be loved + PassV2 v2 = + -- : VV -> VP -> VP ; ComplVV vv vp = ; - -- : VS -> S -> VP ; ComplVS vs s = ; @@ -21,14 +23,14 @@ lin -- : VA -> AP -> VP ; -- they become red ComplVA va ap = ResSom.insertComp (CompAP ap).s (useV va) ; - +-} -------- -- Slash -- : V2 -> VPSlash - SlashV2a = ResSom.slashDObj ; - + SlashV2a = useVc ; +{- -- : V3 -> NP -> VPSlash ; -- give it (to her) Slash2V3 v3 npNori = slashDObj v3 ** { iobj = { s = npNori.s ! Dat ; @@ -40,7 +42,6 @@ lin { dobj = npNor ** { s = mkDObj npNor } } ; - -- : V2V -> VP -> VPSlash ; -- beg (her) to go SlashV2V v2v vp = ; @@ -55,11 +56,11 @@ lin SlashV2A v2a ap = slashDObj v2a ** { comp = (CompAP ap).s } ; - +-} -- : VPSlash -> NP -> VP - ComplSlash vps np = ResSom.complSlash vps np ; - + ComplSlash = insertComp ; +{- -- : VV -> VPSlash -> VPSlash ; -- Just like ComplVV except missing subject! SlashVV vv vps = ComplVV vv vps ** { missing = vps.missing ; @@ -84,21 +85,21 @@ lin UseComp comp = UseCopula ** comp ** { isPred = True } ; -{- - -- : V2 -> VP ; -- be loved - PassV2 v2 = -- : VP -> Adv -> VP ; -- sleep here - AdvVP vp adv = vp ** {adv = adv} ; ---- TODO: how about combining adverbs? + AdvVP vp adv = insertAdv adv vp ; ---- TODO: how about combining adverbs? + + -- : VPSlash -> Adv -> VPSlash ; -- use (it) here + AdvVPSlash vps adv = insertAdv adv vps ; + +{- -- : VP -> Adv -> VP ; -- sleep , even though ... ExtAdvVP vp adv = ; -- : AdV -> VP -> VP ; -- always sleep AdVVP adv vp = vp ** {adv = adv} ; - -- : VPSlash -> Adv -> VPSlash ; -- use (it) here - AdvVPSlash vps adv = vps ** { adv = vps.adv ++ adv.s } ; -- : AdV -> VPSlash -> VPSlash ; -- always use (it) AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ; @@ -125,7 +126,7 @@ lin CompAP ap = { comp = \\a => <[], ap.s ! AF (getNum a) Abs> ; } ; -{-} +{- -- : CN -> Comp ; CompCN cn = { } ; From 8c6be2e7b2085249685c387bdac6c13b1458096f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 10 Jun 2019 13:55:13 +0200 Subject: [PATCH 3/6] (Som) Ditransitive verbs --- src/somali/LexiconSom.gf | 2 +- src/somali/ResSom.gf | 95 +++++++++++++++++++++---------------- src/somali/StructuralSom.gf | 2 +- src/somali/VerbSom.gf | 13 ++--- 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index 83dbbb40..dfe9d3c2 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -148,7 +148,7 @@ lin father_N2 = mkN2 (shortPossN (mkN "aabbe")) Gen ; -- lin garden_N = mkN "" ; lin girl_N = mkN "gabadh" "gabdho" fem ; -lin give_V3 = mkV3 "bixiyo" ; +lin give_V3 = mkV3 "sii" ; -- lin glove_N = mkN "" ; -- lin go_V = joan_V ; -- lin gold_N = mkN "" ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 441c2f43..3588453f 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -139,28 +139,27 @@ oper a = Pl3 ; isPron = False } ; + -------------------------------------------------------------------------------- -- Pronouns --- De somaliska possessiva pronomenen, precis som de svenska, har två olika genusformer i singular och en enda form i plural. --- ägaren då det ägda föremålet är --- m.sg. f.sg.plural --- kayga tayda kuwayga --- kaaga taada kuwaaga --- kiisa tiisa kuwiisa --- keeda teeda kuweeda --- --- kaayaga taayada kuwayaga (1 pl. exkl.) --- keenna teenna kuweenna (1 pl. inkl.) --- kiinna tiinna kuwiinna --- kooda tooda kuwooda + Pronoun : Type = NounPhrase ** { poss : { -- for PossPron : Pron -> Quant - --s, -- possessive suffix - sp : GenNum => Str ; -- independent forms - s : Str ; -- special case: e.g. family members, name - v : Vowel} + sp : GenNum => Str ; -- independent forms, e.g. M:kayga F:tayda Pl:kuwayga + s : Str ; -- short possessive suffix: e.g. family members, my/your name + v : Vowel} } ; + -- 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" ; + _ => [] + } ; -------------------------------------------------------------------------------- -- Det, Quant, Card, Ord @@ -536,6 +535,7 @@ oper adv : Str ; c2, c3 : Preposition ; -- can combine together and with object pronoun(s?) obj2 : {s : Str ; a : AgreementPlus} ; + secObj : Str ; -- if two overt pronoun objects } ; VPSlash : Type = VerbPhrase ; @@ -546,6 +546,7 @@ oper adv = [] ; c2,c3 = noPrep ; obj2 = {s = [] ; a = Unassigned} ; + secObj = [] } ; useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** { @@ -553,51 +554,61 @@ oper } ; complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** { - comp = \\a => + comp = \\agr => case np.a of { - Unassigned => vps.comp ! a ; - IsPron ag => {p1 = [] ; -- object is a pronoun => nothing is placed before the verb - p2 = compl np.a vps} ; -- object combines with the preposition of the verb - NotPronP3 => {p1 = np.s ; -- object is a noun => it will come before verb in the sentence - p2 = compl np.a vps} -- object combines with the preposition of the verb + Unassigned => vps.comp ! agr ; + _ => {p1 = np.s ; -- if object is a noun, it will come before verb in the sentence. + -- if object is a pronoun, np.s is empty. + p2 = compl np.a vps ++ vps.secObj} -- object combines with the preposition of the verb. + -- secObj in case there was a ditransitive verb. + + -- IsPron ag => {p1 = [] ; -- object is a pronoun => nothing is placed before the verb + -- p2 = compl np.a vps ++ vps.secObj} ; -- object combines with the preposition of the verb + -- NotPronP3 => {p1 = np.s ; -- object is a noun => it will come before verb in the sentence + -- p2 = compl np.a vps ++ vps.secObj} -- object combines with the preposition of the verb } } ; compl : AgreementPlus -> VerbPhrase -> Str = \a,vp -> let agr = case a of {IsPron x => x ; _ => Pl3} ; - in "<" ++ prepCombTable ! agr ! combine vp.c2 vp.c3 ++ ">" ; + in prepCombTable ! agr ! combine vp.c2 vp.c3 ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> - let nps = if_then_Str np.isPron [] (np.s ! Abs) ; + let noun = if_then_Str np.isPron [] (np.s ! Abs) ; in case vp.obj2.a of { Unassigned => - vp ** {obj2 = {s = nps ; - a = agr2agrplus np.isPron np.a} + vp ** {obj2 = { + s = noun ; + a = agr2agrplus np.isPron np.a} } ; - -- If the old object in obj2 is 3rd person, we can safely replace its agreement, but keep its string. + -- 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) => - vp ** {obj2 = vp.obj2 ** {a = agr2agrplus np.isPron np.a} ; - adv = vp.adv ++ nps} ; + 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} - -- This happens in two cases: - -- 1) insertAdv placed the preposition into vp.adv and called insertComp. - -- 2) ditransitive verb where both objects are non-3rd person. (Not implemented yet.) - _ => vp ** {adv = vp.adv ++ nps} } ; insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \adv,vp -> case adv.c2 of { noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP - prep => insertComp vp' adv.np } - where { vp' : VerbPhrase = - case of { -- NB. This is a safe assumption only for AdvVP, no guarantees for AdvVPSlash. - => vp ** {c2 = adv.c2} ; -- should cover for obligatory argument that is not introduced with a preposition - <_,_,noPrep> => vp ** {c3 = adv.c2} ; - -- if complement slots are full, put preposition just as a string. TODO check word order. - _ => vp ** {adv = (prepTable ! adv.c2).s ! adv.np.a} --only preposition inserted here, adv.np.s ! Abs will be inserted in insertComp! - } - } ; + prep => case of { + => insertComp adv.np ; -- should cover for obligatory argument that is not introduced with a preposition + <_,_, noPrep> => insertComp (vp ** {c3 = adv.c2}) adv.np ; + -- if complement slots are full, put preposition just as a string. TODO check word order. + _ => vp ** {adv = (prepTable ! adv.c2).s ! adv.np.a ++ adv.np.s ! Abs} + } + } ; -------------------------------------------------------------------------------- -- Sentences etc. Clause : Type = {s : Tense => Anteriority => Polarity => Str} ; diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index d65643c2..a7970abe 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -143,7 +143,7 @@ lin with_Prep = prep la ; } ; we_Pron = { s = table {Nom => "aan" ; Voc => "innaga" ; _Abs => "na"} ; - a = Pl1 Incl ; isPron = True ; + a = Pl1 Excl ; isPron = True ; poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} } ; youPl_Pron = { diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index b5c3a509..3f9b0b4c 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -30,22 +30,15 @@ lin -- : V2 -> VPSlash SlashV2a = useVc ; -{- -- : V3 -> NP -> VPSlash ; -- give it (to her) - Slash2V3 v3 npNori = slashDObj v3 ** - { iobj = { s = npNori.s ! Dat ; - agr = npNori.agr } - } ; + Slash2V3 v3 np = insertComp (useVc v3) np ; -- : V3 -> NP -> VPSlash ; -- give (it) to her - Slash3V3 v3 npNor = slashIObj v3 ** - { dobj = npNor ** { s = mkDObj npNor } - } ; - + Slash3V3 v3 np = insertComp (useVc v3) np ; +{- -- : V2V -> VP -> VPSlash ; -- beg (her) to go SlashV2V v2v vp = ; - -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good SlashV2S v2s s = ; From 7a545c25f13c70ea1c75be2316c57c7639568861 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 10 Jun 2019 15:57:23 +0200 Subject: [PATCH 4/6] (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 = ; From 8295e4032374c5d9d80f052aae15d7aa7e2fe74e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 11 Jun 2019 21:20:39 +0200 Subject: [PATCH 5/6] (Som) Possessive structures --- src/somali/LexiconSom.gf | 6 ++-- src/somali/NounSom.gf | 27 +++++++++------ src/somali/ParadigmsSom.gf | 10 +++--- src/somali/ParamSom.gf | 4 +-- src/somali/ResSom.gf | 69 ++++++++++++++++++++++++++++++------- src/somali/StructuralSom.gf | 45 +++++------------------- 6 files changed, 91 insertions(+), 70 deletions(-) diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index 345ff590..d4399cb9 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -118,7 +118,7 @@ lin eat_V2 = mkV2 "cun" ; -- lin fall_V = mkV "" ; -- lin far_Adv = mkA "" ; -- lin fat_N = mkN "" ; -lin father_N2 = mkN2 (shortPossN (mkN "aabbe")) Gen ; +lin father_N2 = mkN2 (shortPossN (mkN "aabbe")) ; -- lin fear_V2 = mkV2 "" ; -- lin fear_VS = mkVS "" ; -- lin feather_N = mkN "" ; @@ -227,7 +227,7 @@ lin man_N = mkN "nin" ; -- lin meat_N = mkN "" ; -- lin milk_N = mkN "" ; -- lin moon_N = mkN "" ; -lin mother_N2 = mkN2 (shortPossN (mkN "hooyo")) Gen ; +lin mother_N2 = mkN2 (shortPossN (mkN "hooyo")) ; -- lin mountain_N = mkN "" ; -- lin mouth_N = mkN "" ; -- lin music_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 "biya" ; +lin water_N = mkNoun "biyo" "biyaha" "biyo" "biyaha" Masc ; -- ?? gender -- lin wet_A = mkA "" ; -- lin white_A = mkA "" ; -- lin wide_A = mkA "" ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index 0cce3c74..32b925b8 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -14,11 +14,11 @@ DetCN det cn = useN cn ** { let nfc : {nf : NForm ; c : Case} = case of { -- special form for fem. nouns - => {nf=GenSg ; c=c} ; - => {nf=GenPl ; c=c} ; => {nf=NomSg ; c=c} ; + -- special case for DefArt+Nom: override vowel => {nf=Def x vU ; c=c} ; + -- If cn has modifier, Nom ending attaches to the modifier => {nf=det.d ; c=Abs} ; _ => {nf=det.d ; c=c} @@ -76,7 +76,6 @@ DetCN det cn = useN cn ** { -- MassNP : CN -> NP ; MassNP cn = useN cn ** { s = table { Nom => cn.s ! NomSg ++ cn.mod ! Sg ! Nom ; - -- Gen => cn.s ! PlGen ++ cn.mod ! Sg ! Gen ; -- TODO Do we ever need plural genitive? c => cn.s ! Indef Sg ++ cn.mod ! Sg ! c } } ; @@ -174,10 +173,18 @@ DetCN det cn = useN cn ** { -- : N2 -> CN ; UseN,UseN2 = ResSom.useN ; - -- : N2 -> NP -> CN ; -- mother of the king - ComplN2 n2 np = - let cn = useN n2 in - cn ** {s = \\c => cn.s ! c ++ np.s ! n2.c2 } ; + -- : N2 -> NP -> CN ; -- Sahra hooyadeed + ComplN2 n2 np = let cn = useN n2 in cn ** {s = \\nf => + let det = PossPron (pronTable ! np.a) ; + detStr = case cn.shortPoss of { + True => det.shortPoss ; + _ => det.s ! Abs } ; + num = case nf of { + Indef n => n ; + Def n v => n ; + _ => Sg } ; + in np.s ! Abs ++ cn.s ! Def num det.v ++ detStr } ; + {- -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) ComplN3 n3 np = @@ -221,13 +228,13 @@ DetCN det cn = useN cn ** { -- : CN -> NP -> CN ; -- city Paris (, numbers x and y) ApposCN cn np = cn ** { s = } ; - +-} --2 Possessive and partitive constructs -- : PossNP : CN -> NP -> CN ; - PossNP cn np = cn ** { } ; - + PossNP cn np = cn ** {mod = \\n,c => cn.mod ! n ! c ++ np.s ! Abs} ; -- guriga Axmed, not Axmed gurigiisa +{- -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples PartNP cn np = cn ** { } ; diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index 8fd6f78c..fe847f49 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -43,9 +43,8 @@ oper } ; mkN2 : overload { - mkN2 : Str -> N2 ; -- Predictable N2, no preposition - mkN2 : Str -> Case -> N2 ; -- Predictable N2, given preposition - mkN2 : N -> Case -> N2 -- N2 out of noun and preposition + mkN2 : Str -> N2 ; -- Predictable N2 + mkN2 : N -> N2 -- N2 out of noun } ; mkPN : overload { @@ -165,9 +164,8 @@ oper = \n -> n ** {shortPoss = True} ; mkN2 = overload { - mkN2 : Str -> N2 = \s -> lin N2 (mkN1 s ** {c2 = Gen}) ; - mkN2 : Str -> Case -> N2 = \s,p -> lin N2 (mkN1 s ** {c2 = p}) ; - mkN2 : N -> Case -> N2 = \n,p -> lin N2 (n ** {c2=p}) + mkN2 : Str -> N2 = \s -> lin N2 (mkN1 s) ; + mkN2 : N -> N2 = \n -> lin N2 n ; } ; mkPN = overload { diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index d3d03a86..8a2ce585 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -60,7 +60,7 @@ oper -- Nouns param - Case = Nom | Abs | Gen ; -- | Voc exists for some words + Case = Nom | Abs ; Gender = Masc | Fem ; Vowel = vA | vE | vI | vO | vU | NA ; -- For vowel assimilation GenNum = SgMasc | SgFem | PlInv ; -- For Quant @@ -87,7 +87,7 @@ param | Def Number Vowel -- Stems for definite and determinative suffixes -- Special forms only for fem. nouns ending in consonant. | Numerative -- When modified by a number: either pl gen or sg abs - | NomSg | GenSg | GenPl ; + | NomSg ; oper getAgr : NForm -> Gender -> Agreement = \n,g -> diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 72beed8d..5882e451 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -4,9 +4,9 @@ resource ResSom = ParamSom ** open Prelude, Predef, ParamSom in { -- Nouns oper - Noun : Type = {s : NForm => Str ; g : Gender ; shortPoss : Bool} ; - Noun2 : Type = Noun ** {c2 : Case} ; - Noun3 : Type = Noun2 ** {c3 : Case} ; + Noun : Type = {s : NForm => Str; g : Gender ; shortPoss : Bool} ; + Noun2 : Type = Noun ; -- TODO eventually more parameters? + Noun3 : Type = Noun ; CNoun : Type = Noun ** {mod : Number => Case => Str ; hasMod : Bool} ; @@ -18,11 +18,9 @@ oper let bisadi = case gender of { Fem => case wiil of { _ + #c => wiil+"i" ; _ => wiil} ; Masc => wiil } ; - genforms : {p1, p2 : Str} = case gender of - { Fem => case wiilal of {_ + "o" => ; _ => } ; - Masc => } ; - shimbireed = genforms.p1 ; - bisadood = genforms.p2 ; + bisadood = case gender of + { Fem => case wiilal of {_ + "o" => wiilal+"od" ; _ => wiil} ; + Masc => wiil } ; defStems : Str -> Vowel => Str = \s -> case s of { ilk + "aha" => table { vE => ilk+"eh" ; @@ -39,10 +37,7 @@ oper Indef Pl => wiilal ; Def Sg vow => defStems wiilka ! vow ; Def Pl vow => defStems wiilasha ! vow ; - -- Special forms for fem. nouns ending in consonant - NomSg => bisadi ; - GenSg => shimbireed ; - GenPl => bisadood ; + NomSg => bisadi ; -- Special form for fem. nouns ending in consonant Numerative => case bisadood of {_+"ood" => bisadood ; _ => wiil} } ; g = gender ; @@ -155,6 +150,55 @@ oper v : Vowel} } ; + pronTable : Agreement => Pronoun = table { + Sg1 => { + s = table {Nom => "aan" ; {-Voc => "aniga" ;-} Abs => "i"} ; + a = Sg1 ; isPron = True ; + poss = {s = "ay" ; v = vA ; sp = gnTable "ayg" "ayd" "uwayg"} + } ; + Sg2 => { + s = table {Nom => "aad" ; {-Voc => "adiga" ;-} Abs => "ku"} ; + a = Sg2 ; isPron = True ; + poss = {s = "aa" ; v = vA ; sp = gnTable "aag" "aad" "uwaag"} + } ; + Sg3 Masc => { + s = table {Nom => "uu" ; {-Voc => "isaga" ;-} Abs => []} ; + a = Sg3 Masc ; isPron = True ; + poss = {s = "iis" ; v = vI ; sp = gnTable "iis" "iis" "uwiis"} + } ; + Sg3 Fem => { + s = table {Nom => "ay" ; {-Voc => "iyada" ;-} Abs => []} ; + a = Sg3 Fem ; isPron = True ; + poss = {s = "eed" ; v = vE ; sp = gnTable "eed" "eed" "uweed"} + } ; + Pl1 Excl => { + s = table {Nom => "aan" ; {-Voc => "annaga" ;-} Abs => "na"} ; + a = Pl1 Incl ; isPron = True ; + poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} + } ; + Pl1 Incl => { + s = table {Nom => "aynu" ; {-Voc => "innaga" ;-} Abs => "ina"} ; + a = Pl1 Incl ; isPron = True ; + poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} + } ; + Pl2 => { + s = table {Nom => "aad" ; {-Voc => "idinka" ;-} Abs => "idin"} ; + a = Pl2 ; isPron = True ; + poss = {s = "iin" ; v = vI ; sp = gnTable "iinn" "iinn" "uwiinn"} + } ; + Pl3 => { + s = table {Nom => "ay" ; {-Voc => "iyaga" ;-} Abs => []} ; + a = Pl3 ; isPron = True ; + poss = {s = "ood" ; v = vO ; sp = gnTable "ood" "ood" "uwood"} + } ; + Impers => { + s = table {Nom => "la" ; Abs => "??"} ; + a = Impers ; isPron = True ; + poss = {s = "??" ; v = vO ; sp = gnTable "??" "??" "??"} + } + } ; + + -- 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 { @@ -165,6 +209,7 @@ oper Pl2 => "kiin" ; _ => [] } ; + -------------------------------------------------------------------------------- -- Det, Quant, Card, Ord diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index 647778ff..aff86597 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -119,44 +119,15 @@ lin with_Prep = prep la ; -- Pron -- Pronouns are closed class, no constructor in ParadigmsSom. - - i_Pron = { - s = table {Nom => "aan" ; Voc => "aniga" ; _Abs => "i"} ; - a = Sg1 ; isPron = True ; - poss = {s = "ay" ; v = vA ; sp = gnTable "ayg" "ayd" "uwayg"} - } ; - youPol_Pron, -- TODO check - youSg_Pron = { - s = table {Nom => "aad" ; Voc => "adiga" ; _Abs => "ku"} ; - 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 ; - poss = {s = "iis" ; v = vI ; sp = gnTable "iis" "iis" "uwiis"} - } ; - she_Pron = { - s = table {Nom => "ay" ; Voc => "iyada" ; _Abs => []} ; - a = Sg3 Fem ; isPron = True ; - poss = {s = "eed" ; v = vE ; sp = gnTable "eed" "eed" "uweed"} - } ; - we_Pron = { - s = table {Nom => "aan" ; Voc => "innaga" ; _Abs => "na"} ; - a = Pl1 Excl ; isPron = True ; - poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} - } ; - youPl_Pron = { - s = table {Nom => "aad" ; Voc => "idinka" ; _Abs => "idin"} ; - a = Pl2 ; isPron = True ; - poss = {s = "iin" ; v = vI ; sp = gnTable "iinn" "iinn" "uwiinn"} - } ; - they_Pron = { - s = table {Nom => "ay" ; Voc => "iyaga" ; _Abs => []} ; - a = Pl3 ; isPron = True ; - poss = {s = "ood" ; v = vO ; sp = gnTable "ood" "ood" "uwood"} - } ; + i_Pron = pronTable ! Sg1 ; + youPol_Pron, -- TODO check + youSg_Pron = pronTable ! Sg2 ; + he_Pron = pronTable ! Sg3 Masc ; + she_Pron = pronTable ! Sg3 Fem ; + we_Pron = pronTable ! Pl1 Excl ; + youPl_Pron = pronTable ! Pl2 ; + they_Pron = pronTable ! Pl3 ; {- lin whatPl_IP = ; lin whatSg_IP = ; From 388741ef8d99299622b382f3bdd6342eba149133 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 13 Jun 2019 17:37:48 +0200 Subject: [PATCH 6/6] (Som) WIP: Numerals, bugfixes in gender agreement. + Other misc. fixes, like impersonal pronoun contractions. --- src/somali/CatSom.gf | 5 +- src/somali/LexiconSom.gf | 4 +- src/somali/NounSom.gf | 85 +++++++++++++++--------- src/somali/NumeralSom.gf | 139 ++++++++++++++++++++------------------- src/somali/ParamSom.gf | 35 ++++++++-- src/somali/PhraseSom.gf | 2 +- src/somali/ResSom.gf | 74 +++++++++++---------- 7 files changed, 198 insertions(+), 146 deletions(-) diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index ee325a07..01204f5f 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -72,7 +72,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { Predet = {s : Str} ; Quant = ResSom.Quant ; Num = ResSom.Num ; - Card, Ord = {s : Str ; n : Number} ; + Ord = {s : Str ; n : Number} ; DAP = ResSom.Determiner ; @@ -80,7 +80,8 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { -- Constructed in NumeralSom. - Numeral = {s : Str ; n : Number} ; + Card = {s : State => Str ; n : Number} ; + Numeral = {s : CardOrd => State => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index d4399cb9..8b8e0533 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -176,7 +176,7 @@ lin go_V = mkV "tag" ; -- lin horn_N = mkN "" ; -- lin horse_N = mkN "" ; -- lin hot_A = mkA "" ; -lin house_N = mkN "aqal" ; +lin house_N = mkN "guri" ; -- lin hunt_V2 = mkV2 "" ; -- lin husband_N = mkN "" ; @@ -360,7 +360,7 @@ lin speak_V2 = mkV2 "hadlo" ; -- lin table_N = mkN "" ; -- lin tail_N = mkN "" ; -- lin talk_V3 = mkV3 "" ; -lin teach_V2 = mkV2 "baray" ku ; -- I suppose this creates progressive forms? TODO implement all forms of verbs properly. +lin teach_V2 = mkV2 "bar" ku ; -- lin teacher_N = mkN "" ; -- lin television_N = mkN "" ; -- lin thick_A = mkA "" ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index 32b925b8..17446f02 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -23,14 +23,19 @@ DetCN det cn = useN cn ** { => {nf=det.d ; c=Abs} ; _ => {nf=det.d ; c=c} } ; - nf : NForm = case det.isNum of {True => Numerative ; _ => nfc.nf} ; detStr : Str = - case of { - => det.shortPoss ; - _ => det.s ! nfc.c + case of { + => det.sp ! cn.g ! nfc.c ; -- CN has undergone ComplN2 and is already quantified + <_,Numerative,_,_> => [] ; -- s is in pref + <_,_, True,True> => det.shortPoss ; + _ => det.s ! cn.g ! nfc.c } ; - in det.pref -- if det is numeral. TODO find out if gender/case/other distinction. - ++ cn.s ! nf + pref : Str = case det.d of { + Numerative => det.s ! cn.g ! nfc.c ; + _ => [] + } ; + in pref -- if det is numeral. + ++ cn.s ! nfc.nf ++ detStr -- non-numeral det ++ cn.mod ! getNum (getAgr det.d Masc) ! c } ; @@ -87,23 +92,29 @@ DetCN det cn = useN cn ** { -- : Quant -> Num -> Det ; DetQuant quant num = quant ** { - pref = num.s ; - sp = \\g => case of { - => quant.sp ! SgMasc ; - => quant.sp ! SgFem ; - => quant.sp ! PlInv } ; + s = \\g,c => case of { + => num.s ! quant.st ++ quant.s ! SgMasc ! c ; + => num.s ! quant.st ++ quant.s ! SgFem ! c ; + -- gender-flipped allomorphs in plural; TODO needs more fine-grained rules + => num.s ! quant.st ++ quant.s ! SgMasc ! c ; + => num.s ! quant.st ++ quant.s ! SgFem ! c } ; + + sp = \\g,c => case of { + => num.s ! quant.st ++ quant.sp ! SgMasc ! c ; + => num.s ! quant.st ++ quant.sp ! SgFem ! c ; + -- Independent form uses plural morpheme, not gender-flipped allomorph + => num.s ! quant.st ++ quant.sp ! PlInv ! c } ; d = case of { => Numerative ; => Def num.n quant.v ; => Indef num.n } ; - isNum = num.isNum ; } ; -- : Quant -> Num -> Ord -> Det ; -- these five best DetQuantOrd quant num ord = let theseFive = DetQuant quant num in theseFive ** { - s = \\c => theseFive.s ! c ++ ord.s ; + s = \\g,c => theseFive.s ! g ! c ++ ord.s ; sp = \\g,c => theseFive.sp ! g ! c ++ ord.s } ; @@ -114,27 +125,29 @@ DetCN det cn = useN cn ** { -- the "kernel" of a determiner. It is, however, the $Num$ that determines -- the inherent number. - NumSg = {s = [] ; n = Sg ; isNum = False} ; - NumPl = {s = [] ; n = Pl ; isNum = False} ; -{- + NumSg = {s = \\_ => [] ; n = Sg ; isNum = False} ; + NumPl = {s = \\_ => [] ; n = Pl ; isNum = False} ; + -- : Card -> Num ; - NumCard card = (card ** { isNum = True }) ; + NumCard card = card ** {isNum = True} ; -- : Digits -> Card ; - NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; +-- NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; -- : Numeral -> Card ; - NumNumeral num = num ; + NumNumeral num = num ** {s = num.s ! NCard}; +{- -- : AdN -> Card -> Card ; AdNum adn card = card ** { s = adn.s ++ card.s } ; -- : Digits -> Ord ; OrdDigits digs = digs ** { s = digs.s ! NOrd } ; - +-} -- : Numeral -> Ord ; - OrdNumeral num = num ; + OrdNumeral num = num ** {s = num.s ! NOrd ! Indefinite} ; +{- -- : A -> Ord ; OrdSuperl a = { } ; @@ -159,10 +172,10 @@ DetCN det cn = useN cn ** { in DefArt ** { shortPoss = BIND ++ p.s ; isPoss = True ; - s = \\c => let casevow = case c of {Nom => "u" ; Abs => "a" ; _ => "TODO:case"} - in gntbl ! SgMasc ++ BIND ++ casevow ; + s = \\gn,c => let casevow = case c of {Nom => "u" ; Abs => "a"} + in gntbl ! gn ++ BIND ++ casevow ; sp = \\gn,c => let prefix = case gn of {SgFem => "t" ; _ => "k"} ; - casevow = case c of {Nom => "u" ; Abs => "a"; _ => "TODO:case"} + casevow = case c of {Nom => "u" ; Abs => "a"} in prefix ++ gntbl ! gn ++ BIND ++ casevow ; v = p.v } ; @@ -175,15 +188,20 @@ DetCN det cn = useN cn ** { -- : N2 -> NP -> CN ; -- Sahra hooyadeed ComplN2 n2 np = let cn = useN n2 in cn ** {s = \\nf => - let det = PossPron (pronTable ! np.a) ; - detStr = case cn.shortPoss of { - True => det.shortPoss ; - _ => det.s ! Abs } ; + let qnt = PossPron (pronTable ! np.a) ; + + det = case cn.shortPoss of { + True => qnt.shortPoss ; + _ => qnt.s ! nf2gennum nf cn.g ! Abs } ; num = case nf of { - Indef n => n ; - Def n v => n ; - _ => Sg } ; - in np.s ! Abs ++ cn.s ! Def num det.v ++ detStr } ; + Indef n => n ; + Def n v => n ; + _ => Sg } ; + noun = case np.isPron of { + True => (pronTable ! np.a).sp ; -- long subject pronoun + False => np.s ! Abs } + in noun ++ cn.s ! Def num qnt.v ++ det ; + isPoss = True} ; {- -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) @@ -202,6 +220,9 @@ DetCN det cn = useN cn ** { s = table { NomSg => cn.s ! Indef Sg ; -- When an adjective is added, noun loses case marker. x => cn.s ! x } ; mod = \\n,c => cn.mod ! n ! Abs -- If there was something before, it is now in Abs + ++ case cn.hasMod of { + True => "oo" ; + False => [] } ++ ap.s ! AF n c ; hasMod = True } ; diff --git a/src/somali/NumeralSom.gf b/src/somali/NumeralSom.gf index 7440347d..2bf06d18 100644 --- a/src/somali/NumeralSom.gf +++ b/src/somali/NumeralSom.gf @@ -1,88 +1,91 @@ concrete NumeralSom of Numeral = CatSom [Numeral,Digits] ** - open Prelude, ResSom in { + open Prelude, ResSom, ParamSom in { -oper LinDigit : Type = { s : DForm => Str ; - n : Number ; - even20 : Even20 } ; +oper + LinDigit : Type = { + s : DForm => CardOrd => State => Str -- TODO: for 1, hal and mid. variation kow-koob implemented with pre. + } ; -oper mk20Ten : Str -> Str -> Str -> Str -> LinDigit = \tri,t,fiche,h -> - { s = table { Unit => tri ; - Teen => t ; - Twenty => fiche ; - Hund => h + "TODO"} ; - even20 = Ten ; - n = Pl } ; + mkNum3 : (ucard,tcard,uord : Str) -> Gender -> LinDigit = \uc,tc,uo,g -> {s = + \\df,co,s => case of { + => uo ; + => tc + "aad" ; + => nf2state (mkNg uc g) ! s ; + => nf2state (mkN1 tc) ! s } + } ; -oper mkeven20 : Str -> Str -> Str -> Str -> LinDigit = \se,t,trifichid,h -> - { s = table { Unit => se ; - Teen => t ; - Twenty => trifichid ; - Hund => h + "TODO" } ; - even20 = Even ; - n = Pl } ; + mkNum2 : (ucard,tcard : Str) -> LinDigit = \uc,tc -> + let uo : Str = case uc of { + x + "a" => x + "aad" ; -- ?? + x + #v + c@#c => x + c + "aad" ; + _ => uc + "aad" } ; + in mkNum3 uc tc uo Fem ; -param Even20 = Ten | Even ; -param DForm = Unit | Teen | Twenty | Hund ; + mkNum2Masc : (ucard,tcard : Str) -> LinDigit = \uc,tc -> + let uo : Str = case uc of { + x + "a" => x + "aad" ; -- ?? + x + #v + c@#c => x + c + "aad" ; + _ => uc + "aad" } ; + in mkNum3 uc tc uo Masc ; ---lincat Numeral = {s : Str} ; -lincat Digit = LinDigit ; -lincat Sub10 = LinDigit ; -lincat Sub100 = {s : Str ; n : Number } ; -lincat Sub1000 = {s : Str ; n : Number ; isHundred : Bool } ; -lincat Sub1000000 = {s : Str ; n : Number } ; +lincat + Digit = LinDigit ; + Sub10, Sub100, Sub1000, Sub1000000 = + {s : CardOrd => State => Str ; n : Number} ; ---------------------------------------------------------------------------- -- num : Sub1000000 -> Numeral ; -lin num x0 = lin Numeral x0 ; +lin num x = x ; -lin n2 = mkeven20 "TODO" "TODO" "TODO" "TODO" ; -lin n3 = mk20Ten "TODO" "TODO" "TODO" "TODO"; -lin n4 = mkeven20 "TODO" "TODO" "TODO" "TODO"; -lin n5 = mk20Ten "TODO" "TODO" "TODO" "TODO"; -lin n6 = mkeven20 "TODO" "TODO" "TODO" "TODO" ; -lin n7 = mk20Ten "TODO" "TODO" "TODO" "TODO" ; -lin n8 = mkeven20 "TODO" "TODO" "TODO" "TODO" ; -lin n9 = mk20Ten "TODO" "TODO" "TODO" "TODO" ; +oper kow : Str = "kow" ; --pre {"iyo" => "koob" ; _ => "kow"} ; -lin pot01 = - {s = table {Unit => "TODO" ; Hund => "TODO" ; _ => []} ; even20 = Ten ; n = Sg }; -lin pot0 d = d ; -lin pot110 = {s = "TODO" ; n = Pl} ; -lin pot111 = {s = variants {"TODO" ; "TODO"} ; n = Pl} ; -lin pot1to19 d = {s = d.s ! Teen ; n = Pl} ; -lin pot0as1 n = {s = n.s ! Unit ; n = n.n} ; -lin pot1 d = - {s = case d.even20 of { - Even => d.s ! Twenty ; - Ten => glue (d.s ! Twenty) "TODO" } ; - n = Pl} ; -lin pot1plus d e = - {s = case d.even20 of { - Even => d.s ! Twenty ++ "TODO" ++ e.s ! Unit ; - Ten => d.s ! Twenty ++ "TODO" ++ e.s ! Teen } ; - n = Pl} ; +oper n1 = mkNum3 kow "toban" "kowaad" Fem ; +lin n2 = mkNum2 "laba" "labaatan" ; +lin n3 = mkNum2 "saddex" "soddon" ; +lin n4 = mkNum2 "afar" "afartan"; +lin n5 = mkNum2 "shan" "konton"; +lin n6 = mkNum2 "lix" "lixdan" ; +lin n7 = mkNum2 "toddoba" "toddobaatan" ; +lin n8 = mkNum2Masc "siddeed" "siddeetan" ; +lin n9 = mkNum2Masc "sagaal" "sagaaashan" ; -lin pot1as2 n = n ** { isHundred = False } ; -lin pot2 d = {s = d.s ! Hund ; n = Pl ; isHundred = True } ; -lin pot2plus d e = - { s = d.s ! Hund ++ "TODO" ++ e.s ; - n = Pl ; - isHundred = True } ; +lin pot01 = {s = n1.s ! Unit ; n = Sg} ; + +lin pot0 d = {s = d.s ! Unit ; n = Pl} ; + +lin pot110 = {s = n1.s ! Ten ; n = Pl} ; +lin pot111 = {s = \\co,s => "koob iyo" ++ n1.s ! Ten ! co ! s ; n = Pl} ; +lin pot1to19 d = {s = \\co,s => d.s ! Unit ! co ! s ++ n1.s ! Ten ! co ! s ; n=Pl} ; +lin pot0as1 n = n ; +lin pot1 d = {s = d.s ! Ten ; n=Pl}; + -- {s = d.s ! Unit ; + -- n = Pl} ; +lin pot1plus d e = { + s = \\co,s => e.s ! co ! Indefinite ++ "iyo" ++ d.s ! Ten ! co ! s ; + n = Pl} ; + +lin pot1as2 n = n ; +lin pot2 d = d ** {s = \\co,s => d.s ! co ! s ++ "boqol"} ; -- TODO +lin pot2plus d e = { + s = \\co,s => d.s ! co ! Indefinite ++ "boqol iyo" ++ e.s ! co ! s ; + n = Pl} ; lin pot2as3 n = n ; -lin pot3 n = - {s = table {Sg => [] ; Pl => n.s } ! n.n ++ "TODO" ; - n = n.n } ; +lin pot3 n = n ; + +lin pot3plus n m = { + s = \\co,s => n.s ! co ! s ++ "iyo" ++ m.s ! co ! s ; + n = n.n } ; -lin pot3plus n m = - let ta = if_then_Str m.isHundred [] "TODO" ; --no `ta' between 1000 and 100 - in - { s = table {Sg => [] ; Pl => n.s } ! n.n ++ "TODO" ++ ta ++ m.s ; - n = n.n } ; - +--TODO: +-- my three cats +-- * saddexd &+ ayg &+ a bisadood +-- => saddexd &+ ayd &+ a bisadood +-- my *two* thousand small cats +-- => laba kun oo bisadood oo yar (kun is an attribute, bisadood is an attribute) ---------------------------------------------------------------------------- lincat Dig = TDigit ; @@ -93,7 +96,7 @@ oper mk2Dig : Str -> Number -> TDigit = \c,num -> { s = table { NCard => c ; - NOrd => c + "TODO" } ; + NOrd => c + "aan" } ; n = num } ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 8a2ce585..d378ac23 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -99,19 +99,40 @@ oper agr2agrplus : (isPron : Bool) -> Agreement -> AgreementPlus = \isPron,a -> case isPron of {True => IsPron a ; False => NotPronP3} ; + nf2state : {s:NForm=>Str} -> State=>Str = \ss -> table { + Definite => ss.s ! Def Sg vA ; + Indefinite => ss.s ! Indef Sg + } ; + + gn2gennum : Gender -> Number -> GenNum = \g,n -> + case of { + => SgMasc ; + => SgFem ; + _ => PlInv } ; + + nf2gennum : NForm -> Gender -> GenNum = \nf,g -> + gn2gennum g (getNum (getAgr nf g)) ; + +-------------------------------------------------------------------------------- +-- Numerals + +param + + DForm = Unit | Ten ; + + -- If need to optimise: can remove one multiple of 2, but harder to understand + -- CardOrdDFS = Odfs DForm | Cdfs DForm State ; + -- + -- CardOrdState = Ost | Cst State ; + + CardOrd = NOrd | NCard ; + -------------------------------------------------------------------------------- -- Adjectives param AForm = AF Number Case ; ---- TODO: past tense --------------------------------------------------------------------------------- --- Numerals - --- TODO: is this necessary? -param - CardOrd = NCard | NOrd ; - -------------------------------------------------------------------------------- -- Prepositions diff --git a/src/somali/PhraseSom.gf b/src/somali/PhraseSom.gf index 37374a8c..33fdced8 100644 --- a/src/somali/PhraseSom.gf +++ b/src/somali/PhraseSom.gf @@ -18,7 +18,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in { UttVP vp = { s = linVP vp } ; UttAdv adv = adv ; UttCN n = {s = linCN n } ; - UttCard n = n ; + UttCard n = {s = n.s ! Indefinite} ; UttAP ap = { s = ap.s ! AF Sg Abs } ; UttInterj i = i ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 5882e451..6604b168 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -8,7 +8,11 @@ oper Noun2 : Type = Noun ; -- TODO eventually more parameters? Noun3 : Type = Noun ; - CNoun : Type = Noun ** {mod : Number => Case => Str ; hasMod : Bool} ; + CNoun : Type = Noun ** { + mod : Number => Case => Str ; + hasMod : Bool ; + isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "the father of NP". + } ; PNoun : Type = {s : Str ; a : Agreement} ; @@ -107,7 +111,7 @@ oper _ => nXayawaan n } ; mkNg : Str -> Gender -> Noun = \n,g -> case n of { - _ + ("r"|"n"|"l"|"g") + _ -- + ("r"|"n"|"l"|"g") => case g of { Fem => nUl n ; Masc => mkN1 n } ; @@ -126,7 +130,7 @@ oper useN : Noun -> CNoun ** BaseNP = \n -> n ** { mod = \\_,_ => [] ; hasMod = False ; - a = Sg3 n.g ; isPron = False ; sp = [] + a = Sg3 n.g ; isPron,isPoss = False ; } ; emptyNP : NounPhrase = { @@ -147,58 +151,58 @@ oper poss : { -- for PossPron : Pron -> Quant sp : GenNum => Str ; -- independent forms, e.g. M:kayga F:tayda Pl:kuwayga s : Str ; -- short possessive suffix: e.g. family members, my/your name - v : Vowel} + v : Vowel} ; + sp : Str ; } ; pronTable : Agreement => Pronoun = table { Sg1 => { - s = table {Nom => "aan" ; {-Voc => "aniga" ;-} Abs => "i"} ; - a = Sg1 ; isPron = True ; + s = table {Nom => "aan" ; Abs => "i"} ; + a = Sg1 ; isPron = True ; sp = "aniga" ; poss = {s = "ay" ; v = vA ; sp = gnTable "ayg" "ayd" "uwayg"} } ; Sg2 => { - s = table {Nom => "aad" ; {-Voc => "adiga" ;-} Abs => "ku"} ; - a = Sg2 ; isPron = True ; + s = table {Nom => "aad" ; Abs => "ku"} ; + a = Sg2 ; isPron = True ; sp ="adiga" ; poss = {s = "aa" ; v = vA ; sp = gnTable "aag" "aad" "uwaag"} } ; Sg3 Masc => { - s = table {Nom => "uu" ; {-Voc => "isaga" ;-} Abs => []} ; - a = Sg3 Masc ; isPron = True ; + s = table {Nom => "uu" ; Abs => []} ; + a = Sg3 Masc ; isPron = True ; sp ="isaga" ; poss = {s = "iis" ; v = vI ; sp = gnTable "iis" "iis" "uwiis"} } ; Sg3 Fem => { - s = table {Nom => "ay" ; {-Voc => "iyada" ;-} Abs => []} ; - a = Sg3 Fem ; isPron = True ; + s = table {Nom => "ay" ; Abs => []} ; + a = Sg3 Fem ; isPron = True ; sp = "iyada" ; poss = {s = "eed" ; v = vE ; sp = gnTable "eed" "eed" "uweed"} } ; Pl1 Excl => { - s = table {Nom => "aan" ; {-Voc => "annaga" ;-} Abs => "na"} ; - a = Pl1 Incl ; isPron = True ; + s = table {Nom => "aan" ; Abs => "na"} ; + a = Pl1 Incl ; isPron = True ; sp ="annaga" ; poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} } ; Pl1 Incl => { - s = table {Nom => "aynu" ; {-Voc => "innaga" ;-} Abs => "ina"} ; - a = Pl1 Incl ; isPron = True ; + s = table {Nom => "aynu" ; Abs => "ina"} ; + a = Pl1 Incl ; isPron = True ; sp ="innaga" ; poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} } ; Pl2 => { - s = table {Nom => "aad" ; {-Voc => "idinka" ;-} Abs => "idin"} ; - a = Pl2 ; isPron = True ; + s = table {Nom => "aad" ; Abs => "idin"} ; + a = Pl2 ; isPron = True ; sp ="idinka" ; poss = {s = "iin" ; v = vI ; sp = gnTable "iinn" "iinn" "uwiinn"} } ; Pl3 => { - s = table {Nom => "ay" ; {-Voc => "iyaga" ;-} Abs => []} ; - a = Pl3 ; isPron = True ; + s = table {Nom => "ay" ; Abs => []} ; + a = Pl3 ; isPron = True ; sp = "iyaga" ; poss = {s = "ood" ; v = vO ; sp = gnTable "ood" "ood" "uwood"} } ; Impers => { s = table {Nom => "la" ; Abs => "??"} ; - a = Impers ; isPron = True ; - poss = {s = "??" ; v = vO ; sp = gnTable "??" "??" "??"} + a = Impers ; isPron = True ; sp = "??" ; + poss = {s = "??" ; v = vA ; sp = gnTable "??" "??" "??"} } } ; - -- 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 { @@ -214,32 +218,31 @@ oper -- Det, Quant, Card, Ord BaseQuant : Type = { - s : Case => Str ; isPoss : Bool ; shortPoss : Str ; -- short form of possessive, e.g. family members } ; Determiner : Type = BaseQuant ** { - pref : Str ; -- Numerals ? + s, sp : Gender => Case => Str ; - d : NForm ; -- combination of number, state and vowel - isNum : Bool ; -- whether to choose Numerative as the value of NForm + d : NForm ; -- combination of number, state and vowel +-- isNum : Bool ; -- placement in NP + whether to choose Numerative from CN } ; Quant : Type = BaseQuant ** { + s, sp : GenNum => Case => Str ; st : State ; v : Vowel ; } ; Num : Type = { - s : Str ; -- TODO check if enough + s : State => Str ; -- TODO check if enough n : Number ; -- singular or plural isNum : Bool -- whether to choose Numerative as the value of NForm } ; baseQuant : BaseQuant = { - s = \\_ => [] ; isPoss = False ; shortPoss = [] } ; @@ -249,7 +252,7 @@ oper defQuantBind : (bind : Bool) -> (s, kan, tan, kuwan : Str) -> Vowel -> Quant = \b,s,spm,spf,spp,v -> let bind : Str -> Str = \x -> case b of {False => x ; True => BIND ++ x} ; in baseQuant ** { - s = \\c => + s = \\gn,c => let nom = case v of {NA => "u" ; _ => s + "i"} in case c of {Nom => bind nom ; _ => bind s} ; sp = \\gn,c => @@ -263,6 +266,7 @@ oper table {SgMasc => m ; SgFem => f ; _ => p} ; indefQuant : Quant = baseQuant ** { + s, sp = \\gn,c => [] ; st = Indefinite ; v = NA ; -- Will be ignored in DetQuant @@ -295,8 +299,8 @@ oper la => mkPrep "la" "ila" "kula" "nala" "idinla" "lala" ; u => mkPrep "u" "ii" "kuu" "noo" "idiin" "loo" ; 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" + -- impersonal subject clitic combining with object clitics. + passive => mkPrep "la" "la i" "lagu" "nala" "laydin" "la" } ; prepCombTable : Agreement => PrepCombination => Str = table { @@ -626,7 +630,10 @@ oper in prepCombTable ! agr ! combine vp.c2 vp.c3 ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> - let noun = if_then_Str np.isPron [] (np.s ! Abs) ; + let noun = case of { + => np.s ! Abs ; + => (pronTable ! np.a).sp ; -- long object pronoun for 3rd person object + _ => [] } -- no long object for other pronouns in case vp.obj2.a of { Unassigned => vp ** {obj2 = { @@ -652,7 +659,6 @@ oper } ; passV2 : Verb2 -> VerbPhrase = \v2 -> useVc v2 ** { - --s = forceAgr Impers v2.s ; c2 = passive ; c3 = v2.c2 ; } ;