diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 01204f5f..ea593b70 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -80,8 +80,8 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { -- Constructed in NumeralSom. - Card = {s : State => Str ; n : Number} ; - Numeral = {s : CardOrd => State => Str ; n : Number} ; + Card = BaseNum ; + Numeral = ResSom.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index 8b8e0533..bf06d494 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -41,8 +41,8 @@ lin bird_N = mkN "shimbir" fem ; -- lin bone_N = mkN "" ; -- lin boot_N = mkN "" ; -- lin boss_N = mkN "" ; -lin book_N = mkN "buug" ; -- TODO: irregular plural -lin boy_N = mkN "wiil" ; +lin book_N = (mk2N "buug" "buugaag") ** {pl = F TA} ; +lin boy_N = mk2N "wiil" "wiilal" ; lin bread_N = mkN "rooti" ; --masc/fem -- lin break_V2 = mkV2 "" ; -- lin breast_N = mkN "" ; diff --git a/src/somali/MissingSom.gf b/src/somali/MissingSom.gf index 36c75fb6..16f6358c 100644 --- a/src/somali/MissingSom.gf +++ b/src/somali/MissingSom.gf @@ -93,13 +93,9 @@ oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; oper ImpVP : VP -> Imp = notYet "ImpVP" ; oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; -oper IndefArt : Quant = notYet "IndefArt" ; -oper IndefArt : Quant = notYet "IndefArt" ; oper NumCard : Card -> Num = notYet "NumCard" ; oper NumDigits : Digits -> Card = notYet "NumDigits" ; oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ; -oper NumPl : Num = notYet "NumPl" ; -oper NumSg : Num = notYet "NumSg" ; oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ; oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index 17446f02..e1d7d12c 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -9,35 +9,36 @@ 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 } where { + a = getAgr det.n (gender cn) } where { sTable : Case => Str = \\c => let nfc : {nf : NForm ; c : Case} = - case of { - -- special form for fem. nouns - => {nf=NomSg ; c=c} ; + case of { + -- Numbers + => {nf=Numerative ; c=c} ; - -- special case for DefArt+Nom: override vowel - => {nf=Def x vU ; c=c} ; + -- special form for fem. nouns + <_,Nom,False,Indefinite,Sg> => {nf=NomSg ; c=c} ; + + -- Definite + <_,Nom,False,Definite,n> => {nf=Def n ; c=c} ; -- If cn has modifier, Nom ending attaches to the modifier - => {nf=det.d ; c=Abs} ; - _ => {nf=det.d ; c=c} + <_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ; + _ => {nf=Def det.n ; c=c} -- TODO check } ; - detStr : Str = - 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 + art = case det.n of {Sg => cn.sg ; Pl => cn.pl} ; + num = case det.isNum 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} } ; - pref : Str = case det.d of { - Numerative => det.s ! cn.g ! nfc.c ; - _ => [] - } ; - in pref -- if det is numeral. + in dt.pref -- if det is numeral ++ cn.s ! nfc.nf - ++ detStr -- non-numeral det - ++ cn.mod ! getNum (getAgr det.d Masc) ! c + ++ dt.s -- non-numeral det + ++ cn.mod ! num ! c } ; -- : PN -> NP ; @@ -74,7 +75,7 @@ DetCN det cn = useN cn ** { -- : Det -> NP ; DetNP det = { s = det.sp ! Masc ; ---- Any way to decide for gender here? - a = getAgr det.d Masc ; + a = getAgr det.n Masc ; isPron = False ; } ; @@ -91,25 +92,24 @@ DetCN det cn = useN cn ** { -- quantifier and an optional numeral can be discerned. -- : Quant -> Num -> Det ; - DetQuant quant num = quant ** { - 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 } ; + DetQuant quant num = let indep = Hal in quant ** { + s = \\da,c => + case num.isNum 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 { - => num.s ! quant.st ++ quant.sp ! SgMasc ! c ; - => num.s ! quant.st ++ quant.sp ! SgFem ! c ; + sp = \\g,c => case of { -- TODO check what happens when num.isNum + => 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 ! quant.st ++ quant.sp ! PlInv ! c } ; - - d = case of { - => Numerative ; - => Def num.n quant.v ; - => Indef num.n } ; + => num.s ! indep ++ quant.sp ! PlInv ! c ++ num.thousand } ; + isNum = num.isNum ; + n = num.n } ; + -- d = case of { + -- => Numerative ; + -- => Def num.n quant.v ; + -- => Indef num.n } ; -- : Quant -> Num -> Ord -> Det ; -- these five best DetQuantOrd quant num ord = @@ -125,8 +125,8 @@ 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 = baseNum ; + NumPl = baseNum ** {n = Pl} ; -- : Card -> Num ; NumCard card = card ** {isNum = True} ; @@ -135,7 +135,7 @@ DetCN det cn = useN cn ** { -- NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; -- : Numeral -> Card ; - NumNumeral num = num ** {s = num.s ! NCard}; + NumNumeral num = num ; -- ** {s = num.s ! NCard}; {- -- : AdN -> Card -> Card ; @@ -145,7 +145,7 @@ DetCN det cn = useN cn ** { OrdDigits digs = digs ** { s = digs.s ! NOrd } ; -} -- : Numeral -> Ord ; - OrdNumeral num = num ** {s = num.s ! NOrd ! Indefinite} ; + OrdNumeral num = num ** {s = num.ord} ; {- -- : A -> Ord ; @@ -166,18 +166,15 @@ DetCN det cn = useN cn ** { -- : Pron -> Quant PossPron pron = let p = pron.poss ; - gntbl = gnTable (BIND ++ p.sp ! SgMasc) - (BIND ++ p.sp ! SgFem) - (BIND ++ p.sp ! PlInv) in DefArt ** { - shortPoss = BIND ++ p.s ; + shortPoss = p.short ; isPoss = True ; - s = \\gn,c => let casevow = case c of {Nom => "u" ; Abs => "a"} - in gntbl ! gn ++ BIND ++ casevow ; + s = \\da,c => let casevow = case c of {Nom => "u" ; Abs => "a"} + in BIND ++ p.s ! da ++ BIND ++ casevow ; + sp = \\gn,c => let prefix = case gn of {SgFem => "t" ; _ => "k"} ; casevow = case c of {Nom => "u" ; Abs => "a"} - in prefix ++ gntbl ! gn ++ BIND ++ casevow ; - v = p.v + in prefix ++ BIND ++ p.sp ! gn ++ BIND ++ casevow ; } ; --2 Common nouns @@ -188,19 +185,19 @@ DetCN det cn = useN cn ** { -- : N2 -> NP -> CN ; -- Sahra hooyadeed ComplN2 n2 np = let cn = useN n2 in cn ** {s = \\nf => - 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 { + let num = case nf of { + Def n => n ; Indef n => n ; - Def n v => n ; _ => Sg } ; + art = case num of {Sg => cn.sg ; Pl => cn.pl} ; + qnt = PossPron (pronTable ! np.a) ; + det = case cn.shortPoss of { + True => qnt.shortPoss ! art ; + _ => qnt.s ! n2.sg ! Abs } ; 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 ; + in noun ++ cn.s ! Def num ++ BIND ++ det ; isPoss = True} ; {- diff --git a/src/somali/NumeralSom.gf b/src/somali/NumeralSom.gf index 2bf06d18..e542ee6f 100644 --- a/src/somali/NumeralSom.gf +++ b/src/somali/NumeralSom.gf @@ -3,15 +3,13 @@ concrete NumeralSom of Numeral = CatSom [Numeral,Digits] ** oper LinDigit : Type = { - s : DForm => CardOrd => State => Str -- TODO: for 1, hal and mid. variation kow-koob implemented with pre. + unit : {s : DForm => Str ; ord : Str ; da : DefArticle} ; + ten : {s, ord : Str ; da : DefArticle} } ; - 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 } + mkNum3 : (ucard,tcard,uord : Str) -> DefArticle -> LinDigit = \uc,tc,uo,ud -> { + unit = {s = \\df => uc ; ord = uo ; da = ud} ; + ten = {s = tc ; ord = tc + "aad" ; da = M KA} } ; mkNum2 : (ucard,tcard : Str) -> LinDigit = \uc,tc -> @@ -19,20 +17,25 @@ oper x + "a" => x + "aad" ; -- ?? x + #v + c@#c => x + c + "aad" ; _ => uc + "aad" } ; - in mkNum3 uc tc uo Fem ; + in mkNum3 uc tc uo (F DA) ; 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 ; + in mkNum3 uc tc uo (M KA) ; lincat Digit = LinDigit ; - Sub10, Sub100, Sub1000, Sub1000000 = - {s : CardOrd => State => Str ; n : Number} ; + Sub10, Sub100, Sub1000, Sub1000000 = { + s : DForm => Str ; + thousand : Str ; -- TODO figure out if this really works so + ord : Str ; + da : DefArticle ; + n : Number + } ; ---------------------------------------------------------------------------- @@ -40,9 +43,10 @@ lincat -- num : Sub1000000 -> Numeral ; lin num x = x ; -oper kow : Str = "kow" ; --pre {"iyo" => "koob" ; _ => "kow"} ; - -oper n1 = mkNum3 kow "toban" "kowaad" Fem ; +oper kow : DForm => Str = table {Kow => "kow" ; Hal => "hal" ; Mid => "mid"} ; +oper n1 : LinDigit = let one : LinDigit = mkNum2 "kow" "toban" in one ** { + unit = one.unit ** {s = kow} + } ; lin n2 = mkNum2 "laba" "labaatan" ; lin n3 = mkNum2 "saddex" "soddon" ; lin n4 = mkNum2 "afar" "afartan"; @@ -50,42 +54,67 @@ 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 n9 = mkNum2Masc "sagaal" "sagaashan" ; -lin pot01 = {s = n1.s ! Unit ; n = Sg} ; +lin pot01 = n1.unit ** {n = Sg ; thousand = []} ; -lin pot0 d = {s = d.s ! Unit ; n = Pl} ; +lin pot0 d = d.unit ** {n = Pl ; thousand = []} ; -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 pot110 = n1.ten ** { + s = \\df => n1.ten.s ; + thousand = [] ; + n = Pl + } ; +lin pot111 = { + s = \\_ => "koob iyo" ++ n1.ten.s ; + ord = "koob iyo" ++ n1.ten.ord ; + thousand = [] ; + da = M KA ; -- TODO check + n = Pl + } ; +lin pot1to19 d = { + s = \\_ => d.unit.s ! Kow ++ "iyo" ++ n1.ten.s ; + thousand = [] ; + ord = d.unit.s ! Kow ++ "iyo" ++ n1.ten.ord ; + da = M KA ; -- TODO check + 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 pot1 d = d.ten ** { + s = \\df => d.ten.s ; + thousand = [] ; + n = Pl + } ; +lin pot1plus d e = d.ten ** { + s = \\b => d.unit.s ! Kow ++ "iyo" ++ e.s ! b ; + ord = d.unit.s ! Kow ++ "iyo" ++ e.ord ; -- TODO check + thousand = [] ; + 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 pot2 d = d ** { + thousand = "boqol" ; -- TODO check + ord = d.s ! Kow ++ "boqlaad" + } ; -- TODO what's the def. art. allomorph? +lin pot2plus d e = d ** { + s = \\b => d.s ! b ++ "boqol iyo" ++ e.s ! b ; + ord = d.ord ++ "boqol iyo" ++ e.ord ; + n = Pl} ; lin pot2as3 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 pot3 n = n ** { + thousand = "kun" ; + ord = n.s ! Kow ++ "kunaad" ; + --da = M KA ; -- TODO check + n = Pl } ; +lin pot3plus n m = n ** { + s = \\b => n.s ! b ++ "kun iyo" ++ m.s ! b ; + ord = n.ord ++ "kun iyo" ++ m.ord ; + n = Pl} ; --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) +-- two thousand small cats +-- => laba kun oo bisadood oo yar (kun and bisadood are both attributes) ---------------------------------------------------------------------------- lincat Dig = TDigit ; @@ -100,7 +129,6 @@ oper n = num } ; - lin D_0 = mkDig "0" ; lin D_1 = mk2Dig "1" Sg ; lin D_2 = mkDig "2" ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index d378ac23..196dfbcc 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -24,9 +24,54 @@ oper -- Morphophonology param - Morpheme = mO | mKa | mTa ; - -- | mKii | mTii ; -- TODO check if needed + -- Allomorphs for the definite article + DefTA = TA | DA | SHA | DHA ; + DefKA = KA | GA | A_ | HA ; + DefArticle = M DefKA | F DefTA ; +oper + + defAllomorph : Str -> DefArticle = \wiilka -> + case wiilka of { + _ + "ta" => F DA ; _ + "sha" => F SHA ; + _ + "da" => F DA ; _ + "dha" => F DHA ; + _ + "ka" => M KA ; _ + "aha" => M HA ; + _ + "ga" => M GA ; _ => M A_ } ; + + -- Use always via quantTable! + defStems : DefArticle => Str = table { + M KA => "k" ; + M GA => "g" ; + M A_ => [] ; -- If we want magac~magiciisa, we need to split this into CA and A_. + M HA => "ah" ; -- NB. stem vowel replaced + F TA => "t" ; + F DA => "d" ; + F SHA => "sh" ; -- NB. stem l replaced + F DHA => "dh" + } ; + + quantTable = overload { + quantTable : Str -> DefArticle=>Str = \iis -> let i = head iis in table { + M HA => i + "h" + iis ; + x => defStems ! x + iis + } ; + quantTable : (ayg,ayd : Str) -> DefArticle=>Str = \ayg,ayd -> + let a = head ayg in table { + M HA => a + "h" + ayg ; + M x => defStems ! M x + ayg ; + F y => defStems ! F y + ayd + } + } ; + + head : Str -> Str = \s -> case s of { + x@? + _ => x ; + _ => "" -- Predef.error "head: empty string." + } ; + +-------------------------------------------- +-- Old version, may be deprecated eventually +param + Morpheme = mO | mKa | mTa ; oper allomorph : Morpheme -> Str -> Str = \x,stem -> case x of { @@ -34,28 +79,18 @@ oper d@("b"|"d"|"r"|"l"|"m"|"n") => d + "o" ; "c"|"g"|"i"|"j"|"x"|"s" => "yo" ; _ => "o" } ; - mTa => case stem of { -- Saeed p. 29 - _ + ("dh") => "dha" ; ---- ??? + _ + ("dh") => "dha" ; _ + (#v|"'"|"c"|"d"|"h"|"kh"|"q"|"w"|"x"|"y") => "da" ; _ + "l" => "sha" ; _ {- b,f,g,n,r,s -} => "ta" } ; - mKa => case stem of { -- Saeed p. 28-29 _ + ("r"|"g"|"w"|"y"|"i"|"u"|"aa"|"oo"|"uu") => "ga" ; _ + ("q"|"'"|"kh"|"x"|"c"|"h") => "a" ; _ + ("e"|"o") => "ha" ; _ {- b,d,dh,f,j,l,n,r,sh-} => "ka" } - - {-- TODO check if needed/implement elsewhere: - mKii => case stem of { - _+ #vv + #c => init (allomorph mKa stem) ++ "ii" ; -- Should not change stem vowel - _ + ("'"|"x"|"c") => "ii" ; -- Should change stem vowel - _ => init (allomorph mKa stem) ++ "ii" } ; - mTii => init (allomorph mTa stem) ++ "ii" -} } ; - -------------------------------------------------------------------------------- -- Nouns @@ -82,48 +117,32 @@ param State = Definite | Indefinite ; - NForm = - Indef Number - | 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 ; + NForm = Def Number | Indef Number | NomSg | Numerative ; oper - getAgr : NForm -> Gender -> Agreement = \n,g -> - case n of { Indef Pl|Def Pl _ => Pl3 ; - _ => Sg3 g } ; + getAgr : Number -> Gender -> Agreement = \n,g -> + case n of { Pl => Pl3 ; + _ => Sg3 g } ; + 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} ; - 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)) ; + -- gn2gennum : Gender -> Number -> GenNum = \g,n -> + -- case of { + -- => SgMasc ; + -- => SgFem ; + -- _ => PlInv } ; + gender : {sg : DefArticle} -> Gender = \n -> + case n.sg of {M _ => Masc ; F _ => Fem} ; -------------------------------------------------------------------------------- -- 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 ; + DForm = Hal | Mid | Kow ; -- three variants of number 1 CardOrd = NOrd | NCard ; diff --git a/src/somali/PhraseSom.gf b/src/somali/PhraseSom.gf index 33fdced8..f05afbe7 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 = {s = n.s ! Indefinite} ; + UttCard n = {s = n.s ! Mid} ; UttAP ap = { s = ap.s ! AF Sg Abs } ; UttInterj i = i ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 6604b168..d97e5e01 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -4,49 +4,54 @@ resource ResSom = ParamSom ** open Prelude, Predef, ParamSom in { -- Nouns oper - Noun : Type = {s : NForm => Str; g : Gender ; shortPoss : Bool} ; + Noun : Type = { + s : NForm => Str ; + sg, + pl : DefArticle ; + shortPoss : Bool ; + } ; Noun2 : Type = Noun ; -- TODO eventually more parameters? Noun3 : Type = Noun ; 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". + isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father" } ; PNoun : Type = {s : Str ; a : Agreement} ; mkPNoun : Str -> Agreement -> PNoun = \str,agr -> {s = str ; a = agr} ; - mkNoun : (x1,_,_,x4 : Str) -> Gender -> Noun = \wiil,wiilka,wiilal,wiilasha,gender -> - let bisadi = case gender of + mkNoun : (x1,_,_,x4 : Str) -> Gender -> Noun = \wiil,wiilka,wiilal,wiilasha,gender -> { + s = table { + Def Sg => hooya ; Def Pl => gury ; + Indef Sg => wiil ; Indef Pl => wiilal ; + -- Special forms for feminine nouns + NomSg => bisadi ; Numerative => bisadood + } ; + sg = defAllomorph wiilka ; + pl = defAllomorph wiilasha ; + shortPoss = False + } where { + hooya : Str = case wiilka of { + aabb + "aha" => aabb ; + hooya + "da" => hooya ; + wiila + "sha" => wiila ; + _ => wiil} ; + gury : Str = case wiilasha of { + gury + "aha" => gury ; + magacya + "da" => magacya ; + wiila + "sha" => wiila ; + _ => wiilal} ; + bisadi : Str = case gender of { Fem => case wiil of { _ + #c => wiil+"i" ; _ => wiil} ; Masc => wiil } ; - bisadood = case gender of + bisadood : Str = 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" ; - vI => ilk+"ih" ; - vO => ilk+"oh" ; - vU => ilk+"uh" ; - _ => ilk+"ah" - } ; - _ => table { _ => init s } - } ; - - in { s = table { - Indef Sg => wiil ; - Indef Pl => wiilal ; - Def Sg vow => defStems wiilka ! vow ; - Def Pl vow => defStems wiilasha ! vow ; - NomSg => bisadi ; -- Special form for fem. nouns ending in consonant - Numerative => case bisadood of {_+"ood" => bisadood ; _ => wiil} - } ; - g = gender ; - shortPoss = False} ; + Masc => wiil } + } ; ------------------------- -- Regular noun paradigms nHooyo, nAabbe, nMas, nUl, nGuri, nXayawaan : Str -> Noun ; @@ -62,10 +67,15 @@ oper -- 3) Masculine, plural with duplication nMas mas = let s = last mas ; a = last (init mas) ; - ka = allomorph mKa mas ; - ta = allomorph mTa mas ; - sha = case ta of {"sha" => ta ; _ => s + ta } in - mkNoun mas (mas + ka) (mas + a + s) (mas + a + sha) Masc ; + ka = allomorph mKa mas in + mkNoun mas (mas + ka) (mas + a + s) (mas + a + s + ka) Masc ; + + -- Irregular one-syllable masculine word + nWiil : (_,_ : Str) -> Noun = \wiil,wiilal -> + let ka = allomorph mKa wiil ; + sha = allomorph mTa wiilal ; + wiila : Str = case wiilal of {wiila + "l" => wiila ; _ => wiilal} in + mkNoun wiil (wiil + ka) wiilal (wiila + sha) Masc ; -- 4a) Feminine, plural with ó nUl ul = let o = case last ul of { "i" => "yo" ; _ => "o" } ; @@ -94,10 +104,7 @@ oper in mkNoun maalin (maalin + ta) maalmo (init maalmo + aha) g ; ------------------------- --- Smart paradigm --- Substantiv som slutar på –o/–ad är så gott som alltid feminina, t.ex. qaáddo sked, bisád katt. --- Substantiv som slutar på –e är så gott som alltid maskulina, t.ex. dúbbe hammare, fúre nyckel. --- För övriga ord säger ordets form dessvärre väldigt lite om ordets genus. Däremot kan betoningens plats i ordet väldigt ofta avslöja ordets genus. Man kan alltså i flesta fall höra vilket genus ett substantiv har. +-- Smart paradigms mkN1 : Str -> Noun = \n -> case n of { _ + ("ad"|"adh") => nUl n ; @@ -110,6 +117,8 @@ oper | (#v + #c) => nMas n ; _ => nXayawaan n } ; + mk2N : Str -> Str -> Noun = nWiil ; + mkNg : Str -> Gender -> Noun = \n,g -> case n of { _ -- + ("r"|"n"|"l"|"g") => case g of { @@ -130,7 +139,7 @@ oper useN : Noun -> CNoun ** BaseNP = \n -> n ** { mod = \\_,_ => [] ; hasMod = False ; - a = Sg3 n.g ; isPron,isPoss = False ; + a = Sg3 (gender n) ; isPron,isPoss = False ; } ; emptyNP : NounPhrase = { @@ -149,9 +158,10 @@ oper Pronoun : Type = NounPhrase ** { poss : { -- for PossPron : Pron -> Quant + s : DefArticle => Str ; 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} ; + short : DefArticle => Str -- short possessive suffix: e.g. family members, my/your name + } ; sp : Str ; } ; @@ -159,47 +169,47 @@ oper Sg1 => { s = table {Nom => "aan" ; Abs => "i"} ; a = Sg1 ; isPron = True ; sp = "aniga" ; - poss = {s = "ay" ; v = vA ; sp = gnTable "ayg" "ayd" "uwayg"} + poss = {s = quantTable "ayg" "ayd" ; short = quantTable "ay" ; sp = gnTable "ayg" "ayd" "uwayg"} } ; Sg2 => { s = table {Nom => "aad" ; Abs => "ku"} ; a = Sg2 ; isPron = True ; sp ="adiga" ; - poss = {s = "aa" ; v = vA ; sp = gnTable "aag" "aad" "uwaag"} + poss = {s = quantTable "aag" "aad" ; short = quantTable "aa" ; sp = gnTable "aag" "aad" "uwaag"} } ; Sg3 Masc => { s = table {Nom => "uu" ; Abs => []} ; a = Sg3 Masc ; isPron = True ; sp ="isaga" ; - poss = {s = "iis" ; v = vI ; sp = gnTable "iis" "iis" "uwiis"} + poss = {s, short = quantTable "iis" ; sp = gnTable "iis" "iis" "uwiis"} } ; Sg3 Fem => { s = table {Nom => "ay" ; Abs => []} ; a = Sg3 Fem ; isPron = True ; sp = "iyada" ; - poss = {s = "eed" ; v = vE ; sp = gnTable "eed" "eed" "uweed"} + poss = {s, short = quantTable "eed" ; sp = gnTable "eed" "eed" "uweed"} } ; Pl1 Excl => { s = table {Nom => "aan" ; Abs => "na"} ; a = Pl1 Incl ; isPron = True ; sp ="annaga" ; - poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} + poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"} } ; Pl1 Incl => { s = table {Nom => "aynu" ; Abs => "ina"} ; a = Pl1 Incl ; isPron = True ; sp ="innaga" ; - poss = {s = "een" ; v = vE ; sp = gnTable "eenn" "eenn" "uweenn"} + poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"} } ; Pl2 => { s = table {Nom => "aad" ; Abs => "idin"} ; a = Pl2 ; isPron = True ; sp ="idinka" ; - poss = {s = "iin" ; v = vI ; sp = gnTable "iinn" "iinn" "uwiinn"} + poss = {s = quantTable "iinn" ; short = quantTable "iin" ; sp = gnTable "iinn" "iinn" "uwiinn"} } ; Pl3 => { s = table {Nom => "ay" ; Abs => []} ; a = Pl3 ; isPron = True ; sp = "iyaga" ; - poss = {s = "ood" ; v = vO ; sp = gnTable "ood" "ood" "uwood"} + poss = {s, short = quantTable "ood" ; sp = gnTable "ood" "ood" "uwood"} } ; Impers => { s = table {Nom => "la" ; Abs => "??"} ; a = Impers ; isPron = True ; sp = "??" ; - poss = {s = "??" ; v = vA ; sp = gnTable "??" "??" "??"} + poss = {s, short = quantTable "??" ; sp = gnTable "??" "??" "??"} } } ; @@ -218,33 +228,50 @@ oper -- Det, Quant, Card, Ord BaseQuant : Type = { + s : DefArticle => Case => Str ; isPoss : Bool ; - shortPoss : Str ; -- short form of possessive, e.g. family members + shortPoss : DefArticle => Str ; -- short form of possessive, e.g. family members + st : State ; } ; Determiner : Type = BaseQuant ** { - s, sp : Gender => Case => Str ; - d : NForm ; -- combination of number, state and vowel --- isNum : Bool ; -- placement in NP + whether to choose Numerative from CN + n : Number ; + 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 : State => Str ; -- TODO check if enough - n : Number ; -- singular or plural + BaseNum : Type = { + s : DForm => Str ; -- independent or attribute + thousand : Str ; -- TODO check where possessive suffix goes + da : DefArticle ; + n : Number + } ; + + baseNum : Num = { + s = \\_ => [] ; + thousand = [] ; + da = M KA ; + n = Sg ; + isNum = False + } ; + + Num : Type = BaseNum ** { isNum : Bool -- whether to choose Numerative as the value of NForm } ; + Numeral : Type = BaseNum ** { + ord : Str -- whether to choose Numerative as the value of NForm + } ; + baseQuant : BaseQuant = { + s = \\alm,c => [] ; isPoss = False ; - shortPoss = [] + shortPoss = \\_ => [] ; + st = Indefinite } ; defQuant = defQuantBind True ; @@ -252,24 +279,25 @@ 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 = \\gn,c => - let nom = case v of {NA => "u" ; _ => s + "i"} - in case c of {Nom => bind nom ; _ => bind s} ; + s = \\allomorph,c => + let nom = case v of {NA => "u" ; _ => s + "i"} + in case c of { + Nom => bind (quantTable nom ! allomorph) ; + _ => bind (quantTable s ! allomorph) } ; sp = \\gn,c => let i = case c of {Nom => "i"; _ => []} in gnTable (spm + i) (spf + i) (spp + i) ! gn ; st = Definite ; - v = v ; } ; gnTable : (m,f,p : Str) -> (GenNum => Str) = \m,f,p -> table {SgMasc => m ; SgFem => f ; _ => p} ; indefQuant : Quant = baseQuant ** { - s, + s = \\da,c => [] ; sp = \\gn,c => [] ; st = Indefinite ; - v = NA ; -- Will be ignored in DetQuant +-- v = NA ; -- Will be ignored in DetQuant } ; -------------------------------------------------------------------------------- @@ -609,6 +637,11 @@ oper c2 = v2.c2 } ; + passV2 : Verb2 -> VerbPhrase = \v2 -> useV v2 ** { + c2 = passive ; + c3 = v2.c2 ; + } ; + complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** { comp = \\agr => case np.a of { @@ -617,11 +650,6 @@ oper -- 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 } } ; @@ -630,10 +658,10 @@ oper in prepCombTable ! agr ! combine vp.c2 vp.c3 ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> - let noun = case of { - => np.s ! Abs ; - => (pronTable ! np.a).sp ; -- long object pronoun for 3rd person object - _ => [] } -- no long object for other pronouns + let noun : Str = 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 = { @@ -658,11 +686,6 @@ oper } ; - passV2 : Verb2 -> VerbPhrase = \v2 -> useVc v2 ** { - 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