diff --git a/src/somali/AdjectiveSom.gf b/src/somali/AdjectiveSom.gf index 345d85fb..19b4e6fd 100644 --- a/src/somali/AdjectiveSom.gf +++ b/src/somali/AdjectiveSom.gf @@ -8,12 +8,15 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in { -- elliptic-relational. -- : A -> AP ; - PositA a = a ; + PositA a = a ** { + compar = [] ; + } ; -- : A -> NP -> AP ; - -- ComparA a np = a ** { - -- s = \\agr => np.s ! Abs ++ "ka" ++ a.s ! AF Compar ; - -- } ; + ComparA a np = a ** { + s = \\af => "ka" ++ a.s ! af ; + compar = np.s ! Abs + } ; -- : A2 -> NP -> AP ; -- married to her -- ComplA2 a2 np = a2 ** { } ; @@ -25,7 +28,10 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in { UseA2 = PositA ; -- : A -> AP ; -- warmer - --UseComparA a = a ** {} ; + UseComparA a = a ** { + s = \\af => "ka" ++ a.s ! af ; + compar = [] + } ; -- : CAdv -> AP -> NP -> AP ; -- as cool as John @@ -34,7 +40,9 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in { -- The superlative use is covered in $Ord$. -- : Ord -> AP ; -- warmest - -- AdjOrd ord = ord ** {} ; + AdjOrd ord = ord ** { + compar = [] + } ; -- Sentence and question complements defined for all adjectival -- phrases, although the semantics is only clear for some adjectives. diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index eb1747c7..c4da9418 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -23,7 +23,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { -- Constructed in QuestionSom. QCl = ResSom.QClause ; - IComp = ResSom.Complement ; -- interrogative complement of copula e.g. "where" + IComp = SS ; -- interrogative complement of copula e.g. "where" IDet = ResSom.Determiner ; -- interrogative determiner e.g. "how many" IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which" IP = ResSom.NounPhrase ** {contractSTM : Bool} ; -- like NP but may contract with STM @@ -66,7 +66,10 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { Predet = {s : Str ; da : DefArticle ; isPoss : Bool} ; Quant = ResSom.Quant ; Num = ResSom.Num ; - Ord = {s : Str ; n : Number} ; + Ord = { + s : AForm => Str ; -- Ord can came from AP and become AP again + n : Number -- Ord can come from Num, which has inherent number + } ; DAP = ResSom.Determiner ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index bc680e61..e41754d1 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -13,15 +13,15 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { a = getAgr det.n (gender cn) } where { sTable : Case => Str = \\c => let nfc : {nf : NForm ; c : Case} = - case of { + case of { -- Numbers - => {nf=Numerative ; c=c} ; + => {nf=Numerative ; c=c} ; -- special form for fem. nouns - <_,Nom,False,Indefinite,Sg> => {nf=NomSg ; c=c} ; + <_,Nom,NoMod|OtherMod,Indefinite,Sg> => {nf=NomSg ; c=c} ; -- If cn has modifier, Nom ending attaches to the modifier - <_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ; + <_,Nom,AMod,_,_> => {nf=Def det.n ; c=Abs} ; -- a Det with st=Indefinite uses Indef forms <_,_,_,Indefinite,n> => {nf=Indef n ; c=c} ; @@ -30,13 +30,24 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { _ => {nf=Def det.n ; c=c} } ; art = gda2da cn.gda ! det.n ; - num = case det.isNum of {True => Sg ; _ => det.n} ; + num = case isNum det.numtype of {True => Sg ; _ => det.n} ; dt : {pref,s : Str} = case of { - => {s = [] ; pref = det.s ! art ! nfc.c} ; -- determiner comes before CN - <_, True,_> => {pref = [] ; s = det.sp ! gender cn ! nfc.c} ; -- CN has undergone ComplN2 and is already quantified - <_,_, True> => {pref = [] ; s = BIND ++ det.shortPoss ! art} ; - _ => {pref = [] ; s = det.s ! art ! nfc.c} + -- Det is a cardinal number. The number is the head of the NP, + -- and CN becomes its modifier. If CN has modifiers of its own, + -- we insert the conjunction "oo" between the number and the CN. + => + let oo = case det.numtype of {Compound => "oo" ; _ => []} + in {s = [] ; pref = det.s ! art ! nfc.c ++ oo} ; + + -- CN has undergone ComplN2 and is already quantified + <_,True,_> => {pref = [] ; s = det.sp ! gender cn ! nfc.c} ; + + -- CN is e.g. a kinship term and takes short possessive + <_,_,True> => {pref = [] ; s = BIND ++ det.shortPoss ! art} ; + + -- Default case + _ => {pref = [] ; s = det.s ! art ! nfc.c} } ; in dt.pref -- if det is numeral ++ cn.s ! nfc.nf @@ -56,15 +67,15 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { UsePron pron = pron ** {st = Definite} ; -- : Predet -> NP -> NP ; -- only the man - PredetNP predet np = + PredetNP predet np = let qnt = PossPron (pronTable ! np.a) ; det = qnt.shortPoss ! predet.da ; predetS : Str = case predet.isPoss of { True => glue predet.s det ; - False => predet.s + False => predet.s } ; in np ** { - s = \\c => + s = \\c => case of { => np.empty ++ predetS ; _ => np.s ! c ++ predetS} ; @@ -120,30 +131,26 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { -- : Quant -> Num -> Det ; DetQuant quant num = let indep = Hal in quant ** { s = \\da,c => - case num.isNum of { + case isNum num.numtype of { True => num.s ! indep ++ quant.s ! num.da ! c ++ num.thousand ; False => num.s ! indep ++ quant.s ! da ! c ++ num.thousand } ; - sp = \\g,c => case of { -- TODO check what happens when num.isNum + sp = \\g,c => case of { => num.s ! indep ++ quant.sp ! SgMasc ! c ++ num.thousand ; => num.s ! indep ++ quant.sp ! SgFem ! c ++ num.thousand ; -- Independent form uses plural morpheme, not gender-flipped allomorph => num.s ! indep ++ quant.sp ! PlInv ! c ++ num.thousand } ; - isNum = num.isNum ; + numtype = num.numtype ; n = num.n ; shortPoss = \\da => quant.shortPoss ! da ++ num.s ! indep } ; - -- d = case of { - -- => Numerative ; - -- => Def num.n quant.v ; - -- => Indef num.n } ; -- : Quant -> Num -> Ord -> Det ; -- these five best DetQuantOrd quant num ord = let theseFive = DetQuant quant num in theseFive ** { - s = \\g,c => theseFive.s ! g ! c ++ ord.s ; - sp = \\g,c => theseFive.sp ! g ! c ++ ord.s ; - shortPoss = \\da => theseFive.shortPoss ! da ++ ord.s + s = \\g,c => theseFive.s ! g ! c ++ ord.s ! AF num.n c ; + sp = \\g,c => theseFive.sp ! g ! c ++ ord.s ! AF num.n c ; + shortPoss = \\da => theseFive.shortPoss ! da ++ ord.s ! AF num.n Abs } ; -- Whether the resulting determiner is singular or plural depends on the @@ -157,7 +164,11 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { NumPl = baseNum ** {n = Pl} ; -- : Card -> Num ; - NumCard card = card ** {isNum = True} ; + NumCard card = card ** { + numtype = case card.hasThousand of { + True => Compound ; + False => Basic } + } ; -- : Digits -> Card ; -- NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; @@ -173,17 +184,20 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { OrdDigits digs = digs ** { s = digs.s ! NOrd } ; -} -- : Numeral -> Ord ; - OrdNumeral num = num ** {s = num.ord} ; + OrdNumeral num = num ** { + s = \\_ => num.ord + } ; -{- -- : A -> Ord ; - OrdSuperl a = { } ; + OrdSuperl a = { + s = \\af => "ugu" ++ a.s ! af ; + n = Sg -- ?? is this meaningful? + } ; -- One can combine a numeral and a superlative. -- : Numeral -> A -> Ord ; -- third largest - OrdNumeralSuperl num a = num ** { } ; --} + -- OrdNumeralSuperl num a = num ** { } ; -- : Quant DefArt = defQuant "a" "kan" "tan" "kuwan" False ; @@ -242,22 +256,28 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { Use3N3 n3 = lin N2 n3 ; -- : AP -> CN -> CN AdjCN ap cn = cn ** { - s = table { NomSg => cn.s ! Indef Sg ; -- When an adjective is added, noun loses case marker. - x => cn.s ! x } ; + s = table { -- Add oo after Numerative only if this is CN's first modifier. + Numerative => cn.s ! Numerative + ++ andConj Indefinite (notMod cn.modtype) ; + NomSg => cn.s ! Indef Sg ; -- Add adj -> noun loses case marker + nf => cn.s ! nf } ; mod = \\st,n,c => cn.mod ! st ! n ! Abs -- If there was something before, it is now in Abs - ++ andConj st cn.hasMod -- If the sentence is already modified, any new modifier needs to be introduced with conjunction + ++ andConj st cn.modtype -- If the sentence is already modified, any new modifier needs to be introduced with conjunction ++ ap.s ! AF n c ; - hasMod = True + modtype = AMod } ; -- : CN -> RS -> CN ; RelCN cn rs = cn ** { + s = table { + Numerative => cn.s ! Numerative ++ andConj Indefinite (notMod cn.modtype) ; + nf => cn.s ! nf } ; mod = \\st,n,c => --what to do with subject case if there's both adj and RS? cn.mod ! st ! n ! Abs - ++ andConj st cn.hasMod + ++ andConj st cn.modtype ++ rs.s ! st ! gennum cn Sg ! c ; -- gennum cn Sg, because plural form is only for 1st person plural - hasMod = True ; + modtype = AMod } ; {- @@ -286,11 +306,23 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { PossNP cn np = cn ** { -- guriga Axmed, not Axmed gurigiisa mod = \\st,n,c => cn.mod ! st ! n ! c ++ objpron np ! Abs } ; -{- + -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples - PartNP cn np = cn ** { } ; - + PartNP cn np = cn ** { + s = table { + Numerative => cn.s ! Numerative ++ andConj Indefinite (notMod cn.modtype) ; + nf => cn.s ! nf } ; + mod = \\st,n,c => + cn.mod ! st ! n ! c + ++ andConj st cn.modtype -- If the sentence is already modified, any new modifier needs to be introduced with conjunction + ++ objpron np ! Abs + ++ "ah" ; + modtype = case cn.modtype of { + AMod => AMod ; + _ => OtherMod } + } ; +{- -- This is different from the partitive, as shown by many languages. @@ -308,10 +340,10 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { -} oper - andConj : State -> Bool -> Str = \st,hasMod -> - case of { - => "oo" ; - => "ee" ; - _ => [] + andConj : State -> ModType -> Str = \st,mod -> + case of { + => "oo" ; + => "ee" ; + _ => [] } ; } diff --git a/src/somali/NumeralSom.gf b/src/somali/NumeralSom.gf index b674f132..0ace5e5d 100644 --- a/src/somali/NumeralSom.gf +++ b/src/somali/NumeralSom.gf @@ -40,6 +40,7 @@ lincat Sub10, Sub100, Sub1000, Sub1000000 = { s : DForm => Str ; thousand : Str ; -- TODO figure out if this really works so + hasThousand : Bool ; ord : Str ; da : DefArticle ; n : Number @@ -64,25 +65,28 @@ lin n7 = mkNum2 "toddoba" "toddobaatan" ; lin n8 = mkNum2Masc "siddeed" "siddeetan" ; lin n9 = mkNum2Masc "sagaal" "sagaashan" ; -lin pot01 = n1.unit ** {n = Sg ; thousand = []} ; +lin pot01 = n1.unit ** {n = Sg ; thousand = [] ; hasThousand = False} ; -lin pot0 d = d.unit ** {n = Pl ; thousand = []} ; +lin pot0 d = d.unit ** {n = Pl ; thousand = [] ; hasThousand = False} ; lin pot110 = n1.ten ** { s = \\df => n1.ten.s ; thousand = [] ; + hasThousand = False ; n = Pl } ; lin pot111 = { s = \\_ => "koob iyo" ++ n1.ten.s ; ord = "koob iyo" ++ n1.ten.ord ; thousand = [] ; + hasThousand = False ; da = M KA ; n = Pl } ; lin pot1to19 d = { s = \\_ => d.unit.s ! Hal ++ "iyo" ++ n1.ten.s ; thousand = [] ; + hasThousand = False ; ord = d.unit.s ! Hal ++ "iyo" ++ n1.ten.ord ; da = M KA ; n = Pl @@ -91,26 +95,31 @@ lin pot0as1 n = n ; lin pot1 d = d.ten ** { s = \\df => d.ten.s ; thousand = [] ; + hasThousand = False ; n = Pl } ; lin pot1plus d e = d.ten ** { s = \\b => e.s ! b ++ "iyo" ++ d.ten.s ; ord = e.s ! Hal ++ "iyo" ++ d.ten.ord ; thousand = [] ; + hasThousand = False ; n = Pl ; } ; lin pot1as2 n = n ; lin pot2 d = d ** { thousand = "boqol" ; + hasThousand = True ; ord = d.s ! Hal ++ "boqlaad" } ; lin pot2plus d e = d ** { thousand = "boqol iyo" ++ e.s ! Hal ; + hasThousand = True ; ord = d.s ! Hal ++ "boqol iyo" ++ e.ord ; n = Pl} ; lin pot2as3 n = n ; lin pot3 n = n ** { thousand = n.thousand ++ "kun" ; + hasThousand = True ; ord = n.s ! Hal ++ "kunaad" ; n = Pl } ; @@ -119,9 +128,7 @@ lin pot3plus n m = n ** { ord = n.ord ++ "kun iyo" ++ m.ord ; n = Pl} ; ---TODO: --- two thousand small cats --- => laba kun oo bisadood oo yar (kun and bisadood are both attributes) + ---------------------------------------------------------------------------- lincat Dig = TDigit ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 1c93f681..531a3a35 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -210,12 +210,29 @@ param CardOrd = NOrd | NCard ; + -- to know whether to put oo in between numeral and CN + NumType = NoNum | Basic | Compound ; + +oper + isNum : NumType -> Bool = \nt -> case nt of { + NoNum => False ; + _ => True + } ; -------------------------------------------------------------------------------- -- Adjectives param AForm = AF Number Case ; ---- TODO: past tense + ModType = NoMod | AMod | OtherMod ; + +oper + -- to flip ModType + notMod : ModType -> ModType = \mt -> case mt of { + NoMod => OtherMod ; + _ => NoMod + } ; + -------------------------------------------------------------------------------- -- Prepositions diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 5d8966a7..86e0f151 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -24,8 +24,8 @@ concrete QuestionSom of Question = CatSom ** open subj = cls.subj ** { -- keep old subject pronoun, noun = ip.s ! Nom -- and place IP first. } ; - obj2 = cls.obj2 ** { -- move old subject noun before object. - s = cls.subj.noun ++ cls.obj2.s + obj = cls.obj ** { -- move old subject noun before object. + s = cls.subj.noun ++ cls.obj.s } ; stm = modSTM "baa" baan cls.stm } ; @@ -50,7 +50,7 @@ concrete QuestionSom of Question = CatSom ** open -- : IComp -> NP -> QCl ; -- where is John? QuestIComp icomp np = - let cls = predVP np (VS.UseComp icomp) ; + let cls = predVP np (VS.UseComp (icomp2comp icomp)) ; -- cl = cls ** { -- TODO: neg. questions -- stm : ClType=>Polarity=>Str = \\_,_ => "waa" -- } @@ -87,18 +87,10 @@ concrete QuestionSom of Question = CatSom ** open -- pronouns. -- : IAdv -> IComp ; - CompIAdv iadv = { -- where (is it) - aComp = \\_ => [] ; - nComp = iadv.s ; - stm = Waa NoCopula ; - } ; + CompIAdv iadv = iadv ; -- where (is it) -- : IP -> IComp ; - CompIP ip = { -- who (is it) - aComp = \\_ => [] ; - nComp = ip.s ! Abs ; - stm = Waa NoCopula ; - } ; + CompIP ip = {s = ip.s ! Abs} ; -- who (is it) {- -- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. @@ -117,6 +109,13 @@ concrete QuestionSom of Question = CatSom ** open oper + icomp2comp : SS -> Complement = \icomp -> icomp ** { + aComp = \\_ => [] ; + nComp = icomp.s ; + compar = [] ; + stm = Waa NoCopula + } ; + -- Question clauses: subject pronoun not included, STM is cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp -> let hasSubjPron : Bool = False ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index a4c5564c..32bb9d9c 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -15,7 +15,7 @@ oper CNoun : Type = Noun ** { mod : State -- for conjunctions: oo for indef, ee for def => Number => Case => Str ; - hasMod : Bool ; + modtype : ModType ; isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father" } ; @@ -46,12 +46,16 @@ oper magacya + "da" => magacya ; wiila + "sha" => wiila ; _ => wiilal} ; - bisadi : Str = case gender of - { Fem => case wiil of { _ + #c => wiil+"i" ; _ => wiil} ; - Masc => wiil } ; - bisadood : Str = case gender of - { Fem => case wiilal of {_ + "o" => wiilal+"od" ; _ => wiil} ; - Masc => wiil } + bisadi : Str = case gender of { + Fem => case wiil of { + _ + #c => wiil+"i" ; + _ => wiil } ; + Masc => wiil } ; + bisadood : Str = case gender of { + Fem => case wiilal of { + _ + "o" => wiilal+"od" ; + _ => wiil } ; + Masc => wiil } } ; ------------------------- @@ -155,7 +159,7 @@ oper False => np.s} ; useN : Noun -> CNoun ** BaseNP = \n -> n ** - { mod = \\_,_,_ => [] ; hasMod = False ; + { mod = \\_,_,_ => [] ; modtype = NoMod ; a = Sg3 (gender n) ; isPron,isPoss = False ; empty = [] ; st = Indefinite } ; @@ -275,7 +279,7 @@ oper Determiner : Type = BaseQuant ** { sp : Gender => Case => Str ; n : Number ; - isNum : Bool ; -- placement in NP + whether to choose Numerative from CN + numtype : NumType ; -- placement in NP + whether to choose Numerative from CN } ; Quant : Type = BaseQuant ** { @@ -285,6 +289,7 @@ oper BaseNum : Type = { s : DForm => Str ; -- independent or attribute thousand : Str ; -- TODO check where possessive suffix goes + hasThousand : Bool ; da : DefArticle ; n : Number } ; @@ -292,13 +297,14 @@ oper baseNum : Num = { s = \\_ => [] ; thousand = [] ; + hasThousand = False ; da = M KA ; n = Sg ; - isNum = False + numtype = NoNum } ; Num : Type = BaseNum ** { - isNum : Bool -- whether to choose Numerative as the value of NForm + numtype : NumType -- whether to choose Numerative as the value of NForm } ; Numeral : Type = BaseNum ** { @@ -422,17 +428,9 @@ oper -- Sequences of adjectives follow the rules for restrictive relatives clauses, i.e. are linked by oo 'and' on an indefinite head NounPhrase and by ee 'and' on a definite NounPhrase (8.1). - -- Komparativ - -- För att uttrycka motsvarigheten till svenskans komparativ placerar man på somaliska helt enkelt prepositionen ká 'från, av, än' framför adjektivet i fråga. Adjektivet får ingen ändelse. - -- Shan waa ay ká yar tahay siddéed. Fem är mindre än åtta. - -- Superlativ - -- Motsvarigheten till svenskans superlativ bildas med prepositionsklustret ugú som till sin betydelse närmast motsvarar svenskans allra, t.ex. - -- ugu horrayntii (det att komma) allra först - Adjective : Type = {s : AForm => Str} ; Adjective2 : Type = Adjective ** {c2 : Preposition} ; - duplA : Str -> Adjective = \yar -> let yaryar = duplicate yar in mkAdj yar yaryar ; @@ -464,7 +462,7 @@ oper => q + a + y + b + sg ; --qayb+qaybsan, fiic+fiican _ => sg + sg } ; - AdjPhrase : Type = Adjective ; + AdjPhrase : Type = Adjective ** {compar : Str} ; -------------------------------------------------------------------------------- -- Verbs @@ -728,13 +726,14 @@ oper Complement : Type = { aComp : Agreement => Str ; nComp : Str ; + compar : Str ; -- comparative is discontinuous stm : STM ; -- to choose right sentence type marker } ; VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** { c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun. - obj2 : NPLite ; -- {s : Str ; a : PrepAgr} - secObj : Str ; -- if two overt pronoun objects + obj : NPLite ; -- {s : Str ; a : PrepAgr} + obj2 : Str ; -- if two overt pronoun objects vComp : {subjunc : Str ; -- "waa in" or subjunctive construction: "in" is placed here inf : Str ; -- auxiliary VV with infinitive argument subcl : Agreement => Str} -- VV complement if it's a subordinate clause @@ -747,14 +746,15 @@ oper True => Waa Copula ; False => Waa NoPred } ; + compar = [] ; nComp = [] ; aComp = \\_ => [] ; vComp = {subjunc, inf = [] ; subcl = \\_ => []} ; berri,miscAdv = [] ; c2 = Single NoPrep ; - obj2 = {s = [] ; a = P3_Prep} ; - secObj = [] + obj = {s = [] ; a = P3_Prep} ; + obj2 = [] } ; useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** { @@ -778,10 +778,10 @@ oper } ; insertRefl : VPSlash -> VPSlash = \vps -> vps ** { - obj2 = vps.obj2 ** {a = Reflexive_Prep} ; + obj = vps.obj ** {a = Reflexive_Prep} ; - -- If old obj2 was something else than P3, it is now shown in secObj - secObj = vps.secObj ++ secondObject ! vps.obj2.a ; + -- If old obj was something else than P3, it is now shown in obj2 + obj2 = vps.obj2 ++ secondObject ! vps.obj.a ; } ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> @@ -799,25 +799,25 @@ oper -- To generalise insertAdv and insertComp VPLite : Type = { c2 : PrepCombination ; - obj2 : NPLite ; - sii,dhex,berri,miscAdv,secObj : Str} ; + obj : NPLite ; + sii,dhex,berri,miscAdv,obj2 : Str} ; insertCompLite : VPLite -> NPLite -> VPLite = \vp,nplite -> - case vp.obj2.a of { + case vp.obj.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. + -- We keep both old and new string (=noun, if there was one) in obj.s. P3_Prep => - vp ** {obj2 = nplite ** { - s = nplite.s ++ vp.obj2.s} - } ; -- no secObj, because there's ≤1 non-3rd-person pronoun. + vp ** {obj = nplite ** { + s = nplite.s ++ vp.obj.s} + } ; -- no obj2, 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 = nplite.s ++ vp.obj2.s + vp ** {obj = vp.obj ** { + s = nplite.s ++ vp.obj.s } ; - secObj = vp.secObj ++ secondObject ! nplite.a} + obj2 = vp.obj2 ++ secondObject ! nplite.a} } ; insertAdvLite : VPLite -> Adverb -> VPLite = \vp,adv -> @@ -851,8 +851,8 @@ oper ClSlash : Type = BaseAdv ** { -- Fixed in Cl subj : {noun, pron : Str ; isP3 : Bool} ; -- noun and subject pronoun if applicable - obj2 : NPLite ; - secObj : Str ; + obj : NPLite ; + obj2 : Str ; c2 : PrepCombination ; -- NB. QuestIAdv can add more prepositions aComp : Str ; nComp : Str ; @@ -872,6 +872,7 @@ oper predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vps -> vp ** { subj = {noun = subjnoun ; pron = subjpron ; isP3 = isP3 subj.a} ; + obj = vp.obj ** {s = vp.obj.s ++ vp.compar} ; pred = \\cltyp,t,a,p => let predRaw = vf cltyp t a p subj.a vp ; in case of { @@ -930,10 +931,10 @@ oper s = \\t,a,p => let -- Put all arguments in their right place --cl : ClSlash = complCl incomplCl ; - prepComb = prepCombTable ! cl.obj2.a ! cl.c2 ; + prepComb = prepCombTable ! cl.obj.a ! cl.c2 ; -- Contractions - bind : Str = case of { + bind : Str = case of { => [] ; -- nothing to attach to the STM _ => BIND } ; -- something to attach, use BIND prepCombNeg : Str = case of { @@ -947,7 +948,7 @@ oper -- Placement of object noun varies depending on type of clause statementNounObj = case cltyp of { - Statement => cl.obj2.s ; + Statement => cl.obj.s ; _ => [] } ; statementNounComp = case cltyp of { Statement => cl.nComp ; @@ -955,11 +956,11 @@ oper -- for subord and question, NP predicatives and objects behave the same subordNounObj = case cltyp of { - Subord => cl.obj2.s ++ cl.nComp ; + Subord => cl.obj.s ++ cl.nComp ; _ => [] } ; questionNounObj = case cltyp of { PolarQuestion|WhQuestion - => cl.obj2.s ++ cl.nComp ; + => cl.obj.s ++ cl.nComp ; _ => [] } ; -- Control whether to include subject pronoun and STM @@ -989,7 +990,7 @@ oper ++ cl.sii -- restricted set of particles ++ cl.dhex -- restricted set of nouns/adverbials - ++ cl.secObj -- "second object" + ++ cl.obj2 -- "second object" ++ cl.vComp.inf -- VV complement, if it's infinitive ++ cl.pred ! cltyp ! t ! a ! p -- the inflecting verb ++ questionNounObj -- noun object if it's a question @@ -1095,31 +1096,30 @@ oper linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp -> let pred = vp.s ! vf ; - pr = prepCombTable ! vp.obj2.a ! vp.c2 ; - -- obj = {p1 = np.s ; - -- p2 = vp.aComp ! pagr2agr np.a ++ prepCombTable ! np.a ! vps.c2} ; + pr = prepCombTable ! vp.obj.a ! vp.c2 ; neg = case of { => "aan" ; _ => [] } ; in wordOrder cltyp neg pred pr vp ; + -- Light version of the word order complexity in mkClause. wordOrder : ClType -> (neg,pred,prepcomb : Str) -> VerbPhrase -> Str = \cltyp,neg,pred,pr,vp -> vp.berri -- AdV ++ case cltyp of { Subord => [] ; - _ => vp.obj2.s {-obj.p1-} } -- noun object if it's a statement + _ => vp.obj.s } -- noun object if it's a statement ++ neg ++ vp.vComp.subjunc -- "waa in" construction ++ case cltyp of { - Subord => vp.obj2.s ; -- noun object if it's subordinate clause + Subord => vp.obj.s ; -- noun object if it's subordinate clause _ => [] } - ++ vp.aComp ! pagr2agr vp.obj2.a -- AP complement agreeing with object + ++ vp.aComp ! pagr2agr vp.obj.a -- AP complement agreeing with object ++ pr -- object if it's a pronoun ++ vp.sii -- restricted set of particles ++ vp.dhex -- restricted set of nouns/adverbials - ++ vp.secObj -- "second object" + ++ vp.obj2 -- "second object" ++ vp.vComp.inf -- VV complement, if it's infinitive ++ pred -- the verb inflected ++ vp.vComp.subcl ! Sg3 Masc -- VV complement, if it's subordinate clause diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index c66b9f9f..50ddf22d 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -68,7 +68,8 @@ lin much_Det = R.indefDet "" sg ; -} lin somePl_Det = { sp = \\_,_ => "qaar" ; - isPoss, isNum = False ; + isPoss = False ; + numtype = NoNum ; st = Definite ; -- NB. Indefinite means actually only IndefArt. n = Pl ; s = \\x,_ => BIND ++ defStems ! x ++ BIND ++ "a qaarkood" ; diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index ab17f11b..dc81f471 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -18,8 +18,8 @@ lin ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of { Waa_In => vp ** { vComp = vc ** {subjunc = vv.s ! VInf} ; -- it's always the word "in", and it will be placed before subject pronoun. it's placed in vv.s!VInf so that the VV would contribute with some string. /IL - obj2 = vp.obj2 ** {s = []} ; -- word order hack to avoid more parameters: - miscAdv = vp.miscAdv ++ vp.obj2.s -- dump the object to miscAdv + obj = vp.obj ** {s = []} ; -- word order hack to avoid more parameters: + miscAdv = vp.miscAdv ++ vp.obj.s -- dump the object to miscAdv } ; Subjunctive => useV vv ** { @@ -46,7 +46,7 @@ lin ComplVS vs s = let vps = useV vs ; subord = SubjS {s="in"} s ; - in vps ** {obj2 = {s = subord.berri ; a = P3_Prep}} ; + in vps ** {obj = {s = subord.berri ; a = P3_Prep}} ; {- -- : VQ -> QS -> VP ; @@ -137,6 +137,7 @@ lin CompAP ap = { aComp = \\a => ap.s ! AF (getNum a) Abs ; nComp = [] ; + compar = ap.compar ; stm = Waa Copula ; } ; @@ -145,6 +146,7 @@ lin -- I am [a house that sleeps here] vs. we are [houses that sleep here] aComp = \\a => cn2str (getNum a) Abs cn ; nComp = [] ; + compar = [] ; stm = Waa NoCopula ; } ; @@ -152,6 +154,7 @@ lin CompNP np = { aComp = \\a => [] ; nComp = np.s ! Abs ; + compar = [] ; stm = Waa NoCopula ; } ; @@ -159,6 +162,7 @@ lin CompAdv adv = { aComp = \\a => linAdv adv ; -- TODO check placement nComp = [] ; + compar = [] ; stm = Waa Copula ; } ; diff --git a/src/somali/unittest/ap.gftest b/src/somali/unittest/ap.gftest index dd426d7a..baf20a2f 100644 --- a/src/somali/unittest/ap.gftest +++ b/src/somali/unittest/ap.gftest @@ -1,3 +1,7 @@ +------------------ +-- Conjunctions -- +------------------ + -- LangEng: the big black bird LangSom: shimbir BIND ta madow ee weyn Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt NumSg) (AdjCN (PositA big_A) (AdjCN (PositA black_A) (UseN bird_N))))) NoVoc @@ -5,3 +9,24 @@ Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt NumSg) (AdjCN (PositA big_A) -- LangEng: a big black bird LangSom: shimbir madow oo weyn Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt NumSg) (AdjCN (PositA big_A) (AdjCN (PositA black_A) (UseN bird_N))))) NoVoc + +----------------- +-- Comparative -- +----------------- + +-- Examples from Saeed p. 107 +-- LangEng: that cat is bigger +LangSom: bisad BIND daasi waa ka weyn tahay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompAP (UseComparA big_A)))))) NoVoc + +-- LangEng: that cat is bigger than this cat +LangSom: bisad BIND daasi bisad BIND dan waa ka weyn tahay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompAP (ComparA big_A (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)))))))) NoVoc + +-- LangEng: that cat is biggest +LangSom: bisad BIND daasi waa ugu weyn tahay +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompAP (AdjOrd (OrdSuperl big_A))))))) NoVoc + +-- LangEng: cat is the biggest animal that I saw +LangSom: bisadi waa xayawaan BIND ka ugu weyn aan arkay +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (MassNP (UseN cat_N)) (UseComp (CompNP (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl big_A)) (RelCN (UseN animal_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (SlashV2a see_V2))))))))) diff --git a/src/somali/unittest/num.gftest b/src/somali/unittest/num.gftest index d0e90762..efa0dc0e 100644 --- a/src/somali/unittest/num.gftest +++ b/src/somali/unittest/num.gftest @@ -1,8 +1,11 @@ +------------------------------- +-- Numerals with determiners -- +------------------------------- + -- LangEng: the two cats LangSom: laba BIND da bisadood Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN cat_N))) NoVoc - -- LangEng: those three men LangSom: saddex BIND daas nin Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant that_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN man_N))) NoVoc @@ -25,4 +28,28 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_ -- LangEng: he is my first man LangSom: waa nin BIND kayg BIND a kowaad -Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (UseComp (CompNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN man_N))))))) NoVoc \ No newline at end of file +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (UseComp (CompNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN man_N))))))) NoVoc + +-------------------------------------- +-- Numerals with multiple modifiers -- +-------------------------------------- + +-- LangEng: two cats +LangSom: laba bisadood +Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN cat_N))) NoVoc + +-- LangEng: two small cats +LangSom: laba bisadood oo yar +Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (AdjCN (PositA small_A) (UseN cat_N)))) NoVoc + +-- LangEng: two small cats that have meat +LangSom: laba bisadood oo yar oo hilib leh +Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (RelCN (AdjCN (PositA small_A) (UseN cat_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a have_V2) (MassNP (UseN meat_N)))))))) NoVoc + +-- LangEng: two thousand cats +LangSom: laba kun oo bisadood +Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN cat_N))) NoVoc + +-- LangEng: two thousand small cats +LangSom: laba kun oo bisadood oo yar +Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot3 (pot1as2 (pot0as1 (pot0 n2)))))))) (AdjCN (PositA small_A) (UseN cat_N)))) NoVoc