diff --git a/src/bantu/CatBantu.gf b/src/bantu/CatBantu.gf index 9f014c394..3fb29faf9 100644 --- a/src/bantu/CatBantu.gf +++ b/src/bantu/CatBantu.gf @@ -14,27 +14,24 @@ incomplete concrete CatBantu of Cat = -- Sentence - Cl = {s : Tense => Anteriority => Bool => Str} ; - -- ClSlash = { - -- s : ResKam.Tense => Anteriority => Bool => Str ; --- } ; + Cl = {s : Tense => Anteriority => Polarity => Str} ; + ClSlash = {s : Tense => Anteriority => Polarity => Str ; c2 : Str} ; + Imp = {s : Polarity => Number => Str} ; -- -- Question - -- QCl = {s : ResKam.Tense => Anteriority => Polarity => QForm => Str} ; + QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; IP = {s : NPCase => Str ; n : Number} ; IComp = {s : Str} ; IDet = {s : Str ; n : Number} ; IQuant = {s : Number => Str} ; -- Relative -{-} RCl = { - s : ResKam.Tense => Anteriority => Polarity => Agr => Str ; + s : Tense => Anteriority => Polarity => Agr => Str ; c : NPCase } ; - RP = {s : RCase => Str ; a : RAgr} ; --} + RP = {s : Agr => Str} ; -- Verb VP = ResBantu.VP ; @@ -43,6 +40,7 @@ incomplete concrete CatBantu of Cat = -- Adjective AP = {s : Gender => Number => Str }; + ACard = {s : Str} ; -- Noun @@ -72,7 +70,7 @@ incomplete concrete CatBantu of Cat = Prep = {s: Number => Gender => Str} ; -- Open lexical classes, e.g. Lexicon - V, VS, VQ, VA, V3,V2,VV, V2S, V2Q, V2V,V2A= Verb ; + V, VS, VQ, VA, V3,V2,VV, V2S, V2Q, V2V,V2A= Verb ; -- V2, VV, V2S, V2Q = Verb ** {c2 : Str} ; -- V3, V2V,V2A = Verb ** {c2, c3 : Prep} ; A = {s : AForm => Str } ; diff --git a/src/bantu/DiffBantu.gf b/src/bantu/DiffBantu.gf index 687503917..ad8ad0e00 100644 --- a/src/bantu/DiffBantu.gf +++ b/src/bantu/DiffBantu.gf @@ -12,7 +12,7 @@ oper Noun : Type = {s : Number => Case => Str ; g : Gender}; CNoun : Type = {s : Number => Case => Str ; g : Gender; s2 : Number => Str}; - AAgr : Type = {g : Gender ; n : Number} ; + AAgr : PType = {g : Gender ; n : Number} ; param Agr = Ag Gender Number Person ; diff --git a/src/bantu/NounBantu.gf b/src/bantu/NounBantu.gf index 8da208d67..f540e2cc5 100644 --- a/src/bantu/NounBantu.gf +++ b/src/bantu/NounBantu.gf @@ -34,7 +34,10 @@ lin PredetNP pred np = let agr = predetAgr np.a in { s = \\c => np.s ! NCase Nom ++ pred.s ! agr.g ; - a =Ag agr.g Pl P3 ; + -- A predeterminer does not change the number or person of its NP. + -- Forcing plural here made e.g. "only an automaton" control plural + -- verbal agreement in Swahili. + a = np.a ; } ; {-} PPartNP np v2 = { @@ -103,14 +106,12 @@ lin Use2N3 f = { s = \\n,c => f.s ! n ! Nom ; - s2 = \\_ => [] ; g = f.g ; c2 = f.c2 } ; Use3N3 f = { s = \\n,c => f.s ! n ! Nom ; - s2 = \\_ => [] ; g = f.g ; c2 = f.c3 } ; diff --git a/src/bantu/ResBantu.gf b/src/bantu/ResBantu.gf index d8e646c5b..087d9cc1f 100644 --- a/src/bantu/ResBantu.gf +++ b/src/bantu/ResBantu.gf @@ -39,35 +39,62 @@ oper } ; a = Ag g n p } ; - Verb : Type = {s : Bool => VForm => Str} ; - VerbForms : Type = Tense => Anteriority => Bool => Agre => Str; - VP : Type = {s:VerbForms ; obj : Agr => Str}; + Verb : Type = {s, passive : Polarity => VForm => Str} ; + VerbForms : Type = Tense => Anteriority => Polarity => Agre => Str; + VP : Type = { + s, passive : VerbForms ; + obj : Agre => Str ; + inf : Polarity => Agre => Str ; + passiveInf : Polarity => Agre => Str ; + imp : Polarity => Number => Str ; + passiveImp : Polarity => Number => Str + }; SlashVP = VP ** {c2 : Str} ; predV : Verb -> VP = \verb -> { s = \\t,ant,b,agre => - let - inf = verb.s !b! VInf ; - pres = verb.s !True! VPres agre.g agre.n agre.p ; - presn = verb.s !False! VPres agre.g agre.n agre.p ; - past = verb.s !True! VPast agre.g agre.n agre.p ; - pastn = verb.s !False! VPast agre.g agre.n agre.p ; - fut = verb.s !True! VFut agre.g agre.n agre.p ; - futn = verb.s !False! VFut agre.g agre.n agre.p ; - in - case of { - => pres ; - => fut ; --# notpresent - => past ; --# notpresent - => presn ; - => futn ; --# notpresent - => pastn - -- ; <_, _, _> => inf --# notpresent -- never reached + case t of { + Pres => verb.s ! b ! VPres agre.g agre.n agre.p ; + Fut => verb.s ! b ! VFut agre.g agre.n agre.p ; --# notpresent + Pas => verb.s ! b ! VPast agre.g agre.n agre.p } ; - obj = \\_ => [] }; + passive = \\t,ant,b,agre => + case t of { + Pres => verb.passive ! b ! VPres agre.g agre.n agre.p ; + Fut => verb.passive ! b ! VFut agre.g agre.n agre.p ; + Pas => verb.passive ! b ! VPast agre.g agre.n agre.p + } ; + obj = \\_ => [] ; + inf = \\b,_ => verb.s ! b ! VInf ; + passiveInf = \\b,_ => verb.passive ! b ! VInf ; + imp = \\b,n => verb.s ! b ! VImp n ; + passiveImp = \\b,n => verb.passive ! b ! VImp n + }; + + insertObj : (Agre => Str) -> VP -> VP = \x,vp -> vp ** { + obj = \\a => vp.obj ! a ++ x ! a + } ; + + insertAdV : Str -> VP -> VP = \x,vp -> vp ** { + s = \\t,ant,b,a => x ++ vp.s ! t ! ant ! b ! a ; + passive = \\t,ant,b,a => x ++ vp.passive ! t ! ant ! b ! a + } ; + + -- Productive Swahili passives are formed by replacing the final -a by + -- -wa (and by adding -wa to loan verbs ending in another vowel). Keeping + -- this operation on VP also preserves complements and adjuncts already + -- accumulated in obj. + passiveVP : VP -> VP = \vp -> vp ** { + s = vp.passive ; + inf = vp.passiveInf ; + imp = vp.passiveImp + } ; + + infVP : Polarity -> Agre -> VP -> Str = \b,a,vp -> + vp.inf ! b ! a ++ vp.obj ! a ; Clause : Type = { - s : Tense => Anteriority => Bool => Str + s : Tense => Anteriority => Polarity => Str } ; mkClause : Str -> Agre -> VP -> Clause = @@ -76,7 +103,7 @@ oper let verb = vp.s ! t ! a ! b ! agr in - subj ++ verb + subj ++ verb ++ vp.obj ! agr } ; finalComma : Str = pre {"," | "." => []; "" => SOFT_BIND ++ ","; _ => []} ; diff --git a/src/bantu/SentenceBantu.gf b/src/bantu/SentenceBantu.gf index ec4e190f7..7e9bef91c 100644 --- a/src/bantu/SentenceBantu.gf +++ b/src/bantu/SentenceBantu.gf @@ -40,9 +40,8 @@ incomplete concrete SentenceBantu of Sentence = EmbedQS qs = {s = qs.s ! QIndir} ; EmbedVP vp = {s = infVP VVInf vp Simul CPos (agrP3 Sg)} ; --- agr -} - UseCl t p cl = - let b : Bool = case p.p of {Pos => True ; _ => False} - in {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! b} ; + UseCl t p cl = + {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; {- UseQCl t p cl = { s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! q diff --git a/src/egekusii/CatGus.gf b/src/egekusii/CatGus.gf index 3ec568dd0..a3dfded2d 100644 --- a/src/egekusii/CatGus.gf +++ b/src/egekusii/CatGus.gf @@ -1,2 +1,2 @@ -concrete CatGus of Cat = CommonX - [Pol] +concrete CatGus of Cat = CommonX ** CatBantu with (ResBantu = ResGus); diff --git a/src/egekusii/DiffGus.gf b/src/egekusii/DiffGus.gf index a307aebe9..c54257a06 100644 --- a/src/egekusii/DiffGus.gf +++ b/src/egekusii/DiffGus.gf @@ -232,7 +232,7 @@ ProunPlprefix : Gender -> Str = \g -> param - VForm = VInf + VForm = VInf | VImp Number | VPres Gender Number Person | VPast Gender Number Person | VFut Gender Number Person diff --git a/src/egekusii/LangGus.gf b/src/egekusii/LangGus.gf index abf594085..212b6a610 100644 --- a/src/egekusii/LangGus.gf +++ b/src/egekusii/LangGus.gf @@ -1,4 +1,4 @@ ---# -path=.:../abstract:../common:../api +--# -path=.:../abstract:../common:../bantu concrete LangGus of Lang = GrammarGus, diff --git a/src/egekusii/MorphoGus.gf b/src/egekusii/MorphoGus.gf index 1f3063a5f..b0bbdf08b 100644 --- a/src/egekusii/MorphoGus.gf +++ b/src/egekusii/MorphoGus.gf @@ -297,27 +297,27 @@ iregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { AAdj g Pl => seoo} }; regV : Str -> Verb = - \vika -> { - s = table{ True => table{ + \vika -> let forms = table{ Pos => table{ VInf => vika; + VImp _ => vika; VPres g n p => Verbprefix g n p + vika; VPast g n p => Verbprefix g n p + init vika + "ie" ; VFut g n p => Verbfutureprefix g n p + vika } ; - False =>table { + Neg =>table { VInf => "ndi" + vika; - VPres g n p => neg (Ag g n p) False Pres + "na" + vika ; - VPast g n p => neg (Ag g n p) False Past + "ne" + vika ; - VFut g n p => neg (Ag g n p) False Fut + "ka" + vika + VImp _ => "ndi" + vika; + VPres g n p => neg (Ag g n p) Neg Pres + "na" + vika ; + VPast g n p => neg (Ag g n p) Neg Past + "ne" + vika ; + VFut g n p => neg (Ag g n p) Neg Fut + "ka" + vika } - }; - }; + } in {s = forms ; passive = forms}; - neg : Agr -> Bool ->Tense -> Str = \a,b,t -> let + neg : Agr -> Polarity ->Tense -> Str = \a,b,t -> let g = getGender a; n=getNumber a; p=getPerson a - in case b of {True => [] ; False => negprefix g n t p} ; + in case b of {Pos => [] ; Neg => negprefix g n t p} ; negprefix : Gender -> Number -> Tense -> Person -> Str =\g,n,t,p-> case of { => "ndi"; diff --git a/src/egekusii/NumeralGus.gf b/src/egekusii/NumeralGus.gf index 0fec94442..50aa1df37 100644 --- a/src/egekusii/NumeralGus.gf +++ b/src/egekusii/NumeralGus.gf @@ -1,4 +1,4 @@ -concrete NumeralGus of Numeral = CatGus [Numeral,Digits] ** open Prelude, +concrete NumeralGus of Numeral = CatGus [Numeral,Digits,Decimal] ** open Prelude, DiffGus,MorphoGus in { lincat @@ -74,7 +74,7 @@ lin pot3plus n m = { s = table { PosDecimal d = d ** {hasDot=False} ; NegDecimal d = { s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; - n = Pl + n = Pl ; hasDot=False } ; IFrac d i = { diff --git a/src/egekusii/ParadigmsGus.gf b/src/egekusii/ParadigmsGus.gf index d3fc779a0..9574b9339 100644 --- a/src/egekusii/ParadigmsGus.gf +++ b/src/egekusii/ParadigmsGus.gf @@ -9,8 +9,8 @@ resource ParadigmsGus = open in { oper - Gender : Type ; - omo_aba : Gender ;--% + Gender : PType ; + omo_aba : Gender ;--% omo_eme : Gender ; e_ci : Gender ; eri_ama : Gender ; @@ -23,7 +23,7 @@ oper -- To abstract over number names, we define the following. - Number : Type ; + Number : PType ; singular : Number ; plural : Number ; @@ -396,7 +396,10 @@ mkN2 = overload { }; - prefixV : Str -> V -> V = \p,v -> lin V { s = \\b,vform => p + v.s! b ! vform } ; + prefixV : Str -> V -> V = \p,v -> lin V { + s = \\b,vform => p + v.s ! b ! vform ; + passive = \\b,vform => p + v.passive ! b ! vform + } ; mkV2 = overload { mkV2 : V -> V2 = dirV2 ; mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; diff --git a/src/kikamba/CatKam.gf b/src/kikamba/CatKam.gf index 4d51ce951..2e96519e5 100644 --- a/src/kikamba/CatKam.gf +++ b/src/kikamba/CatKam.gf @@ -1,2 +1,2 @@ -concrete CatKam of Cat = CommonX - [Pol] +concrete CatKam of Cat = CommonX ** CatBantu with (ResBantu = ResKam); diff --git a/src/kikamba/DiffKam.gf b/src/kikamba/DiffKam.gf index 3d53b88f8..afd1bb26b 100644 --- a/src/kikamba/DiffKam.gf +++ b/src/kikamba/DiffKam.gf @@ -186,7 +186,7 @@ oper superVery ="vyu"; param - VForm = VInf + VForm = VInf | VImp Number | VPres Gender Number Person | VPast Gender Number Person | VFut Gender Number Person diff --git a/src/kikamba/LangKam.gf b/src/kikamba/LangKam.gf index 29a393291..abd57c118 100644 --- a/src/kikamba/LangKam.gf +++ b/src/kikamba/LangKam.gf @@ -1,4 +1,4 @@ ---# -path=.:../abstract:../common:../api +--# -path=.:../abstract:../common:../bantu concrete LangKam of Lang = GrammarKam, diff --git a/src/kikamba/MorphoKam.gf b/src/kikamba/MorphoKam.gf index e68bc9cb0..6971206f0 100644 --- a/src/kikamba/MorphoKam.gf +++ b/src/kikamba/MorphoKam.gf @@ -336,27 +336,27 @@ iregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { AComp g n => ""} } ; regV : Str -> Verb = - \vika -> { - s = table{ True => table{ + \vika -> let forms = table{ Pos => table{ VInf => vika; + VImp _ => vika; VPres g n p => Verbprefix g n p + vika; VPast g n p => Verbprefix g n p + init vika + "ie" ; VFut g n p => Verbfutureprefix g n p + vika } ; - False =>table { + Neg =>table { VInf => "ndi" + vika; - VPres g n p => neg (Ag g n p) False Pres + "na" + vika ; - VPast g n p => neg (Ag g n p) False Past + "ne" + vika ; - VFut g n p => neg (Ag g n p) False Fut + "ka" + vika + VImp _ => "ndi" + vika; + VPres g n p => neg (Ag g n p) Neg Pres + "na" + vika ; + VPast g n p => neg (Ag g n p) Neg Past + "ne" + vika ; + VFut g n p => neg (Ag g n p) Neg Fut + "ka" + vika } - }; - }; + } in {s = forms ; passive = forms}; - neg : Agr -> Bool ->Tense -> Str = \a,b,t -> let + neg : Agr -> Polarity ->Tense -> Str = \a,b,t -> let g = getGender a; n=getNumber a; p=getPerson a - in case b of {True => [] ; False => negprefix g n t p} ; + in case b of {Pos => [] ; Neg => negprefix g n t p} ; negprefix : Gender -> Number -> Tense -> Person -> Str =\g,n,t,p-> case of { => "ndi"; diff --git a/src/kikamba/NumeralKam.gf b/src/kikamba/NumeralKam.gf index 030cb1a32..0c4fec8b4 100644 --- a/src/kikamba/NumeralKam.gf +++ b/src/kikamba/NumeralKam.gf @@ -1,4 +1,4 @@ -concrete NumeralKam of Numeral = CatKam [Numeral,Digits] ** open Prelude,CommonBantu,DiffKam, MorphoKam in { +concrete NumeralKam of Numeral = CatKam [Numeral,Digits,Decimal] ** open Prelude,CommonBantu,DiffKam, MorphoKam in { lincat Digit = {s : DForm => CardOrd => Gender => Str} ; diff --git a/src/kikamba/ParadigmsKam.gf b/src/kikamba/ParadigmsKam.gf index a47bb8e07..66e1171e1 100644 --- a/src/kikamba/ParadigmsKam.gf +++ b/src/kikamba/ParadigmsKam.gf @@ -9,7 +9,7 @@ resource ParadigmsKam = open in { oper - Gender : Type ; + Gender : PType ; mu_a : Gender ; mu_mi : Gender ; i_ma : Gender ; @@ -21,7 +21,7 @@ oper u_n : Gender ; ku_ma : Gender ; - Number : Type ; + Number : PType ; singular : Number ; plural : Number ; @@ -383,7 +383,10 @@ mkN2 = overload { }; - prefixV : Str -> V -> V = \p,v -> lin V { s = \\b,vform => p + v.s! b ! vform } ; + prefixV : Str -> V -> V = \p,v -> lin V { + s = \\b,vform => p + v.s ! b ! vform ; + passive = \\b,vform => p + v.passive ! b ! vform + } ; mkV2 = overload { mkV2 : V -> V2 = dirV2 ; mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; diff --git a/src/swahili/AdverbSwa.gf b/src/swahili/AdverbSwa.gf index c8eca3249..63dac06e5 100644 --- a/src/swahili/AdverbSwa.gf +++ b/src/swahili/AdverbSwa.gf @@ -1,8 +1,10 @@ -concrete AdverbSwa of Adverb = CatSwa **AdverbBantu -[ComparAdvAdj,ComparAdvAdjS] with +concrete AdverbSwa of Adverb = CatSwa **AdverbBantu -[ComparAdvAdj,ComparAdvAdjS,PrepNP] with (ResBantu = ResSwa)** open DiffSwa in { flags coding=utf8; lin + PrepNP prep np = let agr = complAgr np.a in + {s = prep.s ! agr.n ! agr.g ++ np.s ! NCase Nom} ; ComparAdvAdj cadv a np =let agr = complAgr np.a in { s = cadv.s ++ a.s !AAdj agr.g agr.n ++ cadv.p ++ np.s ! npNom diff --git a/src/swahili/AllSwa.gf b/src/swahili/AllSwa.gf index 4519de75f..b23189c8a 100644 --- a/src/swahili/AllSwa.gf +++ b/src/swahili/AllSwa.gf @@ -2,4 +2,5 @@ concrete AllSwa of AllSwaAbs = LangSwa + ,ExtendSwa ** {} ; diff --git a/src/swahili/ConstructionSwa.gf b/src/swahili/ConstructionSwa.gf new file mode 100644 index 000000000..5dfc85767 --- /dev/null +++ b/src/swahili/ConstructionSwa.gf @@ -0,0 +1,57 @@ +concrete ConstructionSwa of Construction = CatSwa ** + open Prelude, ResSwa, ParadigmsSwa, GrammarSwa in { + + flags coding=utf8 ; + + lincat Timeunit, Hour, Weekday, Month, Monthday, Year = {s : Str} ; + + lin + ready_VP = UseComp (CompAP (PositA (mkA "tayari"))) ; + has_age_VP card = UseComp (CompAdv (mkAdv ("mwenye umri wa" ++ card.s ! G1))) ; + n_units_AP card cn a = {s = \\g,n => card.s ! g ++ cn.s ! Pl ! Nom ++ a.s ! AAdj g n} ; + n_units_of_NP card cn np = { + s = \\c => card.s ! G5 ++ cn.s ! Pl ! Nom ++ "za" ++ np.s ! c ; + a = Ag cn.g Pl P3 + } ; + cup_of_CN np = { + s = \\n,c => case n of {Sg => "kikombe" ; Pl => "vikombe"} ++ + case n of {Sg => "cha" ; Pl => "vya"} ++ np.s ! NPAcc ; + s2 = \\_ => [] ; g = G4 + } ; + + weekdayN d = {s = \\_,_ => d.s ; g = G5} ; + monthN m = {s = \\_,_ => m.s ; g = G5} ; + weekdayPN d = {s = \\_ => d.s ; g = G5} ; + monthPN m = {s = \\_ => m.s ; g = G5} ; + weekdayPunctualAdv d = mkAdv d.s ; + weekdayHabitualAdv d = mkAdv ("kila" ++ d.s) ; + weekdayLastAdv d = mkAdv (d.s ++ "iliyopita") ; + weekdayNextAdv d = mkAdv (d.s ++ "ijayo") ; + monthAdv m = mkAdv ("mwezi wa" ++ m.s) ; + yearAdv y = mkAdv ("mwaka" ++ y.s) ; + intYear i = {s = i.s} ; + intMonthday i = {s = i.s} ; + dayMonthAdv d m = mkAdv (d.s ++ m.s) ; + monthYearAdv m y = mkAdv (m.s ++ y.s) ; + dayMonthYearAdv d m y = mkAdv (d.s ++ m.s ++ y.s) ; + + monday_Weekday = {s = "Jumatatu"} ; + tuesday_Weekday = {s = "Jumanne"} ; + wednesday_Weekday = {s = "Jumatano"} ; + thursday_Weekday = {s = "Alhamisi"} ; + friday_Weekday = {s = "Ijumaa"} ; + saturday_Weekday = {s = "Jumamosi"} ; + sunday_Weekday = {s = "Jumapili"} ; + january_Month = {s = "Januari"} ; + february_Month = {s = "Februari"} ; + march_Month = {s = "Machi"} ; + april_Month = {s = "Aprili"} ; + may_Month = {s = "Mei"} ; + june_Month = {s = "Juni"} ; + july_Month = {s = "Julai"} ; + august_Month = {s = "Agosti"} ; + september_Month = {s = "Septemba"} ; + october_Month = {s = "Oktoba"} ; + november_Month = {s = "Novemba"} ; + december_Month = {s = "Desemba"} ; +} diff --git a/src/swahili/DiffSwa.gf b/src/swahili/DiffSwa.gf index 7a4f05cf8..f9b1809bd 100644 --- a/src/swahili/DiffSwa.gf +++ b/src/swahili/DiffSwa.gf @@ -8,8 +8,19 @@ oper conjThan = "kuliko" ; conjThat = "kuvita" ; - conjGender : Gender -> Gender -> Gender = \m,n -> - case m of { G1 => n ; _ => G2 } ; + conjGender : Gender -> Gender -> Gender = \m,n -> + case of { + -- Coordinated people retain a-/wa- agreement. Equal noun classes + -- retain their own concord; heterogeneous non-human conjuncts use the + -- conventional ki-/vi- default instead of the old, unrelated m-/mi- + -- agreement. + => G1 ; + => G2 ; => G3 ; => G4 ; + => G5 ; => G6 ; => G7 ; + => G8 ; => G9 ; => G10 ; + => G11 ; => G12 ; => G13 ; + <_,_> => G4 + } ; reflPron :Agr => Str = \\ag=> case of { < Ag G1 Sg P1 > => "mimi" ; < Ag G1 Sg P2 > => "wewe" ; @@ -223,7 +234,7 @@ Cardtwoprefix : Gender -> Str = \g -> param - VForm = VInf + VForm = VInf | VImp Number | VPres Gender Number Person | VPast Gender Number Person | VFut Gender Number Person diff --git a/src/swahili/DocumentationSwa.gf b/src/swahili/DocumentationSwa.gf index a0ffc748b..7cc4aec8a 100755 --- a/src/swahili/DocumentationSwa.gf +++ b/src/swahili/DocumentationSwa.gf @@ -9,28 +9,64 @@ lincat Document = {s : Str} ; Tag = {s : Str} ; -lin InflectionN,InflectionN2,InflectionN3 = \x -> { - t="n" ; - s1=heading1 ("Noun (class" ++ - case x.g of { - G1 => "I" ; - G2 => "II" ; - G3 => "III" ; - G4 => "IV" ; - G5 => "V" ; - G6 => "VI" ; - G7 => "VII" ; - G8 => "VIII" ; - G9 => "IX" ; - G10=> "X" ; - G11=> "XI" ; - G12=> "XII" ; - G13=> "XIII" - } ++ BIND ++ ")") ; - s2=frameTable ( - tr (th "" ++ th "Sg" ++ th "Pl") ++ - tr (th "Nom" ++ td (x.s ! Sg ! Nom) ++ td (x.s ! Pl ! Nom)) ++ - tr (th "Loc" ++ td (x.s ! Sg ! Loc) ++ td (x.s ! Pl ! Loc))) +lin + InflectionN, InflectionN2, InflectionN3 = \noun -> { + t = "n" ; + s1 = heading1 ("Noun (class" ++ className noun.g ++ BIND ++ ")") ; + s2 = frameTable ( + tr (th "" ++ th "Sg" ++ th "Pl") ++ + tr (th "Nom" ++ td (noun.s ! Sg ! Nom) ++ td (noun.s ! Pl ! Nom)) ++ + tr (th "Loc" ++ td (noun.s ! Sg ! Loc) ++ td (noun.s ! Pl ! Loc)) + ) + } ; + + InflectionPN, InflectionLN, InflectionGN, InflectionSN = \name -> { + t = "pn" ; + s1 = heading1 ("Name (class" ++ className name.g ++ BIND ++ ")") ; + s2 = frameTable ( + tr (th "Nom" ++ td (name.s ! Nom)) ++ + tr (th "Loc" ++ td (name.s ! Loc)) + ) + } ; + + InflectionA, InflectionA2 = \adj -> { + t = "a" ; + s1 = heading1 "Adjective" ; + s2 = adjectiveTable adj.s + } ; + + InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { + t = "adv" ; + s1 = heading1 "Adverb" ; + s2 = paragraph adv.s + } ; + + InflectionPrep = \prep -> { + t = "prep" ; + s1 = heading1 "Preposition" ; + s2 = prepositionTable prep.s + } ; + + InflectionV, InflectionV2, InflectionVV, InflectionVS, InflectionVQ, + InflectionVA, InflectionV3, InflectionV2V, InflectionV2S, + InflectionV2Q, InflectionV2A = \verb -> { + t = "v" ; + s1 = heading1 "Verb" ; + s2 = verbTable verb + } ; + + InflectionCl = \clause -> { + t = "cl" ; + s1 = heading1 "Clause" ; + s2 = frameTable ( + tr (th "Tense" ++ th "Positive" ++ th "Negative") ++ + clauseRow "Present" Pres Simul clause ++ + clauseRow "Present anterior" Pres Anter clause ++ + clauseRow "Past" Past Simul clause ++ + clauseRow "Past anterior" Past Anter clause ++ + clauseRow "Future" Fut Simul clause ++ + clauseRow "Future anterior" Fut Anter clause + ) } ; lin @@ -42,4 +78,99 @@ lin MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ; MkTag i = {s = i.t} ; +oper + className : Gender -> Str = \g -> case g of { + G1 => "I" ; G2 => "II" ; G3 => "III" ; G4 => "IV" ; + G5 => "V" ; G6 => "VI" ; G7 => "VII" ; G8 => "VIII" ; + G9 => "IX" ; G10 => "X" ; G11 => "XI" ; G12 => "XII" ; + G13 => "XIII" + } ; + + adjectiveTable : (AForm => Str) -> Str = \forms -> + frameTable ( + tr (th "Class" ++ th "Sg" ++ th "Pl") ++ + adjectiveRow G1 forms ++ adjectiveRow G2 forms ++ + adjectiveRow G3 forms ++ adjectiveRow G4 forms ++ + adjectiveRow G5 forms ++ adjectiveRow G6 forms ++ + adjectiveRow G7 forms ++ adjectiveRow G8 forms ++ + adjectiveRow G9 forms ++ adjectiveRow G10 forms ++ + adjectiveRow G11 forms ++ adjectiveRow G12 forms ++ + adjectiveRow G13 forms + ) ; + + adjectiveRow : Gender -> (AForm => Str) -> Str = \g,forms -> + tr (th (className g) ++ + td (forms ! AAdj g Sg) ++ td (forms ! AAdj g Pl)) ; + + prepositionTable : (Number => Gender => Str) -> Str = \forms -> + frameTable ( + tr (th "Class" ++ th "Sg" ++ th "Pl") ++ + prepositionRow G1 forms ++ prepositionRow G2 forms ++ + prepositionRow G3 forms ++ prepositionRow G4 forms ++ + prepositionRow G5 forms ++ prepositionRow G6 forms ++ + prepositionRow G7 forms ++ prepositionRow G8 forms ++ + prepositionRow G9 forms ++ prepositionRow G10 forms ++ + prepositionRow G11 forms ++ prepositionRow G12 forms ++ + prepositionRow G13 forms + ) ; + + prepositionRow : Gender -> (Number => Gender => Str) -> Str = \g,forms -> + tr (th (className g) ++ td (forms ! Sg ! g) ++ td (forms ! Pl ! g)) ; + + verbTable : Verb -> Str = \verb -> + heading2 "Non-finite forms" ++ + frameTable ( + tr (th "" ++ th "Positive" ++ th "Negative" ++ + th "Passive positive" ++ th "Passive negative") ++ + tr (th "Infinitive" ++ + td (verb.s ! Pos ! VInf) ++ td (verb.s ! Neg ! VInf) ++ + td (verb.passive ! Pos ! VInf) ++ td (verb.passive ! Neg ! VInf)) ++ + imperativeRow "Imperative singular" Sg verb ++ + imperativeRow "Imperative plural" Pl verb + ) ++ + heading2 "Finite forms" ++ finiteTable verb.s ++ + heading2 "Passive finite forms" ++ finiteTable verb.passive ; + + imperativeRow : Str -> Number -> Verb -> Str = \label,n,verb -> + tr (th label ++ + td (verb.s ! Pos ! VImp n) ++ td (verb.s ! Neg ! VImp n) ++ + td (verb.passive ! Pos ! VImp n) ++ td (verb.passive ! Neg ! VImp n)) ; + + finiteTable : (Polarity => VForm => Str) -> Str = \forms -> + frameTable ( + tr (th "Agreement" ++ + th "Pres +" ++ th "Pres -" ++ + th "Past +" ++ th "Past -" ++ + th "Fut +" ++ th "Fut -") ++ + finiteRow "1 Sg" G1 Sg P1 forms ++ + finiteRow "2 Sg" G1 Sg P2 forms ++ + finiteRow "3 Sg (I)" G1 Sg P3 forms ++ + finiteRow "1 Pl" G1 Pl P1 forms ++ + finiteRow "2 Pl" G1 Pl P2 forms ++ + finiteRow "3 Pl (I)" G1 Pl P3 forms ++ + finiteClassRows G2 forms ++ finiteClassRows G3 forms ++ + finiteClassRows G4 forms ++ finiteClassRows G5 forms ++ + finiteClassRows G6 forms ++ finiteClassRows G7 forms ++ + finiteClassRows G8 forms ++ finiteClassRows G9 forms ++ + finiteClassRows G10 forms ++ finiteClassRows G11 forms ++ + finiteClassRows G12 forms ++ finiteClassRows G13 forms + ) ; + + finiteClassRows : Gender -> (Polarity => VForm => Str) -> Str = \g,forms -> + finiteRow (className g ++ " Sg") g Sg P3 forms ++ + finiteRow (className g ++ " Pl") g Pl P3 forms ; + + finiteRow : Str -> Gender -> Number -> Person -> + (Polarity => VForm => Str) -> Str = \label,g,n,p,forms -> + tr (th label ++ + td (forms ! Pos ! VPres g n p) ++ td (forms ! Neg ! VPres g n p) ++ + td (forms ! Pos ! VPast g n p) ++ td (forms ! Neg ! VPast g n p) ++ + td (forms ! Pos ! VFut g n p) ++ td (forms ! Neg ! VFut g n p)) ; + + clauseRow : Str -> ParamX.Tense -> Anteriority -> + {s : ParamX.Tense => Anteriority => Polarity => Str} -> Str = + \label,t,a,clause -> + tr (th label ++ td (clause.s ! t ! a ! Pos) ++ + td (clause.s ! t ! a ! Neg)) ; + } diff --git a/src/swahili/ExtendSwa.gf b/src/swahili/ExtendSwa.gf new file mode 100644 index 000000000..ecbd83c99 --- /dev/null +++ b/src/swahili/ExtendSwa.gf @@ -0,0 +1,127 @@ +--# -path=.:../abstract:../common:../bantu:../prelude + +concrete ExtendSwa of Extend = + CatSwa ** ExtendFunctor - [ + VPS, ListVPS, VPI, ListVPI, + RNP, RNPList, ListComp, ListImp, + ReflPron, ReflPoss, PredetRNP, AdvRNP, AdvRVP, AdvRAP, + ReflA2RNP, ReflRNP, PossPronRNP, + Base_rr_RNP, Base_nr_RNP, Base_rn_RNP, Cons_rr_RNP, Cons_nr_RNP, ConjRNP, + MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, + MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, + CompoundN, GenModNP, PresPartAP, PastPartAP, PastPartAgentAP, + PassVPSlash, PassAgentVPSlash, GerundCN, GerundAdv, UttVPShort, + ComplSlashPartLast, UseDAP, UseDAPMasc, UseDAPFem, PositAdVAdj, + ComplBareVS, EmptyRelSlash, ProgrVPSlash, CompoundAP, GerundNP, ByVP, + ApposNP, BaseComp, ConsComp, ConjComp, BaseImp, ConsImp, ConjImp, + TPastSimple + ] with (Grammar = GrammarSwa) ** + open Prelude, ResSwa, GrammarSwa in { + + lincat + VPS = {s : Agre => Str} ; + [VPS] = {s1,s2 : Agre => Str} ; + VPI = {s : Agre => Str} ; + [VPI] = {s1,s2 : Agre => Str} ; + RNP = {s : Agr => Str ; isPron : Bool} ; + RNPList = {s1,s2 : Agr => Str} ; + [Comp] = {s1,s2 : Agr => Str} ; + [Imp] = {s1,s2 : Polarity => Number => Str} ; + + lin + TPastSimple = GrammarSwa.TPast ; + + ReflPron = {s = reflPron ; isPron = True} ; + ReflPoss num cn = {s = \\a => + cn.s ! num.n ! Nom ++ cn.s2 ! num.n ++ + possessivePron a num.n cn.g ++ selfPron a ; + isPron = False} ; + PredetRNP p r = {s = \\a => r.s ! a ++ p.s ! getGender a ; isPron = False} ; + AdvRNP np p r = {s = \\a => np.s ! NPAcc ++ p.s ! getNumber a ! getGender a ++ r.s ! a ; isPron = False} ; + AdvRVP vp p r = insertObj (\\a => p.s ! a.n ! a.g ++ r.s ! (Ag a.g a.n a.p)) vp ; + AdvRAP ap p r = {s = \\g,n => ap.s ! g ! n ++ p.s ! n ! g ++ r.s ! (Ag g n P3)} ; + ReflA2RNP a r = {s = \\g,n => a.s ! AAdj g n ++ a.c2 ++ r.s ! (Ag g n P3)} ; + ReflRNP vp r = insertObj (\\a => vp.c2 ++ r.s ! (Ag a.g a.n a.p)) vp ; + PossPronRNP pr num cn r = {s = \\_ => + cn.s ! num.n ! Nom ++ pr.s ! Poss num.n cn.g ++ + possess_Prep.s ! num.n ! cn.g ++ r.s ! pr.a ; + a = Ag cn.g num.n P3} ; + Base_rr_RNP a b = {s1 = a.s ; s2 = b.s} ; + Base_nr_RNP a b = {s1 = \\_ => a.s ! NPAcc ; s2 = b.s} ; + Base_rn_RNP a b = {s1 = a.s ; s2 = \\_ => b.s ! NPAcc} ; + Cons_rr_RNP a xs = {s1 = \\g => a.s ! g ++ "," ++ xs.s1 ! g ; s2 = xs.s2} ; + Cons_nr_RNP a xs = {s1 = \\g => a.s ! NPAcc ++ "," ++ xs.s1 ! g ; s2 = xs.s2} ; + ConjRNP c xs = {s = \\a => c.s1 ++ xs.s1 ! a ++ c.s2 ++ xs.s2 ! a ; isPron = False} ; + + MkVPS t pol vp = {s = \\a => t.s ++ pol.s ++ vp.s ! t.t ! t.a ! pol.p ! a ++ vp.obj ! a} ; + BaseVPS a b = {s1 = a.s ; s2 = b.s} ; + ConsVPS a xs = {s1 = \\g => a.s ! g ++ "," ++ xs.s1 ! g ; s2 = xs.s2} ; + ConjVPS c xs = {s = \\a => c.s1 ++ xs.s1 ! a ++ c.s2 ++ xs.s2 ! a} ; + PredVPS np v = {s = np.s ! npNom ++ v.s ! agrFeatures np.a} ; + MkVPI vp = {s = \\a => infVP Pos a vp} ; + BaseVPI a b = {s1 = a.s ; s2 = b.s} ; + ConsVPI a xs = {s1 = \\g => a.s ! g ++ "," ++ xs.s1 ! g ; s2 = xs.s2} ; + ConjVPI c xs = {s = \\a => c.s1 ++ xs.s1 ! a ++ c.s2 ++ xs.s2 ! a} ; + ComplVPIVV v x = insertObj (\\a => x.s ! a) (predV v) ; + + CompoundN a b = {s = \\n,c => b.s ! n ! c ++ possess_Prep.s ! n ! b.g ++ a.s ! Sg ! Nom ; g = b.g} ; + GenModNP num np cn = {s = \\c => cn.s ! num.n ! npcase2case c ++ possess_Prep.s ! num.n ! cn.g ++ np.s ! NPoss ; a = Ag cn.g num.n P3} ; + PresPartAP vp = {s = \\g,n => ambaPron g n ++ vp.s ! Pres ! Simul ! Pos ! agre g n P3 ++ vp.obj ! agre g n P3} ; + PastPartAP vp = let pass = passiveVP vp in + {s = \\g,n => ambaPron g n ++ pass.s ! Past ! Simul ! Pos ! agre g n P3 ++ pass.obj ! agre g n P3} ; + PastPartAgentAP vp np = let pass = passiveVP vp in + {s = \\g,n => ambaPron g n ++ pass.s ! Past ! Simul ! Pos ! agre g n P3 ++ pass.obj ! agre g n P3 ++ "na" ++ np.s ! NPAcc} ; + PassVPSlash vp = passiveVP vp ; + PassAgentVPSlash vp np = insertObj (\\_ => "na" ++ np.s ! NPAcc) (passiveVP vp) ; + GerundCN vp = {s = \\_,_ => infVP Pos (agre G11 Sg P3) vp ; s2 = \\_ => [] ; g = G11} ; + GerundAdv vp = {s = infVP Pos (agre G11 Sg P3) vp} ; + UttVPShort vp = {s = vp.imp ! Pos ! Sg ++ vp.obj ! agre G1 Sg P2} ; + ComplSlashPartLast vp np = insertObj (\\_ => np.s ! NPAcc ++ vp.c2) vp ; + UseDAP d = {s = \\_ => d.s ! Obj G4 ; a = Ag G4 d.n P3} ; + UseDAPMasc d = {s = \\_ => d.s ! Obj G1 ; a = Ag G1 d.n P3} ; + UseDAPFem d = {s = \\_ => d.s ! Obj G1 ; a = Ag G1 d.n P3} ; + PositAdVAdj a = {s = a.s ! AAdj G1 Sg} ; + ComplBareVS v s = insertObj (\\_ => s.s) (predV v) ; + EmptyRelSlash cl = {s = \\t,a,b,_ => cl.s ! t ! a ! b ++ cl.c2 ; c = NPAcc} ; + ProgrVPSlash vp = vp ; + CompoundAP n a = {s = \\g,num => n.s ! Sg ! Nom ++ a.s ! AAdj g num} ; + GerundNP vp = {s = \\_ => infVP Pos (agre G11 Sg P3) vp ; a = Ag G11 Sg P3} ; + ByVP vp = {s = "kwa" ++ infVP Pos (agre G11 Sg P3) vp} ; + ApposNP a b = {s = \\c => a.s ! c ++ SOFT_BIND ++ "," ++ b.s ! c ; a = a.a} ; + BaseComp a b = {s1 = a.s ; s2 = b.s} ; + ConsComp a xs = {s1 = \\g => a.s ! g ++ "," ++ xs.s1 ! g ; s2 = xs.s2} ; + ConjComp c xs = {s = \\a => c.s1 ++ xs.s1 ! a ++ c.s2 ++ xs.s2 ! a} ; + BaseImp a b = {s1 = a.s ; s2 = b.s} ; + ConsImp a xs = {s1 = \\p,n => a.s ! p ! n ++ "," ++ xs.s1 ! p ! n ; s2 = xs.s2} ; + ConjImp c xs = {s = \\p,n => c.s1 ++ xs.s1 ! p ! n ++ c.s2 ++ xs.s2 ! p ! n} ; + + oper + possessivePron : Agr -> Number -> Gender -> Str = \owner,n,g -> + case n of { + Sg => ProunSgprefix g + possessiveStem owner ; + Pl => ProunPlprefix g + possessiveStem owner + } ; + + possessiveStem : Agr -> Str = \owner -> case owner of { + Ag G1 Sg P1 => "angu" ; Ag G1 Sg P2 => "ako" ; + Ag G1 Sg P3 => "ake" ; Ag G1 Pl P1 => "etu" ; + Ag G1 Pl P2 => "enu" ; Ag G1 Pl P3 => "ao" ; + Ag _ _ _ => "ake" + } ; + + selfPron : Agr -> Str = \owner -> case owner of { + Ag _ Sg _ => "mwenyewe" ; Ag _ Pl _ => "wenyewe" + } ; + + ambaPron : Gender -> Number -> Str = \g,n -> case of { + => "ambaye" ; => "ambao" ; + => "ambao" ; => "ambayo" ; + => "ambalo" ; => "ambayo" ; + => "ambacho" ; => "ambavyo" ; + => "ambayo" ; => "ambazo" ; + => "ambao" ; => "ambazo" ; + => "ambao" ; => "ambayo" ; + => "ambayo" ; => "ambayo" ; => "ambazo" ; + <_,_> => "ambayo" + } ; +} diff --git a/src/swahili/IdiomSwa.gf b/src/swahili/IdiomSwa.gf index 780b71b53..2df5f2594 100644 --- a/src/swahili/IdiomSwa.gf +++ b/src/swahili/IdiomSwa.gf @@ -1,48 +1,33 @@ concrete IdiomSwa of Idiom = CatSwa ** open Prelude, ResSwa in { - flags optimize=all_subs ; -{- + flags optimize=all_subs ; coding=utf8 ; lin - ImpersCl vp = mkClause "it" (agrP3 Sg) vp ; - GenericCl vp = mkClause "one" (agrP3 Sg) vp ; + ImpersCl vp = mkClause [] (agre G4 Sg P3) vp ; + GenericCl vp = mkClause "mtu" (agre G1 Sg P3) vp ; - CleftNP np rs = mkClause "it" (agrP3 Sg) - (insertObj (\\_ => rs.s ! np.a) - (insertObj (\\_ => np.s ! rs.c) (predAux auxBe))) ; + CleftNP np rs = {s = \\_,_,b => "ni" ++ np.s ! npNom ++ rs.s ! np.a} ; - CleftAdv ad s = mkClause "it" (agrP3 Sg) - (insertObj (\\_ => conjThat ++ s.s) - (insertObj (\\_ => ad.s) (predAux auxBe))) ; + CleftAdv ad s = {s = \\_,_,b => "ni" ++ ad.s ++ "ambapo" ++ s.s} ; - ExistNP np = - mkClause "there" (agrP3 (fromAgr np.a).n) - (insertObj (\\_ => np.s ! NPAcc) (predAux auxBe)) ; + ExistNP np = {s = \\_,_,b => case b of {Pos => "kuna" ; Neg => "hakuna"} ++ np.s ! npNom} ; - ExistIP ip = - mkQuestion (ss (ip.s ! npNom)) - (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ; + ExistIP ip = {s = \\_,_,b,_ => ip.s ! npNom ++ case b of {Pos => "kuna" ; Neg => "hakuna"}} ; - ExistNPAdv np adv = - mkClause "there" (agrP3 (fromAgr np.a).n) - (insertObj (\\_ => np.s ! NPAcc ++ adv.s) (predAux auxBe)) ; + ExistNPAdv np adv = {s = \\_,_,b => case b of {Pos => "kuna" ; Neg => "hakuna"} ++ np.s ! npNom ++ adv.s} ; - ExistIPAdv ip adv = - mkQuestion (ss (ip.s ! npNom)) - (mkClause "there" (agrP3 ip.n) (insertObj (\\_ => adv.s) (predAux auxBe))) ; + ExistIPAdv ip adv = {s = \\_,_,b,_ => ip.s ! npNom ++ case b of {Pos => "kuna" ; Neg => "hakuna"} ++ adv.s} ; - ProgrVP vp = insertObj (\\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a) (predAux auxBe) ; + ProgrVP vp = vp ; - ImpPl1 vp = {s = "let's" ++ infVP VVAux vp Simul CPos (AgP1 Pl)} ; + ImpPl1 vp = {s = "hebu" ++ vp.imp ! Pos ! Pl ++ vp.obj ! agre G1 Pl P1} ; - ImpP3 np vp = {s = "let" ++ np.s ! NPAcc ++ infVP VVAux vp Simul CPos np.a} ; + ImpP3 np vp = {s = "acha" ++ np.s ! NPAcc ++ infVP Pos (agrFeatures np.a) vp} ; - SelfAdvVP vp = insertObj reflPron vp ; - SelfAdVVP vp = insertAdVAgr reflPron vp ; + SelfAdvVP vp = insertObj (\\a => reflPron ! Ag a.g a.n a.p) vp ; + SelfAdVVP vp = insertAdV "mwenyewe" vp ; SelfNP np = { - s = \\c => np.s ! c ++ reflPron ! np.a ; + s = \\c => np.s ! c ++ reflPron ! np.a ; a = np.a } ; -} -} - } diff --git a/src/swahili/LangSwa.gf b/src/swahili/LangSwa.gf index 7821b9874..7a9475822 100644 --- a/src/swahili/LangSwa.gf +++ b/src/swahili/LangSwa.gf @@ -3,7 +3,7 @@ concrete LangSwa of Lang = GrammarSwa, LexiconSwa --- ,ConstructionSwa + ,ConstructionSwa ,DocumentationSwa --# notpresent ** { } ; diff --git a/src/swahili/MorphoSwa.gf b/src/swahili/MorphoSwa.gf index bd0e777e2..f52bac5c6 100644 --- a/src/swahili/MorphoSwa.gf +++ b/src/swahili/MorphoSwa.gf @@ -166,7 +166,29 @@ Detsomeplprefix : Gender -> Str = \g -> g = g } ; - regA:Str -> {s : AForm => Str} = \seo -> {s = table { +regA:Str -> {s : AForm => Str} = \seo -> case seo of { + -- Machine-translated lexica frequently provide a relational adjective as + -- "a/wa/ya ..." or an -enye/relative form instead of an adjective root. + -- Inflect the grammatical prefix, not the first letters of the phrase. + "a " + rest => phraseA genitivePrefix rest ; + "wa " + rest => phraseA genitivePrefix rest ; + "ya " + rest => phraseA genitivePrefix rest ; + "cha " + rest => phraseA genitivePrefix rest ; + "mwenye " + rest => phraseA enyePrefix rest ; + "Mwenye " + rest => phraseA enyePrefix rest ; + "wenye " + rest => phraseA enyePrefix rest ; + "yenye " + rest => phraseA enyePrefix rest ; + "Yenye " + rest => phraseA enyePrefix rest ; + "chenye " + rest => phraseA enyePrefix rest ; + "Chenye " + rest => phraseA enyePrefix rest ; + "enye " + rest => phraseA enyePrefix rest ; + "isiyo" + rest => phraseA relNegPrefix rest ; + "Isiyo" + rest => phraseA relNegPrefix rest ; + "asiye" + rest => phraseA relNegPrefix rest ; + "Asiye" + rest => phraseA relNegPrefix rest ; + "inayo" + rest => phraseA relPosPrefix rest ; + "Inayo" + rest => phraseA relPosPrefix rest ; + _ => {s = table { AAdj G1 Sg=>case Predef.take 1 seo of { "a"|"e"|"i"|"o"|"u" => VowelAdjprefix G1 Sg + seo; _ => ConsonantAdjprefix G1 Sg + seo }; @@ -241,7 +263,59 @@ Detsomeplprefix : Gender -> Str = \g -> "a"|"e"|"o"|"u" => VowelAdjprefix G13 Sg + seo; "i" => VoweliAdjprefix G13 Sg + seo; _ => ConsonantAdjprefix G13 Sg + seo }; - AAdj _ Pl =>[] }}; + AAdj _ Pl =>[] }} + } ; + + phraseA : (Gender -> Number -> Str) -> Str -> {s : AForm => Str} = + \prefix,rest -> {s = \\f => case f of { + AAdj g n => prefix g n ++ rest + }} ; + + joinedPhraseA : (Gender -> Number -> Str) -> Str -> {s : AForm => Str} = + \prefix,rest -> {s = \\f => case f of { + AAdj g n => prefix g n + rest + }} ; + + genitivePrefix : Gender -> Number -> Str = \g,n -> possess_Prepof ! n ! g ; + + enyePrefix : Gender -> Number -> Str = \g,n -> case of { + => "mwenye" ; => "wenye" ; + => "mwenye" ; => "yenye" ; + => "lenye" ; => "yenye" ; + => "chenye" ; => "vyenye" ; + => "yenye" ; => "zenye" ; + => "wenye" ; => "zenye" ; + => "wenye" ; + => "wenye" ; => "yenye" ; + => "yenye" ; => "yenye" ; + <_,_> => "yenye" + } ; + + relPosPrefix : Gender -> Number -> Str = \g,n -> case of { + => "anaye" ; => "wanao" ; + => "unao" ; => "inayo" ; + => "linalo" ; => "yanayo" ; + => "kinacho"; => "vinavyo" ; + => "inayo" ; => "zinazo" ; + => "unao" ; => "zinazo" ; + => "unao" ; + => "unao" ; => "yanayo" ; + => "yanayo" ; => "inayo" ; + <_,_> => "inayo" + } ; + + relNegPrefix : Gender -> Number -> Str = \g,n -> case of { + => "asiye" ; => "wasio" ; + => "usio" ; => "isiyo" ; + => "lisilo" ; => "yasiyo" ; + => "kisicho"; => "visivyo" ; + => "isiyo" ; => "zisizo" ; + => "usio" ; => "zisizo" ; + => "usio" ; + => "usio" ; => "yasiyo" ; + => "yasiyo" ; => "isiyo" ; + <_,_> => "isiyo" + } ; @@ -258,94 +332,107 @@ iregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { AAdj g Sg => ProunSgprefix g + "a" ++"rangi" ++"ya" ++ seo; AAdj g Pl=> ProunPlprefix g + "a" ++"rangi" ++"ya" ++ seo} } ; -regV : Str -> Verb = - \vika -> { - s = table{ True => table{ - VInf => vika; - VPres g n p => Verbprefix g n p + vika; - VPast g n p => Verbprefix g n p + init vika + "ie" ; - VFut g n p => Verbfutureprefix g n p + vika - } ; - False =>table { - VInf => "ndi" + vika; - VPres g n p => neg (Ag g n p) False Pres + "na" + vika ; - VPast g n p => neg (Ag g n p) False Past + "ne" + vika ; - VFut g n p => neg (Ag g n p) False Fut + "ka" + vika - } - }; +regV : Str -> Verb = + \input -> let vika = verbStem input in { + s = verbForms vika ; + passive = verbForms (passiveStem vika) }; - neg : Agr -> Bool ->Tense -> Str = \a,b,t -> let - g = getGender a; - n=getNumber a; - p=getPerson a - in case b of {True => [] ; False => negprefix g n t p} ; + verbForms : Str -> Polarity => VForm => Str = \vika -> + table{ Pos => table{ + VInf => "ku" + vika; + VImp Sg => vika; + VImp Pl => pluralImperative vika; + VPres g n p => Verbprefix g n p + "na" + vika; + VPast g n p => Verbprefix g n p + "li" + vika; + VFut g n p => Verbprefix g n p + "ta" + vika + } ; + Neg =>table { + VInf => "kutoku" + vika; + VImp Sg => "usi" + vika; + VImp Pl => "msi" + vika; + VPres g n p => negprefix g n Pres p + presentNegStem vika; + VPast g n p => negprefix g n Past p + "ku" + vika; + VFut g n p => negprefix g n Fut p + "ta" + vika + } + } ; + + passiveStem : Str -> Str = \v -> case v of { + _ + "oa" => init (init v) + "olewa" ; + _ + "ua" => init (init v) + "uliwa" ; + _ + "ia" => init v + "wa" ; + _ + "ea" => init v + "wa" ; + _ + "a" => init v + "wa" ; + _ + "u" => init v + "iwa" ; + _ => v + "wa" + } ; + + -- Lexical sources sometimes store an infinitive rather than a stem. Strip + -- ku- before vowel-initial polysyllabic stems, while retaining the genuine + -- monosyllabic stems used by kuwa/kula/kufa/kuja and the verb kua. + verbStem : Str -> Str = \v -> case v of { + "kua" => v ; + "ku" + "a" + rest => "a" + rest ; + "ku" + "e" + rest => "e" + rest ; + "ku" + "i" + rest => "i" + rest ; + "ku" + "o" + rest => "o" + rest ; + "ku" + "u" + rest => "u" + rest ; + _ => v + } ; + + pluralImperative : Str -> Str = \v -> case v of { + _ + "a" => init v + "eni" ; + _ => v + "ni" + } ; + + presentNegStem : Str -> Str = \v -> case v of { + _ + "a" => init v + "i" ; + _ => v + } ; negprefix : Gender -> Number -> Tense -> Person -> Str =\g,n,t,p-> case of { - => "ndi"; - => "ndu"; - => "ndu"; - => "twi"; - => "mwi"; - => "mai"; - => "ndu"; - => "i"; - => "i"; - => "mai"; - => "ki"; - => "i"; - => "kai"; - => "tui"; - => "vai"; - => "kui"; - => "i"; - <_,_,_,_> => "syi" + => "si"; + => "hu"; + => "ha"; + => "hatu"; + => "ham"; + => "hawa"; + => "hau"; + => "hai"; + => "hali"; + => "haya"; + => "haki"; + => "havi"; + => "hai"; + => "hazi"; + => "hau"; + => "hazi"; + => "haya"; + => "hapa"; + => "haku"; + => "hamu"; + <_,_,_,_> => "ha" }; Verbprefix : Gender -> Number -> Person -> Str = \g, n, p -> case of { - => "na" ; - => "wa" ; - => "wa" ; - => "twa" ; - => "mwa" ; - => "ma" ; - => "wa" ; - => "ya" ; - => "kya" ; - => "sya" ; - => "ya" ; - => "ma" ; - => "ka" ; - => "twa" ; - => "va" ; - => "kwa" ; - => "ya" ; - <_,_,_> => "sya" + => "ni" ; => "u" ; => "a" ; + => "tu" ; => "m" ; => "wa" ; + => "u" ; => "i" ; + => "li" ; => "ya" ; + => "ki" ; => "vi" ; + => "i" ; => "zi" ; + => "u" ; => "zi" ; + => "u" ; => "u" ; => "ya" ; + => "ya" ; => "i" ; + => "pa" ; => "ku" ; => "mu" } ; Verbfutureprefix : Gender -> Number -> Person -> Str = \g, n, p -> case of { - => "nga" ; - => "uka" ; - => "uka" ; - => "tuka" ; - => "muka" ; - => "maka" ; - => "uka" ; - => "ika" ; - => "kika" ; - => "ika" ; - => "ika" ; - => "maka" ; - => "kaka" ; - => "tuka" ; - => "vaka" ; - => "kuka" ; - => "ika" ; - <_,_,_> => "ika" + => Verbprefix g n p + "ta" } ; } diff --git a/src/swahili/NamesSwa.gf b/src/swahili/NamesSwa.gf index 580f416a8..ed3aee179 100644 --- a/src/swahili/NamesSwa.gf +++ b/src/swahili/NamesSwa.gf @@ -1 +1,12 @@ -concrete NamesSwa of Names = CatSwa ** { } +concrete NamesSwa of Names = CatSwa ** open ResSwa, Prelude in { + lin + GivenName n = {s = \\c => n.s ! npcase2case c ; a = Ag n.g Sg P3} ; + MaleSurname n = {s = \\c => n.s ! npcase2case c ; a = Ag n.g Sg P3} ; + FemaleSurname n = {s = \\c => n.s ! npcase2case c ; a = Ag n.g Sg P3} ; + PlSurname n = {s = \\c => n.s ! npcase2case c ; a = Ag n.g Pl P3} ; + FullName g s = {s = \\c => g.s ! npcase2case c ++ s.s ! npcase2case c ; a = Ag g.g Sg P3} ; + UseLN n = {s = \\c => n.s ! npcase2case c ; a = Ag n.g Sg P3} ; + PlainLN n = {s = \\c => n.s ! npcase2case c ; a = Ag n.g Sg P3} ; + InLN n = {s = "katika" ++ n.s ! Nom} ; + AdjLN ap n = {s = \\c => n.s ! c ++ ap.s ! n.g ! Sg ; g = n.g} ; +} diff --git a/src/swahili/NounSwa.gf b/src/swahili/NounSwa.gf index c0898de43..9a18392ab 100644 --- a/src/swahili/NounSwa.gf +++ b/src/swahili/NounSwa.gf @@ -1,2 +1,20 @@ -concrete NounSwa of Noun = - CatSwa ** NounBantu with (Structural = StructuralSwa), (ResBantu = ResSwa); +concrete NounSwa of Noun = + CatSwa ** NounBantu - [ApposCN, PPartNP, QuantityNP, MassNP] with + (Structural = StructuralSwa), (ResBantu = ResSwa) ** + open Prelude, ResSwa in { + lin + ApposCN cn np = { + s = \\n,c => cn.s ! n ! c ++ SOFT_BIND ++ "," ++ np.s ! npNom ; + s2 = cn.s2 ; g = cn.g + } ; + -- Swahili mass nouns take singular noun-class agreement. The Bantu + -- functor leaves the number as a free variant, which made linearization + -- nondeterministically select plural agreement and could even erase an + -- adjective for classes without a plural form. + MassNP cn = { + s = \\c => cn.s ! Sg ! npcase2case c ++ cn.s2 ! Sg ; + a = Ag cn.g Sg P3 + } ; + PPartNP np v = {s = \\c => np.s ! c ++ v.s ! Pos ! VInf ; a = np.a} ; + QuantityNP d mu = {s = \\_ => d.s ! NCard ! G5 ++ mu.s ; a = Ag G5 d.n P3} ; +} diff --git a/src/swahili/NumeralSwa.gf b/src/swahili/NumeralSwa.gf index 3b3ce8ffc..4fa15944e 100644 --- a/src/swahili/NumeralSwa.gf +++ b/src/swahili/NumeralSwa.gf @@ -33,6 +33,7 @@ lin pot1plus d e = { s = table { n = Pl} ; lin pot1as2 n = n ; lin pot2 d = {s = d.s ! hund} ** {n = Pl} ; +lin pot21 = regCardOrd "mia moja" ** {n = Pl} ; lin pot2plus d e = {s = table { NCard => \\g => d.s ! hund ! NCard ! g ++ "na" ++ e.s !NCard ! g ; NOrd => \\g =>Ordprefix g++ d.s ! hund ! NCard ! g ++ "na" ++ e.s ! NCard ! g } ; @@ -42,13 +43,23 @@ lin pot3 n = { s = table { NCard => \\g => mkCard NCard "elfu" ! g ++ n.s ! NCard ! g ; NOrd => \\g =>Ordprefix g++ mkCard NCard "elfu" ! g ++ n.s ! NCard ! g } ; n = Pl} ; +lin pot31 = regCardOrd "elfu moja" ** {n = Pl} ; lin pot3plus n m = { s = table { NCard => \\g => "elfu" ++ n.s ! NCard !g ++ m.s ! NCard ! g ; NOrd => \\g =>Ordprefix g++ "elfu" ++ n.s ! NCard !g ++ m.s ! NCard ! g} ; n = Pl} ; lin pot3as4 n = n ; +lin pot3decimal d = {s = \\o,g => d.s ! o ! g ++ "elfu" ; n = Pl} ; +lin pot41 = regCardOrd "milioni moja" ** {n = Pl} ; +lin pot4 n = {s = \\o,g => "milioni" ++ n.s ! o ! g ; n = Pl} ; +lin pot4plus n m = {s = \\o,g => "milioni" ++ n.s ! o ! g ++ m.s ! o ! g ; n = Pl} ; lin pot4as5 n = n ; +lin pot4decimal d = {s = \\o,g => d.s ! o ! g ++ "milioni" ; n = Pl} ; +lin pot51 = regCardOrd "bilioni moja" ** {n = Pl} ; +lin pot5 n = {s = \\o,g => "bilioni" ++ n.s ! o ! g ; n = Pl} ; +lin pot5plus n m = {s = \\o,g => "bilioni" ++ n.s ! o ! g ++ m.s ! o ! g ; n = Pl} ; +lin pot5decimal d = {s = \\o,g => d.s ! o ! g ++ "bilioni" ; n = Pl} ; -- numerals as sequences of digits0' diff --git a/src/swahili/ParadigmsSwa.gf b/src/swahili/ParadigmsSwa.gf index 193fdb9aa..a81981fc2 100644 --- a/src/swahili/ParadigmsSwa.gf +++ b/src/swahili/ParadigmsSwa.gf @@ -95,6 +95,14 @@ oper dfltGender : Gender = G1 ; mkA : (fat,fatter : Str) -> A ; -- irreg. } ; + -- Relational adjective phrases supplied by machine-translated lexica. + -- Their initial concord is generated from the modified noun class. + mkGenA : Str -> A ; -- "a/wa/ya ..." + mkEnyeA : Str -> A ; -- "mwenye/enye/yenye ..." + mkRelPosA : Str -> A ; -- "inayo-..." + mkRelNegA : Str -> A ; -- "isiyo-/asiye-..." + mkNegGenA : Str -> A ; -- "isiyo ya ..." + --3 Two-place adjectives @@ -378,6 +386,14 @@ mkN2 = overload { mkA : (fat,fatter : Str) -> A =\a,b -> lin A (iregA a b); } ; + mkGenA s = lin A (phraseA genitivePrefix s) ; + mkEnyeA s = lin A (phraseA enyePrefix s) ; + mkRelPosA s = lin A (joinedPhraseA relPosPrefix s) ; + mkRelNegA s = lin A (joinedPhraseA relNegPrefix s) ; + mkNegGenA s = lin A {s = \\f => case f of { + AAdj g n => relNegPrefix g n ++ genitivePrefix g n ++ s + }} ; + prepA2 : A -> Prep -> A2 ; mkA2 = overload { @@ -395,7 +411,10 @@ mkN2 = overload { mkV : Str -> V -> V = prefixV }; - prefixV : Str -> V -> V = \p,v -> lin V { s = \\b,vform => p + v.s! b ! vform } ; + prefixV : Str -> V -> V = \p,v -> lin V { + s = \\b,vform => p + v.s ! b ! vform ; + passive = \\b,vform => p + v.passive ! b ! vform + } ; mkV2 = overload { mkV2 : V -> V2 = dirV2 ; mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; diff --git a/src/swahili/PhraseSwa.gf b/src/swahili/PhraseSwa.gf index 62290c1e7..53ee879c4 100644 --- a/src/swahili/PhraseSwa.gf +++ b/src/swahili/PhraseSwa.gf @@ -1,3 +1,24 @@ -concrete PhraseSwa of Phrase = CatSwa ** PhraseBantu with - (ResBantu = ResSwa); +concrete PhraseSwa of Phrase = CatSwa ** open Prelude, ResSwa in { + flags optimize=all_subs ; coding=utf8 ; + lin + PhrUtt p u v = {s = p.s ++ u.s ++ v.s} ; + UttS s = s ; + UttQS q = {s = q.s ! QDir} ; + UttImpSg p i = {s = p.s ++ i.s ! p.p ! Sg} ; + UttImpPl p i = {s = p.s ++ i.s ! p.p ! Pl} ; + UttImpPol p i = {s = p.s ++ i.s ! p.p ! Pl} ; + UttIP ip = {s = ip.s ! npNom} ; + UttIAdv a = a ; + UttNP np = {s = np.s ! npNom} ; + UttAdv a = a ; + UttVP vp = {s = infVP Pos (agre G1 Sg P3) vp} ; + UttCN cn = {s = cn.s ! Sg ! Nom ++ cn.s2 ! Sg} ; + UttCard c = {s = c.s ! G1} ; + UttAP ap = {s = ap.s ! G1 ! Sg} ; + UttInterj i = i ; + NoPConj = {s = []} ; + PConjConj c = {s = c.s2} ; + NoVoc = {s = []} ; + VocNP np = {s = SOFT_BIND ++ "," ++ np.s ! npNom} ; +} diff --git a/src/swahili/QuestionSwa.gf b/src/swahili/QuestionSwa.gf index 970e6927b..d10472742 100644 --- a/src/swahili/QuestionSwa.gf +++ b/src/swahili/QuestionSwa.gf @@ -1,2 +1,26 @@ -concrete QuestionSwa of Question = CatSwa ** QuestionBantu with - (ResBantu = ResSwa); +concrete QuestionSwa of Question = CatSwa ** open Prelude, ResSwa in { + flags optimize=all_subs ; coding=utf8 ; + lincat QVP = ResSwa.VP ; + lin + QuestCl cl = {s = \\t,a,b,q => case q of { + QDir => "je" ++ cl.s ! t ! a ! b ; QIndir => cl.s ! t ! a ! b + }} ; + QuestVP ip vp = {s = \\t,a,b,_ => ip.s ! npNom ++ + vp.s ! t ! a ! b ! agre G1 ip.n P3 ++ vp.obj ! agre G1 ip.n P3} ; + QuestSlash ip cl = {s = \\t,a,b,_ => ip.s ! npNom ++ cl.s ! t ! a ! b ++ cl.c2} ; + QuestIAdv ia cl = {s = \\t,a,b,_ => ia.s ++ cl.s ! t ! a ! b} ; + QuestIComp ic np = {s = \\_,_,b,_ => ic.s ++ np.s ! npNom} ; + IdetCN d cn = {s = \\c => cn.s ! d.n ! npcase2case c ++ d.s ; n = d.n} ; + IdetIP d = {s = \\_ => d.s ; n = d.n} ; + AdvIP ip adv = {s = \\c => ip.s ! c ++ adv.s ; n = ip.n} ; + IdetQuant iq num = {s = iq.s ! num.n ++ num.s ! G1 ; n = num.n} ; + PrepIP p ip = {s = p.s ! ip.n ! G1 ++ ip.s ! npNom} ; + AdvIAdv i a = {s = i.s ++ a.s} ; + CompIAdv a = a ; + CompIP ip = {s = ip.s ! npNom} ; + ComplSlashIP vp ip = insertObj (\\_ => vp.c2 ++ ip.s ! npNom) vp ; + AdvQVP vp ia = insertObj (\\_ => ia.s) vp ; + AddAdvQVP vp ia = insertObj (\\_ => ia.s) vp ; + QuestQVP ip vp = {s = \\t,a,b,_ => ip.s ! npNom ++ + vp.s ! t ! a ! b ! agre G1 ip.n P3 ++ vp.obj ! agre G1 ip.n P3} ; +} diff --git a/src/swahili/RelativeSwa.gf b/src/swahili/RelativeSwa.gf index be3f10d78..529af7abc 100644 --- a/src/swahili/RelativeSwa.gf +++ b/src/swahili/RelativeSwa.gf @@ -1,2 +1,19 @@ -concrete RelativeSwa of Relative = CatSwa ** RelativeBantu with - (ResBantu = ResSwa); +concrete RelativeSwa of Relative = CatSwa ** open Prelude, ResSwa in { + flags optimize=all_subs ; coding=utf8 ; + lin + RelCl cl = {s = \\t,a,b,_ => "ambapo" ++ cl.s ! t ! a ! b ; c = npNom} ; + RelVP rp vp = {s = \\t,a,b,ag => let f = agrFeatures ag in + rp.s ! ag ++ vp.s ! t ! a ! b ! f ++ vp.obj ! f ; c = npNom} ; + RelSlash rp cl = {s = \\t,a,b,ag => rp.s ! ag ++ cl.s ! t ! a ! b ++ cl.c2 ; c = NPAcc} ; + IdRP = {s = relPron} ; + FunRP p np rp = {s = \\ag => p.s ! Sg ! G1 ++ np.s ! NPoss ++ rp.s ! ag} ; + oper + relPron : Agr => Str = table { + Ag G1 Sg _ => "ambaye" ; Ag G1 Pl _ => "ambao" ; + Ag G2 Sg _ => "ambao" ; Ag G2 Pl _ => "ambayo" ; + Ag G3 Sg _ => "ambalo" ; Ag G3 Pl _ => "ambayo" ; + Ag G4 Sg _ => "ambacho" ; Ag G4 Pl _ => "ambavyo" ; + Ag G5 Sg _ => "ambayo" ; Ag G5 Pl _ => "ambazo" ; + _ => "ambayo" + } ; +} diff --git a/src/swahili/SentenceSwa.gf b/src/swahili/SentenceSwa.gf index 50c370824..ccf46fedd 100644 --- a/src/swahili/SentenceSwa.gf +++ b/src/swahili/SentenceSwa.gf @@ -1,2 +1,24 @@ -concrete SentenceSwa of Sentence = CatSwa ** SentenceBantu with - (ResBantu = ResSwa); +concrete SentenceSwa of Sentence = CatSwa ** open Prelude, ResSwa in { + flags optimize=all_subs ; coding=utf8 ; + lin + PredVP np vp = mkClause (np.s ! npNom) (agrFeatures np.a) vp ; + PredSCVP sc vp = mkClause sc.s (agre G4 Sg P3) vp ; + SlashVP np vp = mkClause (np.s ! npNom) (agrFeatures np.a) vp ** {c2 = vp.c2} ; + AdvSlash cl adv = cl ** {s = \\t,a,b => cl.s ! t ! a ! b ++ adv.s} ; + SlashPrep cl prep = cl ** {c2 = prep.s ! Sg ! G1} ; + SlashVS np vs ss = mkClause (np.s ! npNom) (agrFeatures np.a) + (insertObj (\\_ => "kwamba" ++ ss.s ++ ss.c2) (predV vs)) ** {c2 = ss.c2} ; + ImpVP vp = {s = \\pos,n => vp.imp ! pos ! n ++ vp.obj ! agre G1 n P2} ; + AdvImp adv imp = {s = \\pos,n => adv.s ++ imp.s ! pos ! n} ; + EmbedS s = {s = "kwamba" ++ s.s} ; + EmbedQS q = {s = q.s ! QIndir} ; + EmbedVP vp = {s = infVP Pos (agre G1 Sg P3) vp} ; + UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; + UseQCl t p q = {s = \\f => t.s ++ p.s ++ q.s ! t.t ! t.a ! p.p ! f} ; + UseRCl t p r = {s = \\a => t.s ++ p.s ++ r.s ! t.t ! t.a ! p.p ! a ; c = r.c} ; + UseSlash t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ; c2 = cl.c2} ; + AdvS adv s = {s = adv.s ++ s.s} ; + ExtAdvS adv s = {s = adv.s ++ frontComma ++ s.s} ; + SSubjS a sub b = {s = a.s ++ sub.s ++ b.s} ; + RelS s r = {s = s.s ++ frontComma ++ r.s ! Ag G4 Sg P3} ; +} diff --git a/src/swahili/StructuralSwa.gf b/src/swahili/StructuralSwa.gf index bc3b6d67f..fba00ffb1 100644 --- a/src/swahili/StructuralSwa.gf +++ b/src/swahili/StructuralSwa.gf @@ -13,7 +13,7 @@ concrete StructuralSwa of Structural = CatSwa ** and_Conj = mkConj "na" ; because_Subj = ss "maana" ; before_Prep = mkPrep "kabla ya" ; - behind_Prep = mkPrep "baada" ; + behind_Prep = mkPrep "nyuma ya" ; between_Prep = mkPrep "katikati" ; both7and_DConj = mkConj "eli" "na"; but_PConj = ss "ila" ; @@ -30,19 +30,19 @@ concrete StructuralSwa of Structural = CatSwa ** Sub => [] }; n= Pl } ; - for_Prep = mkPrep nonExist ; + for_Prep = mkPrep "kwa" ; from_Prep = mkPrep "tokea" ; he_Pron = mkPron "yeye" "ake" G1 Sg P3 ; here_Adv = mkAdv "hapa" ; here7to_Adv = mkAdv ["huko"] ; here7from_Adv = mkAdv ["hapa"] ; - how_IAdv = ss "upi" ; - how8much_IAdv = ss "ngapi" ; + how_IAdv = ss "vipi" ; + how8much_IAdv = ss "kiasi gani" ; if_Subj = ss "Kama" ; in8front_Prep = mkPrep ["umbele "] ; i_Pron =mkPron "mimi" "angu" G1 Sg P1 ; in_Prep = mkPrep "ndani" ; - it_Pron ={ s=\\c=>nonExist; poss=\\n,g=> nonExist; a=Ag G4 Sg P3}; + it_Pron = mkPron "hicho" "ake" G4 Sg P3 ; --less_CAdv = C.mkCAdv "kasoro" ; much_Det, many_Det = { s = table { Obj g => Many_prefix g + "ngi" ; @@ -57,7 +57,7 @@ concrete StructuralSwa of Structural = CatSwa ** on_Prep = mkPrep "juu ya" ; one_Quant = {s = \\n,g => "moja" } ; only_Predet = {s = \\g => "tu" } ; - or_Conj = mkConj "kana" singular ; + or_Conj = mkConj "au" singular ; otherwise_PConj = ss "ila" ; please_Voc = ss "tafadhari" ; part_Prep, possess_Prep = let @@ -131,7 +131,7 @@ concrete StructuralSwa of Structural = CatSwa ** there_Adv = mkAdv "hapo" ; there7to_Adv = mkAdv "hapa kuvika" ; there7from_Adv = mkAdv ["hapa kutoka"] ; - therefore_PConj = ss "kwa ajili" ; + therefore_PConj = ss "kwa hiyo" ; they_Pron =mkPron "wao" "ao" G1 Pl P3 ; this_Quant = let questo : ParadigmsSwa.Number => MorphoSwa.Gender => Str = table { @@ -169,10 +169,10 @@ concrete StructuralSwa of Structural = CatSwa ** we_Pron =mkPron "sisi" "etu" G1 Pl P1 ; --whatPl_IP = mkIP "ata" "ata" plural ; -- whatSg_IP = mkIP "ata" "ata" singular ; - when_IAdv = ss "madhali" ; - when_Subj = ss "madhali" ; + when_IAdv = ss "lini" ; + when_Subj = ss "wakati" ; where_IAdv = ss "wapi" ; - which_IQuant = {s = \\_ => "wapi"} ; + which_IQuant = {s = \\_ => "gani"} ; ---b whichPl_IDet = mkDeterminer plural ["which"] ; ---b whichSg_IDet = mkDeterminer singular ["which"] ; -- whoPl_IP = mkIP "uu" "whom" "whose" plural ; @@ -183,18 +183,18 @@ concrete StructuralSwa of Structural = CatSwa ** --yes_Phr = ss "ii" ; yes_Utt = ss "ndio" ; youSg_Pron = mkPron "wewe" "ako" G1 Sg P2 ; - youPol_Pron,youPl_Pron = mkPron "nyinyi" "enyu" G1 Pl P3 ; + youPol_Pron,youPl_Pron = mkPron "nyinyi" "enyu" G1 Pl P2 ; not_Predet = {s = \\g => "nongi"} ; no_Quant = {s = \\g,n => "hakuna"} ; if_then_Conj = mkConj "kama" "basi" singular ; nobody_NP = regNP "hakuna mtu" a_wa singular ; - nothing_NP = regNP "hukuna kitu" ki_vi singular ; + nothing_NP = regNP "hakuna kitu" ki_vi singular ; at_least_AdN = mkAdN "" ; at_most_AdN = mkAdN "kuvika" ; except_Prep = mkPrep "kasoro" ; -- as_CAdv = C.mkCAdv "kama" ; -- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ; - that_Subj = ss "hio" ; + that_Subj = ss "kwamba" ; lin language_title_Utt = ss "kiswahili" ; } diff --git a/src/swahili/VerbSwa.gf b/src/swahili/VerbSwa.gf index 4572be6cb..1c3139215 100644 --- a/src/swahili/VerbSwa.gf +++ b/src/swahili/VerbSwa.gf @@ -1,2 +1,55 @@ -concrete VerbSwa of Verb = CatSwa ** VerbBantu with - (ResBantu = ResSwa); +concrete VerbSwa of Verb = CatSwa ** open Prelude, Predef, ResSwa, MorphoSwa in { + + flags optimize=all_subs ; coding=utf8 ; + + lin + UseV = predV ; + ComplVV v vp = insertObj (\\a => infVP Pos a vp) (predV v) ; + ComplVS v s = insertObj (\\_ => "kwamba" ++ s.s) (predV v) ; + ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; + ComplVA v ap = insertObj (\\a => ap.s ! a.g ! a.n) (predV v) ; + SlashV2a v = predV v ** {c2 = []} ; + Slash2V3 v np = insertObj (\\_ => np.s ! NPAcc) (predV v) ** {c2 = []} ; + Slash3V3 v np = insertObj (\\_ => np.s ! NPAcc) (predV v) ** {c2 = []} ; + SlashV2V v vp = insertObj (\\a => infVP Pos a vp) (predV v) ** {c2 = []} ; + SlashV2S v s = insertObj (\\_ => "kwamba" ++ s.s) (predV v) ** {c2 = []} ; + SlashV2Q v q = insertObj (\\_ => q.s ! QIndir) (predV v) ** {c2 = []} ; + SlashV2A v ap = insertObj (\\a => ap.s ! a.g ! a.n) (predV v) ** {c2 = []} ; + ComplSlash vp np = insertObj (\\_ => vp.c2 ++ np.s ! NPAcc) vp ; + SlashVV v vp = insertObj (\\a => infVP Pos a vp) (predV v) ** {c2 = vp.c2} ; + SlashV2VNP v np vp = insertObj (\\a => np.s ! NPAcc ++ infVP Pos a vp) (predV v) ** {c2 = vp.c2} ; + ReflVP vp = insertObj (\\a => vp.c2 ++ "ji") vp ; + UseComp comp = { + s = \\t,ant,pos,a => case of { + => "ni" ; => "si" ; + <_,_> => (predV (regV "kuwa")).s ! t ! ant ! pos ! a + } ; + passive = \\t,ant,pos,a => case of { + => "ni" ; => "si" ; + <_,_> => (predV (regV "kuwa")).passive ! t ! ant ! pos ! a + } ; + obj = \\a => comp.s ! Ag a.g a.n a.p ; + inf = \\pos,_ => case pos of {Pos => "kuwa" ; Neg => "kutokuwa"} ; + passiveInf = \\pos,_ => case pos of {Pos => "kuwa" ; Neg => "kutokuwa"} ; + imp = \\pos,n => case of { + => "kuwa" ; => "kuweni" ; + => "usiwe" ; => "msiwe" + } ; + passiveImp = \\pos,n => case of { + => "kuwa" ; => "kuweni" ; + => "usiwe" ; => "msiwe" + } + } ; + PassV2 v = passiveVP (predV v) ; + AdvVP vp adv = insertObj (\\_ => adv.s) vp ; + ExtAdvVP vp adv = insertObj (\\_ => frontComma ++ adv.s ++ finalComma) vp ; + AdVVP adv vp = insertAdV adv.s vp ; + AdvVPSlash vp adv = insertObj (\\_ => adv.s) vp ** {c2 = vp.c2} ; + AdVVPSlash adv vp = insertAdV adv.s vp ** {c2 = vp.c2} ; + VPSlashPrep vp p = vp ** {c2 = p.s ! Sg ! G1} ; + CompAP ap = {s = \\a => let f = agrFeatures a in ap.s ! f.g ! f.n} ; + CompNP np = {s = \\_ => np.s ! NPAcc} ; + CompAdv adv = {s = \\_ => adv.s} ; + CompCN cn = {s = \\a => let f = agrFeatures a in cn.s ! f.n ! Nom ++ cn.s2 ! f.n} ; + UseCopula = UseComp {s = \\_ => []} ; +}