From c82b09df1ab68ed4953342cba01f39147f71ca5e Mon Sep 17 00:00:00 2001 From: benson kituku <31066831+kitukb@users.noreply.github.com> Date: Wed, 3 Oct 2018 11:17:11 +0300 Subject: [PATCH 1/4] added Bantu functor --- src/bantu/AdjectiveBantu.gf | 46 +++++++++ src/bantu/AdverbBantu.gf | 27 ++++++ src/bantu/CatBantu.gf | 111 ++++++++++++++++++++++ src/bantu/CommonBantu.gf | 30 ++++++ src/bantu/ConjunctionBantu.gf | 77 ++++++++++++++++ src/bantu/DiffBantu.gf | 100 ++++++++++++++++++++ src/bantu/NounBantu.gf | 169 ++++++++++++++++++++++++++++++++++ src/bantu/PhraseBantu.gf | 31 +++++++ src/bantu/QuestionBantu.gf | 118 ++++++++++++++++++++++++ src/bantu/RelativeBantu.gf | 50 ++++++++++ src/bantu/ResBantu.gf | 93 +++++++++++++++++++ src/bantu/SentenceBantu.gf | 74 +++++++++++++++ src/bantu/Symbol10Bantu.gf | 41 +++++++++ src/bantu/Tense10Bantu.gf | 15 +++ src/bantu/VerbBantu.gf | 69 ++++++++++++++ 15 files changed, 1051 insertions(+) create mode 100644 src/bantu/AdjectiveBantu.gf create mode 100644 src/bantu/AdverbBantu.gf create mode 100644 src/bantu/CatBantu.gf create mode 100644 src/bantu/CommonBantu.gf create mode 100644 src/bantu/ConjunctionBantu.gf create mode 100644 src/bantu/DiffBantu.gf create mode 100644 src/bantu/NounBantu.gf create mode 100644 src/bantu/PhraseBantu.gf create mode 100644 src/bantu/QuestionBantu.gf create mode 100644 src/bantu/RelativeBantu.gf create mode 100644 src/bantu/ResBantu.gf create mode 100644 src/bantu/SentenceBantu.gf create mode 100644 src/bantu/Symbol10Bantu.gf create mode 100644 src/bantu/Tense10Bantu.gf create mode 100644 src/bantu/VerbBantu.gf diff --git a/src/bantu/AdjectiveBantu.gf b/src/bantu/AdjectiveBantu.gf new file mode 100644 index 000000000..6b3ca455b --- /dev/null +++ b/src/bantu/AdjectiveBantu.gf @@ -0,0 +1,46 @@ +incomplete concrete AdjectiveBantu of Adjective = + CatBantu ** open CommonBantu, ResBantu, Prelude in { + flags coding=utf8; + lin + + PositA a = {s = \\g,n => a.s !AAdj g n ;isPre = True } ; + ComparA a np = { + s = \\g,n => a.s !AComp g n ++ conjThan ++ np.s ! npNom ; + isPre = False} ; + + UseComparA a = {s = \\g,n=> a.s !AComp g n;isPre = True}; + + AdjOrd ord = { -- find why it cannot generate tree + s = \\g,n => ord.s ! g ; + isPre = True + } ; + + CAdvAP ad ap np = { + s = \\g,n => ad.s ++ ap.s !g! n ++ ad.p ++ np.s ! npNom ; + isPre = False + } ; + + ComplA2 a np = { + s = \\g,n => a.s !AComp g n ++ a.c2 ++ np.s ! NPAcc; + isPre = False + } ; + ReflA2 a ={ + s = \\g,n => a.s !AAdj g n ++ a.c2 ++ reflPron ! Ag g n P3 ; + } ; + + SentAP ap sc = { + s = \\g,n => ap.s !g! n ++ sc.s ; + isPre = False + } ; + + AdAP ada ap = { + s = \\g,n => ada.s ++ ap.s ! g ! n; + isPre = ap.isPre + } ; + + UseA2 a2 = {s = \\g, n => a2.s !AAdj g n ;isPre = True } ; + + AdvAP ap adv = {s = \\g,n => ap.s ! g ! n ++ adv.s ; isPre = False} ; + + +} diff --git a/src/bantu/AdverbBantu.gf b/src/bantu/AdverbBantu.gf new file mode 100644 index 000000000..2589c0fa0 --- /dev/null +++ b/src/bantu/AdverbBantu.gf @@ -0,0 +1,27 @@ +incomplete concrete AdverbBantu of Adverb = + CatBantu ** open CommonBantu, ResBantu, Prelude in { + + lin + PositAdvAdj a = {s = a.s !AAdj G1 Sg} ; + + ComparAdvAdj cadv a np =let agr = complAgr np.a + in { + s = cadv.s ++ a.s !AComp agr.g agr.n ++ cadv.p ++ np.s ! npNom + } ; + ComparAdvAdjS cadv a s = { + s = cadv.s ++ a.s !AComp G1 Sg ++ cadv.p ++ s.s + } ; + + PrepNP prep np = let agr = complAgr np.a + in {s = prep.s!agr.n!agr.g ++ (np.s ! NPAcc) } ; --s = preOrPost prep.isPre prep.s (np.s ! NPAcc) + + AdAdv = cc2 ; + PositAdAAdj a = {s = a.s !AAdj G1 Sg } ; + + + SubjS = cc2 ; + + AdnCAdv cadv = {s = cadv.s ++ cadv.p} ; + + +} diff --git a/src/bantu/CatBantu.gf b/src/bantu/CatBantu.gf new file mode 100644 index 000000000..7d86007eb --- /dev/null +++ b/src/bantu/CatBantu.gf @@ -0,0 +1,111 @@ +incomplete concrete CatBantu of Cat = + CommonX - [Pol] + ** open ResBantu, Prelude, ParamX in { + + flags optimize=all_subs ; + coding=utf8 ; + + lincat + + Pol = {s : Str ; b : Bool} ; + + S = {s : Str} ; + QS = {s : QForm => Str} ; + RS = {s : Agr => Str ; c : NPCase} ; -- c for it clefts + SSlash = {s : Str ; c2 : Str} ; + +-- Sentence + + -- Cl = {s : Tense => Anteriority => Bool => Str} ; + -- ClSlash = { + -- s : ResKam.Tense => Anteriority => Bool => Str ; +-- } ; +-- +-- Question + + -- QCl = {s : ResKam.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 ; + c : NPCase + } ; + RP = {s : RCase => Str ; a : RAgr} ; +-} +-- Verb + + VP = ResBantu.VP ; + VPSlash = ResBantu.SlashVP ; + Comp = {s : Agr => Str} ; + +-- Adjective + AP = {s : Gender => Number => Str }; + +-- Noun + + CN = CNoun; + NP = {s : NPCase => Str ; a : Agr} ; + Pron = {s: PronForm=>Str; a : Agr};-- Pronoun ; + Det = {s : DetForm => Str ; n : Number } ; + Predet = {s : Gender =>Str} ; + Ord = { s : Gender => Str } ; + Num = {s : Gender => Str ; n : Number } ; + Card = {s : Gender => Str ; n : Number} ; + Quant = {s : Number => Gender => Str } ; + DAP = {s : DetForm => Str ; n : Number} ; + +-- Numeral + + Numeral = {s : CardOrd => Gender => Str ; n : Number} ; + + Digits = {s : CardOrd => Gender => Str ; n : Number} ; + +-- Structural + + Conj = {s1,s2 : Str ; n : Number} ; + + Subj = {s : Str} ; + Prep = {s: Number => Gender => Str} ; + +-- Open lexical classes, e.g. Lexicon + 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 } ; + A2 = {s :AForm => Str }** {c2 : Str} ; + + N = {s : Number => Case => Str ; g : Gender} ; +-- N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ; + N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Prep} ; + N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Prep} ; + PN = {s : Case => Str ; g : Gender} ; + --Tense = {s : Str ; t : ResKam.Tense} ; + + linref + SSlash = \ss -> ss.s ++ ss.c2 ; + -- ClSlash = \cls -> cls.s ! Pres ! Simul ! CPos ! oDir ++ cls.c2 ; + + -- VP = \vp -> infVP VVAux vp Simul CPos (agrP3 Sg) ; + -- VPSlash = \vps -> infVP VVAux vps Simul CPos (agrP3 Sg) ++ vps.c2; +-- + Conj = \conj -> conj.s1 ++ conj.s2 ; + + -- V, VS, VQ, VA = \v -> infVP VVAux (predV v) Simul CPos (agrP3 Sg); + -- V2, V2A, V2Q, V2S = \v -> infVP VVAux (predV v) Simul CPos (agrP3 Sg) ++ v.c2; + -- V3 = \v -> infVP VVAux (predV v) Simul CPos (agrP3 Sg) ++ v.c2 ++ v.c3; + -- VV = \v -> infVP VVAux (predVV v) Simul CPos (agrP3 Sg) ; + -- V2V = \v -> infVP VVAux (predVc v) Simul CPos (agrP3 Sg) ; + Det =\d -> d.s!Obj G1; + CN = \cn -> cn.s!Sg!Nom ++ cn.s2!Sg ; + -- A = \a -> a.s ! AAdj G1 Sg ; + -- A2 = \a -> a.s ! AAdj G1 Sg ++ a.c2 ; + + N = \n -> n.s ! Sg ! Nom ; + N2 = \n -> n.s ! Sg ! Nom ++ n.c2.s!Sg!G1 ; + N3 = \n -> n.s ! Sg ! Nom ++ n.c2.s!Sg!G1 ++ n.c3.s!Sg!G1 ; +} diff --git a/src/bantu/CommonBantu.gf b/src/bantu/CommonBantu.gf new file mode 100644 index 000000000..e2e5007fb --- /dev/null +++ b/src/bantu/CommonBantu.gf @@ -0,0 +1,30 @@ +----1 Auxiliary operations common for Bantu languages +-- +-- This module contains operations that are shared by the Bantu +-- languages. The complete set of auxiliary operations needed to +-- implement [Test Test.html] is defined in [ResBantu ResBantu.html], +-- which depends on [DiffBantu DiffBantu.html]. + +resource CommonBantu = ParamX ** open Prelude in { + + flags optimize=all ; + coding=utf8 ; + + param + Case = Nom | Loc ; + NPCase = NCase Case | NPAcc | NPNomPoss ; + CardOrd = NCard | NOrd ; + + oper + ---- Conjunction Agreements (as fas as indep. of Gender) ---- + conjPPerson : Person -> Person -> Person = \p,q -> + case of { + <_,P1> | <_,P2> => P1 ; + => P1 ; + => P2 ; + => P3 + }; + + artIndef = "" ; + +} diff --git a/src/bantu/ConjunctionBantu.gf b/src/bantu/ConjunctionBantu.gf new file mode 100644 index 000000000..6858c2327 --- /dev/null +++ b/src/bantu/ConjunctionBantu.gf @@ -0,0 +1,77 @@ +incomplete concrete ConjunctionBantu of Conjunction = + CatBantu ** open CommonBantu, ResBantu, Coordination, Prelude in { + + flags optimize=all_subs ; + + lin + + ConjS = conjunctDistrSS ; + + ConjAdv = conjunctDistrSS ; + ConjAdV = conjunctDistrSS ; + + ConjNP conj ss = conjunctDistrTable NPCase conj ss ** { + a = Ag (agrFeatures ss.a).g (conjNumber (agrFeatures ss.a).n conj.n) (agrFeatures ss.a).p ; -- a = conjAgr (agrP3 conj.n) ss.a + } ; + + ConjAP conj ss = conjunctDistrTable2 Gender Number conj ss;-- ** { isPre = ss.isPre } ; + + ConjRS conj ss = conjunctDistrTable Agr conj ss ** { + c = ss.c + } ; + + ConjIAdv = conjunctDistrSS ; + + ConjCN conj cn = { + s = \\num,c => conj.s1 ++ cn.n1.s ! num!c ++ conj.s2 ++ cn.n2.s ! num!c ; + g = conjGender cn.n1.g cn.n2.g ; + s2 = \\num => []; + } ; + ConjDet c xs = { s = table { + Sub => [] ; + Obj g => xs.s1!Sub ++ c.s2 ++ xs.s2 !Obj g} ; + n = xs.n}; + + -- These fun's are generated from the list cat's. + + BaseS = twoSS ; + ConsS = consrSS comma ; + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + BaseAdV = twoSS ; + ConsAdV = consrSS comma ; + BaseNP x y = twoTable NPCase x y ** {a = conjAgr Sg x.a y.a} ; + ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgr Sg xs.a x.a} ; + + + BaseAP x y = twoTable2 Gender Number x y ; + ConsAP xs x = consrTable2 Gender Number comma xs x ; + BaseRS x y = twoTable Agr x y ** {c = y.c} ; + ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ; + BaseIAdv = twoSS ; + ConsIAdv = consrSS comma ; + BaseCN x y = { n1 = x ; n2 = y } ; + ConsCN xs x = { + n1 = { + s = \\num,c => x.n1.s ! num!c ++ comma ++ x.n2.s ! num !c ; + g = x.n2.g ; + s2 = \\num => [] ; + } ; + n2 = xs ; + } ; + BaseDAP x y = twoTable DetForm x y ** {n = y.n} ; + ConsDAP x xs = consrTable DetForm comma x xs ** {n = xs.n} ; + --BaseDet x y = twoTable DetForm x y ** {n = y.n} ; + --ConsDet xs x = consrTable DetForm comma xs x ** {n = xs.n} ; + lincat + [S] = {s1,s2 : Str} ; + [Adv] = {s1,s2 : Str} ; + [AdV] = {s1,s2 : Str} ; + [IAdv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : NPCase => Str ; a : Agr} ; + [AP] = {s1,s2 : Gender => Number => Str} ; --isPre : Bool} ; + [RS] = {s1,s2 : Agr => Str ; c : NPCase} ; + [CN] = {n1,n2 : CNoun } ; + [DAP] = {s1,s2 : DetForm => Str ; n : Number} ; + +} diff --git a/src/bantu/DiffBantu.gf b/src/bantu/DiffBantu.gf new file mode 100644 index 000000000..2ec12d696 --- /dev/null +++ b/src/bantu/DiffBantu.gf @@ -0,0 +1,100 @@ +--1 Differences between Bantu languages + +interface DiffBantu = open CommonBantu, Prelude in { + flags coding=utf8 ; + +-- HL: everything depending on Gender is not common, so it must not +-- be in CommonBantu, but here in DiffBantu. +oper + Gender : PType ; + firstGender : Gender ; -- G1 + secondGender : Gender ; -- G2 + + 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} ; + +param + Agr = Ag Gender Number Person ; + +oper +-- AGRE = {g : Gender ; n : Number ; p : Person} ; + Agre : Type = {g : Gender ; n : Number ; p : Person} ; + agre : Gender -> Number -> Person -> Agre = \g,n,p -> {g = g ; n = n ; p = p} ; + + agrFeatures : Agr -> Agre = \a -> case a of {Ag g n p => {g = g ; n = n ; p = p}} ; + getGender : Agr -> Gender = \a -> case a of {Ag g _ _ => g}; + getNumber : Agr -> Number = \a -> case a of {Ag _ n _ => n}; + getPerson : Agr -> Person = \a -> case a of {Ag _ _ p => p}; + + clitAgr : Agr -> {n : Number ; p : Person} = \a -> case a of { + Ag _ n p => {n = n; p = p} + } ; + complAgr : Agr -> {g : Gender ; n : Number} = \a -> case a of { + Ag g n _ => {g = g ; n = n} + } ; + predetAgr : Agr -> {g : Gender} = \a -> case a of { + Ag g _ _ => {g = g} + } ; + verbAgr : Agr -> {g : Gender ; n : Number ; p : Person} = \a -> case a of { + Ag g n p => {g = g ; n = n ; p = p} + } ; -- verbAgr = agrFeatures, why both? HL + + detAgr : Agr -> {g : Gender ; p : Person} = \a -> case a of { + Ag g _ p => {g = g; p = p} + } ; + + agrG1 : Number -> Person -> Agr = \n,p -> + Ag firstGender n p ; + dapagr : Gender -> Person -> Agr = \g,p -> + Ag g Sg p ; + agrP3 : Gender -> Number -> Agr = \g,n -> + Ag g n P3 ; + + aagr : Gender -> Number -> AAgr = \g,n -> + {g = g ; n = n} ; + + ---- Conjunction Agreements---- + + conjAgr : Number -> Agr -> Agr -> Agr = \n,xa,ya -> + let + x = agrFeatures xa ; y = agrFeatures ya + in + Ag (conjGender x.g y.g) (conjNumber (conjNumber x.n y.n) n) + (conjPPerson x.p y.p) ; + + conjGender : Gender -> Gender -> Gender ; + +param + -- AForm = AAdj Gender Number | AComp Gender Number ; + PronForm= Pers | Poss Number Gender; + DetForm = Sub | Obj Gender ; + +-- HL: the above is material removed from CommonBantu and adapted -- + +oper + conjThan : Str ; --one of them in bantu + conjThat : Str ; + superVery : Str ; -- one of bantu + + reflPron : Agr => Str ; -- second of bantu. + +param + VForm ; + DForm ; + AForm; +oper + ProunSgprefix : Gender -> Str ; -- added, HL + ProunPlprefix : Gender -> Str ; -- added, HL + Cardoneprefix : Gender -> Str; + Cardtwoprefix : Gender -> Str; + Allpredetprefix : Gender -> Str; + PrefixPlNom : Gender -> Str; + mkprefix,Ordprefix : Gender -> Str; + Cardprefix : Gender -> Str ; + Mostpredetprefix : Gender -> Str; + Adjpprefix : Gender -> Number -> Str; + VowelAdjprefix: Gender -> Number -> Str; + ConsonantAdjprefix: Gender -> Number -> Str; +} + diff --git a/src/bantu/NounBantu.gf b/src/bantu/NounBantu.gf new file mode 100644 index 000000000..ccca45585 --- /dev/null +++ b/src/bantu/NounBantu.gf @@ -0,0 +1,169 @@ +incomplete concrete NounBantu of Noun = + -- HL: Structural added for part_Prep, possess_Prep; contains Cat + CatBantu ** open Structural, ResBantu, Prelude in { + +flags optimize=all_subs ; coding = utf8 ; + +lin + -- Det -> CN -> NP + -- e.g. 'the man' + + DetCN det cn =let g = cn.g ; n = det.n in { + s = \\c => det.s!Sub ++ cn.s ! det.n !npcase2case c ++ det.s!Obj g ++ cn.s2!det.n; + a =Ag cn.g det.n P3 ; + } ; + + + -- PN -> NP + -- e.g. 'John' + UsePN pn = {s = \\c => pn.s !npcase2case c ; a = Ag pn.g Sg P3 } ; + -- Pron -> NP + -- e.g. 'he' + UsePron pron = let agr = verbAgr pron.a; + n=agr.n; g=agr.g + in {s = table { + NCase c => pron.s!Pers ; + NPAcc => pron.s!Pers ; + NPNomPoss => pron.s!Poss n g }; + a = Ag agr.g agr.n agr.p; + } ; + -- Predet -> NP -> NP + -- e.g. 'only the man' + + 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 ; + } ; + + {-} PPartNP np v2 = { + s = \\c => np.s ! c ++ v2.s ! VPPart ; + a = np.a + } ; + -} + RelNP np rs = { + s = \\c => np.s ! NCase Nom ++ frontComma ++ rs.s ! np.a ++ finalComma ; + a = np.a + } ; + -- NP -> Adv -> NP + -- e.g. 'Paris today' + AdvNP np adv = { + s = \\c => np.s ! NCase Nom ++ adv.s ; + a = np.a + } ; + + ExtAdvNP np adv = { + s = \\c => np.s ! NCase Nom ++ embedInCommas adv.s ; + a = np.a + } ; + + DetQuant quant num = { s = table{ Sub => []; + Obj g=>quant.s ! num.n! g ++ num.s !g }; + n = num.n } ; + + DetQuantOrd quant num ord ={ s = table{ Sub => []; + Obj g=>quant.s ! num.n! g ++ num.s! g ++ ord.s ! g }; + n = num.n } ; + DetNP det = { s = \\c => det.s!Obj G1 ; + a = agrP3 G1 det.n } ; + + PossPron pron = { s = \\n,g => pron.s!Poss n g } ; + + NumSg = {s = \\_ => []; n = Sg };--; hasCard = False} ; + NumPl = {s = \\_ => []; n = Pl };--; hasCard = False} ; +--b NoOrd = {s = []} ; + + NumCard n = n ;--** {hasCard = True} ; + + NumDigits n = {s = n.s ! NCard ; n = n.n} ; + OrdDigits n = { s = n.s ! NOrd} ; + + NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; + OrdNumeral numeral = {s = numeral.s ! NOrd} ; + + AdNum adn num = {s = \\g => adn.s ++ num.s!g ; n = num.n} ; + + OrdSuperl a ={s = \\g => a.s! AAdj g Sg ++ superVery} ;-- find how to include plular + + OrdNumeralSuperl n a = {s = \\g => n.s ! NOrd !g ++ a.s !AAdj g Sg } ;--what PL + -- DefArt = { s = \\n,g => []} ; --what PL + IndefArt, DefArt = { s = \\n,g =>[] } ; + --IndefArt = {s = \\ n,g => artIndef } ; + + -- CN -> NP + MassNP cn = let g = cn.g ; n = Sg | Pl in { + s = \\c => cn.s ! n! npcase2case c; + a = Ag g n P3 ; + } ; + UseN n = { s = n.s ; s2 = \\_ => [] ; g = n.g} ; --n + UseN2 n = { s = n.s ; s2 = \\_ => [] ; g = n.g} ;--n ; + UseN3 n = { s = n.s ; s2 = \\_ => [] ; g = n.g} ; --n ; + + 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 + } ; + + ComplN2 n2 np = {s = \\n,c => n2.s ! n ! Nom ++ n2.c2.s!n!n2.g ++ np.s ! NCase Nom ; + s2 = \\_ => [] ; + g = n2.g + }; + ComplN3 n3 np = { + s = \\n,c => n3.s ! n ! Nom ++ n3.c2.s!n!n3.g ++ np.s ! NCase Nom; + g = n3.g ; + c2 = n3.c3 + } ; + + AdjCN ap cn = {s = cn.s ; g = cn.g; + s2 = \\n =>cn.s2! n ++ ap.s ! cn.g ! n} ; + + RelCN cn rs = { + s = \\n,c => cn.s ! n ! Nom ++ rs.s ! Ag cn.g n P3 ; s2 =\\n => []; --another persons + g = cn.g + } ; + -- AP -> CN -> CN + -- e.g. 'big house' + AdvCN cn ad = {s = \\n,c => cn.s ! n ! Nom ++ ad.s ;s2 =\\n => []; g = cn.g} ; + + SentCN cn sc = {s = \\n,c => cn.s ! n ! Nom ++ sc.s ; s2 =\\n => []; g = cn.g} ; + + -- ApposCN cn np = {s = \\n,c => cn.s ! n ! Nom ++ np.s ! NCase Nom ; s2 =\\n => []; g = cn.g} ; + + -- PossNP : CN -> NP -> CN + -- e.g. 'house of Paris', 'house of mine' + PossNP cn np =let agr = detAgr np.a in + {s = \\n,c => cn.s ! n ! Nom ++ possess_Prep.s! n!cn.g ++ np.s ! NPNomPoss; + s2 =\\n => []; g = cn.g} ; + -- PartNP : CN -> NP -> CN + -- e.g. 'glass of wine' + PartNP cn np = {s = \\n,c => cn.s ! n ! Nom ++ part_Prep.s! n!cn.g ++ np.s ! NPAcc ; s2 =\\n => []; g = cn.g} ; + + -- CountNP : Det -> NP -> NP + -- e.g. 'three of them', 'some of the boys' + CountNP det np = let agr = verbAgr np.a + in { + s = \\c => det.s!Obj agr.g ++ part_Prep.s!agr.n!agr.g ++ np.s!c ;--NPAcc was removed + a = Ag agr.g agr.n agr.p + } ; + + + AdjDAP det ap = { s = table{ Sub => [] ; + Obj g =>det.s!Obj g ++ ap.s!g !det.n}; + n = det.n }; + + DetDAP d = { s=d.s; n=d.n }; + + ApposCN cn np = let agr = complAgr np.a in + {s = \\n,c => np.s ! NCase Nom --++ possess_Prep.s!n!agr.g + ++ cn.s !n ! Nom ; s2 =\\n => ""; g = cn.g} ; + +} diff --git a/src/bantu/PhraseBantu.gf b/src/bantu/PhraseBantu.gf new file mode 100644 index 000000000..8bed07332 --- /dev/null +++ b/src/bantu/PhraseBantu.gf @@ -0,0 +1,31 @@ +incomplete concrete PhraseBantu of Phrase = + CatBantu ** open CommonBantu, ResBantu, Prelude in { } +{-} + flags optimize = all_subs ; + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = {s = s.s ! Indic} ; + UttQS qs = {s = qs.s ! QDir} ; + UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg False ! Fem} ; + UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False ! Fem} ; + UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True ! Fem} ; + + UttIP ip = {s = ip.s ! Nom} ; --- Acc also + UttIAdv iadv = iadv ; + UttNP np = {s = (np.s ! Nom).ton} ; + UttVP vp = {s = infVP vp (agrP3 Fem Sg)} ; --- Agr + UttAdv adv = adv ; + UttCN n = {s = n.s ! Sg} ; + UttAP ap = {s = ap.s ! AF Masc Sg} ; + UttCard n = {s = n.s ! Masc} ; + UttInterj i = i ; + + NoPConj = {s = []} ; + PConjConj conj = {s = conj.s2} ; + + NoVoc = {s = []} ; + VocNP np = {s = "," ++ (np.s ! Nom).ton} ; + +-} diff --git a/src/bantu/QuestionBantu.gf b/src/bantu/QuestionBantu.gf new file mode 100644 index 000000000..7a3f31669 --- /dev/null +++ b/src/bantu/QuestionBantu.gf @@ -0,0 +1,118 @@ +incomplete concrete QuestionBantu of Question = + CatBantu ** open CommonBantu, ResBantu, Prelude in { +{- + flags optimize=all_subs ; + + lin + + QuestCl cl = { + s = \\t,a,p => + let cls = cl.s ! DDir ! t ! a ! p ---- DInv? + in table { + QDir => cls ! Indic ; + QIndir => subjIf ++ cls ! Indic + } + } ; + + QuestVP qp vp = { + s = \\t,a,b,_ => + let + cl = mkClause (qp.s ! Nom) False False (agrP3 qp.a.g qp.a.n) vp + in + cl.s ! DDir ! t ! a ! b ! Indic + } ; + + QuestSlash ip slash = { + s = \\t,a,p => + let + cls : Direct -> Str = + \d -> slash.s ! ip.a ! d ! t ! a ! p ! Indic ; + who = slash.c2.s ++ ip.s ! slash.c2.c + in table { + QDir => who ++ cls DInv ; + QIndir => who ++ cls DDir + } + } ; + + QuestIAdv iadv cl = { + s = \\t,a,p,q => + let + ord = case q of { + QDir => iAdvQuestionInv ; + QIndir => iAdvQuestionInv + } ; + cls = cl.s ! ord ! t ! a ! p ! Indic ; + why = iadv.s + in why ++ cls + } ; + + QuestIComp icomp np = { + s = \\t,a,p,_ => + let + vp = predV (selectCopula icomp.cop) ; + cls = (mkClause (np.s ! Nom).comp np.hasClit np.isPol np.a vp).s ! + DInv ! t ! a ! p ! Indic ; + why = icomp.s ! complAgr np.a ; + in why ++ cls + } ; + + PrepIP p ip = { + s = p.s ++ ip.s ! p.c + } ; + + AdvIP ip adv = { + s = \\c => ip.s ! c ++ adv.s ; + a = ip.a + } ; + + IdetCN idet cn = + let + g = cn.g ; + n = idet.n ; + a = aagr g n + in { + s = \\c => idet.s ! g ! c ++ cn.s ! n ; + a = a + } ; + + IdetIP idet = + let + g = Masc ; ---- Fem in Extra + n = idet.n ; + a = aagr g n + in { + s = \\c => idet.s ! g ! c ; + a = a + } ; + + IdetQuant idet num = + let + n = num.n ; + in { + s = \\g,c => idet.s ! n ! g ! c ++ num.s ! g ; + n = n + } ; + + AdvIAdv i a = {s = i.s ++ a.s} ; + + CompIAdv a = {s = \\_ => a.s ; cop = estarCopula} ; + + CompIP p = {s = \\_ => p.s ! Nom ; cop = serCopula} ; + + lincat + QVP = ResBantu.VP ; + lin + ComplSlashIP vp ip = insertObject vp.c2 (heavyNP {s = ip.s ; a = {g = ip.a.g ; n = ip.a.n ; p = P3}}) vp ; + AdvQVP vp adv = insertAdv adv.s vp ; + AddAdvQVP vp adv = insertAdv adv.s vp ; + + QuestQVP qp vp = { + s = \\t,a,b,_ => + let + cl = mkClause (qp.s ! Nom) False False (agrP3 qp.a.g qp.a.n) vp + in + cl.s ! DDir ! t ! a ! b ! Indic + } ; +-} +} + diff --git a/src/bantu/RelativeBantu.gf b/src/bantu/RelativeBantu.gf new file mode 100644 index 000000000..ed85dec8d --- /dev/null +++ b/src/bantu/RelativeBantu.gf @@ -0,0 +1,50 @@ +incomplete concrete RelativeBantu of Relative = + CatBantu ** open Prelude, CommonBantu, ResBantu in { +{- + flags optimize=all_subs ; + + lin + + RelCl cl = { + s = \\ag,t,a,p,m => pronSuch ! complAgr ag ++ conjThat ++ + cl.s ! DDir ! t ! a ! p ! m ; + c = Nom + } ; + + --- more efficient to compile than case inside mkClause; see log.txt + RelVP rp vp = case rp.hasAgr of { + True => {s = \\ag => + (mkClause + (rp.s ! False ! complAgr ag ! Nom) False False + (Ag rp.a.g rp.a.n P3) + vp).s ! DDir ; c = Nom} ; + False => {s = \\ag => + (mkClause + (rp.s ! False ! complAgr ag ! Nom) False False + ag + vp).s ! DDir ; c = Nom + } + } ; + + RelSlash rp slash = { + s = \\ag,t,a,p,m => + let aag = complAgr ag + in + slash.c2.s ++ + rp.s ! False ! aag ! slash.c2.c ++ + slash.s ! aag ! DDir ! t ! a ! p ! m ; --- ragr + c = Acc + } ; + + FunRP p np rp = { + s = \\_,a,c => (np.s ! Nom).ton ++ p.s ++ rp.s ! True ! a ! p.c ; + a = complAgr np.a ; + hasAgr = True + } ; + IdRP = { + s = relPron ; + a = {g = Masc ; n = Sg} ; + hasAgr = False + } ; +-} +} diff --git a/src/bantu/ResBantu.gf b/src/bantu/ResBantu.gf new file mode 100644 index 000000000..b05f0ee29 --- /dev/null +++ b/src/bantu/ResBantu.gf @@ -0,0 +1,93 @@ +--1 Bantu auxiliary operations. + +interface ResBantu = DiffBantu ** open CommonBantu in { + +flags + optimize=all ; + coding=utf8 ; + +--2 Constants uniformly defined in terms of language-dependent constants + +oper + npNom : NPCase = NCase Nom ; + npLoc : NPCase = NCase Loc ; + npcase2case : NPCase -> Case = \nc -> case nc of {NCase c => c ; _ => Nom} ; + + + mkNP : (i,my : Str) -> Gender -> Number -> Person -> + {s : NPCase => Str ; a : Agr} = \i,my,g,n,p -> + { s = table { + NCase Nom => i ; + NPAcc => my ; + NCase Loc | NPNomPoss => my -- works for normal genitives, "whose", etc. + } ; + a = Ag g n p ; + }; + + regNP : Str ->Gender -> Number -> {s : NPCase => Str ; a : Agr} = \that,g, n -> + mkNP that that g n P3 ; + + mkPron: (i, mine : Str) -> Gender -> Number -> Person -> + {s: PronForm => Str ; a : Agr} = \i,mine, g,n,p -> + { s = table { + Pers => i; + Poss n g => case of { + => ProunSgprefix g + mine ; + => ProunPlprefix g + mine} + } ; + 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}; + 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 + } ; + obj = \\_ => [] }; + + Clause : Type = { + s : Tense => Anteriority => Bool => Str + } ; + + mkClause : Str -> Agre -> VP -> Clause = + \subj,agr,vp -> { + s = \\t,a,b => + let + verb = vp.s ! t ! a ! b ! agr + in + subj ++ verb + } ; + + finalComma : Str = pre {"," | "." => []; "" => SOFT_BIND ++ ","; _ => []} ; + frontComma : Str = SOFT_BIND ++ "," ; +} + +-- insertObject: +-- p -cat=Cl -tr "la femme te l' envoie" +-- PredVP (DetCN (DetSg DefSg NoOrd) (UseN woman_N)) +-- (ComplV3 send_V3 (UsePron he_Pron) (UsePron thou_Pron)) +-- la femme te l' a envoyé +-- +-- p -cat=Cl -tr "la femme te lui envoie" +-- PredVP (DetCN (DetSg DefSg NoOrd) (UseN woman_N)) +-- (ComplV3 send_V3 (UsePron thou_Pron) (UsePron he_Pron)) +-- la femme te lui a envoyée diff --git a/src/bantu/SentenceBantu.gf b/src/bantu/SentenceBantu.gf new file mode 100644 index 000000000..9735f1974 --- /dev/null +++ b/src/bantu/SentenceBantu.gf @@ -0,0 +1,74 @@ +incomplete concrete SentenceBantu of Sentence = + CatBantu ** open Prelude, CommonBantu, ResBantu in { +{- + flags optimize=all_subs ; + coding=utf8 ; + + lin + + + PredVP np vp = mkClause (np.s ! npNom) np.a vp ; + + PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; + + ImpVP vp = { + s = \\pol,n => + let + agr = AgP2 (numImp n) ; + verb = infVP VVAux vp Simul CPos agr ; + dont = case pol of { + CNeg True => "don't" ; + CNeg False => "do" ++ "not" ; + _ => [] + } + in + dont ++ verb + } ; + + SlashVP np vp = + mkClause (np.s ! npNom) np.a vp ** {c2 = vp.c2} ; + + AdvSlash slash adv = { + s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; + c2 = slash.c2 + } ; + + SlashPrep cl prep = cl ** {c2 = prep.s} ; + + SlashVS np vs slash = + mkClause (np.s ! npNom) np.a + (insertObj (\\_ => conjThat ++ slash.s) (predV vs)) ** + {c2 = slash.c2} ; + + EmbedS s = {s = conjThat ++ s.s} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = infVP VVInf vp Simul CPos (agrP3 Sg)} ; --- agr + UseCl t p cl = { + s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.b } ; + + -- UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! p.b} ; + UseQCl t p cl = { + s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! q + } ; + UseRCl t p cl = { + s = \\r => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! r ; + c = cl.c + } ; + UseSlash t p cl = { + s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! oDir ; + c2 = cl.c2 + } ; + + AdvS a s = {s = a.s ++ s.s} ; + ExtAdvS a s = {s = a.s ++ frontComma ++ s.s} ; + + SSubjS a s b = {s = a.s ++ frontComma ++ s.s ++ b.s} ; + + RelS s r = {s = s.s ++ frontComma ++ r.s ! agrP3 Sg} ; + + oper + ctr : CPolarity -> CPolarity = \x -> x ; +--- ctr = contrNeg True ; -- contracted negations +-} + +} diff --git a/src/bantu/Symbol10Bantu.gf b/src/bantu/Symbol10Bantu.gf new file mode 100644 index 000000000..231a9a9d5 --- /dev/null +++ b/src/bantu/Symbol10Bantu.gf @@ -0,0 +1,41 @@ +incomplete concrete SymbolBantu of Symbol = + CatBantu ** open Prelude, CommonBantu, ResBantu in { + +lin + SymbPN i = {s = i.s ; g = Masc} ; + IntPN i = {s = i.s ; g = Masc} ; + FloatPN i = {s = i.s ; g = Masc} ; + NumPN i = {s = i.s!Masc ; g = Masc} ; + + CNIntNP cn i = heavyNP { + s = \\c => prepCase c ++ cn.s ! Sg ++ i.s ; + a = agrP3 cn.g Sg ; + hasClit = False + } ; + CNSymbNP det cn xs = let g = cn.g in heavyNP { + s = \\c => det.s ! g ! c ++ cn.s ! det.n ++ xs.s ; + a = agrP3 g det.n ; + hasClit = False + } ; + CNNumNP cn i = heavyNP { + s = \\c => artDef False cn.g Sg c ++ cn.s ! Sg ++ i.s ! Masc ; + a = agrP3 cn.g Sg ; + hasClit = False + } ; + SymbS sy = {s = \\_ => sy.s} ; + + SymbNum n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; + SymbOrd n = {s = \\_ => n.s ++ BIND ++ "º"} ; -- feminine variant ª, also variants 1.º and 1.ª + +lincat + + Symb, [Symb] = SS ; + +lin + + MkSymb s = s ; + + BaseSymb = infixSS "et" ; ---- + ConsSymb = infixSS "," ; + +} diff --git a/src/bantu/Tense10Bantu.gf b/src/bantu/Tense10Bantu.gf new file mode 100644 index 000000000..42adb1800 --- /dev/null +++ b/src/bantu/Tense10Bantu.gf @@ -0,0 +1,15 @@ +incomplete concrete TenseBantu of Tense = + CatBantu [Tense,Temp], TenseX [Ant,AAnter,ASimul] ** + open ResBantu, CommonBantu, Prelude in { + + lin + TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ; + TPres = {s = []} ** {t = RPres} ; + TPast = {s = []} ** {t = RPast} ; --# notpresent + TFut = {s = []} ** {t = RFut} ; --# notpresent + TCond = {s = []} ** {t = RCond} ; --# notpresent + + PPos = {s = [] ; p = RPos} ; + PNeg = {s = [] ; p = RNeg False} ; + +} diff --git a/src/bantu/VerbBantu.gf b/src/bantu/VerbBantu.gf new file mode 100644 index 000000000..3edc98bd2 --- /dev/null +++ b/src/bantu/VerbBantu.gf @@ -0,0 +1,69 @@ +incomplete concrete VerbBantu of Verb = + CatBantu ** open Prelude, CommonBantu, ResBantu in { +{- + flags optimize=all_subs ; + + lin + UseV = predV ; + + SlashV2a v = predV v ** {c2 = v.c2 ; gapInMiddle = False} ; + Slash2V3 v np = + insertObjc (\\_ => v.c2 ++ np.s ! NPAcc) (predV v ** {c2 = v.c3 ; gapInMiddle = False}) ; + Slash3V3 v np = + insertObjc (\\_ => v.c3 ++ np.s ! NPAcc) (predVc v) ; ---- + + ComplVV v vp = insertObj (\\a => infVP v.typ vp Simul CPos a) (predVV v) ; ---- insertExtra? + ComplVS v s = insertExtra (conjThat ++ s.s) (predV v) ; +--- ComplVS v s = insertObj (variants {\\_ => conjThat ++ s.s; \\_ => s.s}) (predV v) ; + ComplVQ v q = insertExtra (q.s ! QIndir) (predV v) ; + -- ComplVA v ap = insertObj (ap.s (predV v)) ; + + SlashV2V v vp = insertObjc (\\a => v.c3 ++ infVP v.typ vp Simul CPos a) (predVc v) ; + SlashV2S v s = insertExtrac (conjThat ++ s.s) (predVc v) ; ---- insertExtra? +--- SlashV2S v s = insertObjc (variants {\\_ => conjThat ++ s.s; \\_ => s.s}) (predVc v) ; + SlashV2Q v q = insertExtrac (q.s ! QIndir) (predVc v) ; + -- SlashV2A v ap = insertObjc (\\a => ap.s ! a) (predVc v) ; ---- + + ComplSlash vp np = case vp.gapInMiddle of { + True => insertObjPre (\\_ => vp.c2 ++ np.s ! NPAcc) vp ; + False => insertObj (\\_ => vp.c2 ++ np.s ! NPAcc) vp + } ; + SlashVV vv vp = + insertObj (\\a => infVP vv.typ vp Simul CPos a) (predVV vv) ** + {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle} ; + SlashV2VNP vv np vp = + insertObjPre (\\_ => vv.c2 ++ np.s ! NPAcc) + (insertObjc (\\a => vv.c3 ++ infVP vv.typ vp Simul CPos a) (predVc vv)) ** + {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle} ; + + UseComp comp = insertObj comp.s (predAux auxBe) ; + + 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 ; gapInMiddle = vp.gapInMiddle} ; + AdVVPSlash adv vp = insertAdV adv.s vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle} ; + + ReflVP v = insertObjPre (\\a => v.c2 ++ reflPron ! a) v ; + + PassV2 v = insertObj (\\_ => v.s ! VPPart ++ v.p) (predAux auxBe) ; + +---b UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no "to" + + + --CompAP ap = ap ; + CompNP np = {s = \\_ => np.s ! NPAcc} ; + CompAdv a = {s = \\_ => a.s} ; + CompCN cn = {s = \\a => case (fromAgr a).n of { + Sg => artIndef ++ cn.s ! Sg ! Nom ; + Pl => cn.s ! Pl ! Nom + } + } ; + + -- UseCopula = auxBe ; + + VPSlashPrep vp p = vp ** {c2 = p.s!Sg!G1 } ; +-} +} + From b1b8f90f4e64130921f983a4d3cf88e8a475d122 Mon Sep 17 00:00:00 2001 From: benson kituku <31066831+kitukb@users.noreply.github.com> Date: Wed, 3 Oct 2018 11:37:52 +0300 Subject: [PATCH 2/4] added egekusii language based on Bantu functor --- src/egekusii/AdjectiveGus.gf | 16 ++ src/egekusii/AdverbGus.gf | 13 + src/egekusii/CatGus.gf | 2 + src/egekusii/ConjunctionGus.gf | 2 + src/egekusii/DiffGus.gf | 244 ++++++++++++++++++ src/egekusii/GrammarGus.gf | 30 +++ src/egekusii/IdiomGus.gf | 48 ++++ src/egekusii/LangGus.gf | 11 + src/egekusii/LexiconGus.gf | 79 ++++++ src/egekusii/MorphoGus.gf | 446 +++++++++++++++++++++++++++++++++ src/egekusii/NounGus.gf | 2 + src/egekusii/NumeralGus.gf | 86 +++++++ src/egekusii/ParadigmsGus.gf | 437 ++++++++++++++++++++++++++++++++ src/egekusii/PhraseGus.gf | 3 + src/egekusii/QuestionGus.gf | 2 + src/egekusii/RelativeGus.gf | 2 + src/egekusii/ResGus.gf | 7 + src/egekusii/SentenceGus.gf | 3 + src/egekusii/StructuralGus.gf | 236 +++++++++++++++++ src/egekusii/VerbGus.gf | 2 + 20 files changed, 1671 insertions(+) create mode 100644 src/egekusii/AdjectiveGus.gf create mode 100644 src/egekusii/AdverbGus.gf create mode 100644 src/egekusii/CatGus.gf create mode 100644 src/egekusii/ConjunctionGus.gf create mode 100644 src/egekusii/DiffGus.gf create mode 100644 src/egekusii/GrammarGus.gf create mode 100644 src/egekusii/IdiomGus.gf create mode 100644 src/egekusii/LangGus.gf create mode 100644 src/egekusii/LexiconGus.gf create mode 100644 src/egekusii/MorphoGus.gf create mode 100644 src/egekusii/NounGus.gf create mode 100644 src/egekusii/NumeralGus.gf create mode 100644 src/egekusii/ParadigmsGus.gf create mode 100644 src/egekusii/PhraseGus.gf create mode 100644 src/egekusii/QuestionGus.gf create mode 100644 src/egekusii/RelativeGus.gf create mode 100644 src/egekusii/ResGus.gf create mode 100644 src/egekusii/SentenceGus.gf create mode 100644 src/egekusii/StructuralGus.gf create mode 100644 src/egekusii/VerbGus.gf diff --git a/src/egekusii/AdjectiveGus.gf b/src/egekusii/AdjectiveGus.gf new file mode 100644 index 000000000..e30579d32 --- /dev/null +++ b/src/egekusii/AdjectiveGus.gf @@ -0,0 +1,16 @@ +concrete AdjectiveGus of Adjective = CatGus **AdjectiveBantu-[ComparA,UseComparA,ComplA2] +with (ResBantu = ResGus)** open DiffGus in +{ +flags coding=utf8; + lin + ComparA a np = { + s = \\g,n => a.s !AAdj g n ++ conjThan ++ np.s ! npNom ; + isPre = False} ; + + UseComparA a = {s = \\g,n=> a.s !AAdj g n;isPre = True}; + + ComplA2 a np = { + s = \\g,n => a.s !AAdj g n ++ a.c2 ++ np.s ! NPAcc; + isPre = False + } ; + } \ No newline at end of file diff --git a/src/egekusii/AdverbGus.gf b/src/egekusii/AdverbGus.gf new file mode 100644 index 000000000..14df4d77a --- /dev/null +++ b/src/egekusii/AdverbGus.gf @@ -0,0 +1,13 @@ +concrete AdverbGus of Adverb = CatGus **AdverbBantu -[ComparAdvAdj,ComparAdvAdjS] with + (ResBantu = ResGus)** open DiffGus in +{ +flags coding=utf8; + lin + 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 + } ; + ComparAdvAdjS cadv a s = { + s = cadv.s ++ a.s !AAdj G1 Sg ++ cadv.p ++ s.s + } ; + } \ No newline at end of file diff --git a/src/egekusii/CatGus.gf b/src/egekusii/CatGus.gf new file mode 100644 index 000000000..3ec568dd0 --- /dev/null +++ b/src/egekusii/CatGus.gf @@ -0,0 +1,2 @@ +concrete CatGus of Cat = CommonX - [Pol] + ** CatBantu with (ResBantu = ResGus); diff --git a/src/egekusii/ConjunctionGus.gf b/src/egekusii/ConjunctionGus.gf new file mode 100644 index 000000000..e26984628 --- /dev/null +++ b/src/egekusii/ConjunctionGus.gf @@ -0,0 +1,2 @@ +concrete ConjunctionGus of Conjunction = CatGus ** ConjunctionBantu with + (ResBantu = ResGus); \ No newline at end of file diff --git a/src/egekusii/DiffGus.gf b/src/egekusii/DiffGus.gf new file mode 100644 index 000000000..a307aebe9 --- /dev/null +++ b/src/egekusii/DiffGus.gf @@ -0,0 +1,244 @@ +instance DiffGus of DiffBantu = open CommonBantu, Prelude in { + +param + GenderGus = G1 | G2 | G3 |G4| G5|G6|G7|G8|G9|G10 ; +oper + Gender = GenderGus ; + firstGender = G1 ; secondGender = G2 ; + conjThan = "kobua" ; + conjThat = "kobua" ; + + conjGender : Gender -> Gender -> Gender = \m,n -> + case m of { G1 => n ; _ => G2 } ; + reflPron :Agr => Str = \\ag=> case of { + < Ag G1 Sg P1 > => "mimi" ; + < Ag G1 Sg P2 > => "wewe" ; + < Ag G1 Sg P3 > => "yeye" ; + < Ag _ Sg P3 > => "" ; + < Ag G1 Pl P1 > => "sisi" ; + < Ag G1 Pl P2 > => "nyinyi" ; + < Ag G1 Pl P3 > => "wao" ; + < Ag _ _ _ > => "" + + }; + possess_Prepof,mkPrepof : Number => Gender => Str = + table Number { Sg => table { + G1| G2 => "bwo" ; + G3 => "ya"; + G4 => "ria"; + G5 => "kia"; -- + G6 => "rwa"; + G7 => "ka"; + G8 => "bwa"; + G9 => "kwa"; + G10 => "a" + }; + + Pl => table { G1 => "ba" ; + G2 => "ya" ; + G3|G6 => "cia"; + G4 |G8|G9|G10 => "a"; + G5 => "bi"; -- + G7 => "bia"} } ; + + + superVery ="bi"; + +Cardoneprefix : Gender -> Str = \g -> + case of { + =>"oya"; + =>"aka"; + =>"obo"; + =>"eri"; + =>"eye"; + =>"oro"; + =>"oyo"; + =>"eke"; + =>"oko"; + => "a" + } ; +Cardtwoprefix : Gender -> Str = \g -> + case of { + =>"ba"; + | =>"bi"; + | =>"a"; + | =>"i"; + | =>"e"; + < G10> => "" + } ; + + Allpredetprefix : Gender -> Str = \g -> + case of { + => "b" ; + => "y" ; + || => "bi" ; + | | => "" ; + | => "ci" + } ; + + + PrefixPlNom : Gender -> Str = \g -> + case of { + => "aba" ; + => "eme" ; + | => "ci" ; + | | => "ama" ; + | => "ebi"; + => "" + } ; + + mkprefix,Ordprefix : Gender -> Str = \g -> + case of { + | =>"o"; + => "ria"; + => "kia"; + => "ya"; + => "rwa"; + => "ka"; + => "bwa"; + => "kwa"; + < G10> => "a" + } ; + + Cardprefix : Gender -> Str = \g -> + case of { + =>"ba"; + | =>"bi"; + | =>"a"; + | =>"i"; + | =>"e"; + => "" + } ; + + Mostpredetprefix : Gender -> Str = \g -> ""; -- not taken care of + + ConsonantAdjprefix: Gender -> Number -> Str = \n,g -> ""; --not taken care of + {-case of { + => "m" ; + => "wa" ; + => "m" ; + => "mi" ; + => "ma" ; + => "ki" ; + => "vi" ; + => "m" ; + => "m" ; + => "m" ; + => "ma" ; + => "ma" ; + => "pa" ; + => "ku" ; + => "m" ; + <_,_> => "" + } ; -} + + VowelAdjprefix: Gender -> Number -> Str = \n,g ->""; -- not taken care of + {-} case of { + => "mw" ; + => "w" ; + => "mw" ; + => "my" ; + => "j" ; + => "m" ; + => "ch" ; + => "vy" ; + => "ny"; + => "ny"; + => "mw" ; + => "y" ; + => "mw" ; + => "mw" ; + => "mw" ; + => "m" ; + => "m" ; + => "ny" ; + => "p" ; + => "kw" ; + => "mu" ; + <_,_> => "" + } ; -} + + VoweliAdjprefix: Gender -> Number -> Str = \n,g -> ""; -- not taken care of + {-} case of { + => "mwi" ; + => "we" ; + => "mwi" ; + => "mi" ; + => "ji" ; + => "me" ; + => "ki" ; + => "vi" ; + => "zi"; + => "zi"; + => "mwi" ; + => "zi" ; + => "mwi" ; + => "mwi" ; + => "mwi" ; + => "me" ; + => "me" ; + => "zi" ; + => "pe" ; + => "kwi" ; + => "mwi" ; + <_,_> => "" + } ; -} +Adjpprefix : Gender -> Number -> Str = \n,g -> + case of { + => "aba" ; + => "eme" ; + => "e" ; + => "eri" ; + => "ege" ; + => "ebi" ; + => "oro" ; + => "aka" ; + => "ebi"; + => "obo" ; + => "oko" ; + => "aa" ; + | => "omo" ; + | => "ci" ; + | | => "ama" ; + => "" + } ; + ProunSgprefix : Gender -> Str = \g -> + case of { + | =>"o"; + => "ria"; + => "kia"; + => "ya"; + => "rwa"; + => "ka"; + => "bwa"; + => "kwa"; + => "a" + } ; + +ProunPlprefix : Gender -> Str = \g -> + case of { + | =>"ba"; + | =>"a"; + | =>"chia"; + =>"ya"; + =>"bia"; + <_> => "" + } ; + + dfltGender : Gender = G1 ; + dflt2Gender : Gender = G2 ; + + + + param + + VForm = VInf + | VPres Gender Number Person + | VPast Gender Number Person + | VFut Gender Number Person + -- | notpresent + ; + + DForm = unit | teen | ten |hund ; + AForm = AAdj Gender Number; +} diff --git a/src/egekusii/GrammarGus.gf b/src/egekusii/GrammarGus.gf new file mode 100644 index 000000000..19119486c --- /dev/null +++ b/src/egekusii/GrammarGus.gf @@ -0,0 +1,30 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarGus of Grammar = + NounGus, + VerbGus, + AdjectiveGus, + AdverbGus, + NumeralGus, + SentenceGus, + QuestionGus, + RelativeGus, + ConjunctionGus, + PhraseGus, + TextX - [Pol,PPos,PNeg,Pres], + StructuralGus, + IdiomGus, + TenseX - [Pol,PPos,PNeg,Pres] + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text; + +--lin + --PPos = {s = [] ; p = CPos} ; + -- PNeg = {s = [] ; p = CNeg True} ; -- contracted: don't + --PPos = {s = [] ; b = True} ; + -- PNeg = {s = [] ; b = False} ; + -- TPres = {s = [] ; t = ResGus.Pres} ; + -- TPast = {s = [] ; t = ResGus.Past }; + -- TFut = {s = [] ; t = ResGus.Fut }; +} ; diff --git a/src/egekusii/IdiomGus.gf b/src/egekusii/IdiomGus.gf new file mode 100644 index 000000000..4582e2281 --- /dev/null +++ b/src/egekusii/IdiomGus.gf @@ -0,0 +1,48 @@ +concrete IdiomGus of Idiom = CatGus ** open Prelude, ResGus in { + + flags optimize=all_subs ; +{- + lin + ImpersCl vp = mkClause "it" (agrP3 Sg) vp ; + GenericCl vp = mkClause "one" (agrP3 Sg) vp ; + + CleftNP np rs = mkClause "it" (agrP3 Sg) + (insertObj (\\_ => rs.s ! np.a) + (insertObj (\\_ => np.s ! rs.c) (predAux auxBe))) ; + + CleftAdv ad s = mkClause "it" (agrP3 Sg) + (insertObj (\\_ => conjThat ++ s.s) + (insertObj (\\_ => ad.s) (predAux auxBe))) ; + + ExistNP np = + mkClause "there" (agrP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPAcc) (predAux auxBe)) ; + + ExistIP ip = + mkQuestion (ss (ip.s ! npNom)) + (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ; + + ExistNPAdv np adv = + mkClause "there" (agrP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPAcc ++ adv.s) (predAux auxBe)) ; + + ExistIPAdv ip adv = + mkQuestion (ss (ip.s ! npNom)) + (mkClause "there" (agrP3 ip.n) (insertObj (\\_ => adv.s) (predAux auxBe))) ; + + ProgrVP vp = insertObj (\\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a) (predAux auxBe) ; + + ImpPl1 vp = {s = "let's" ++ infVP VVAux vp Simul CPos (AgP1 Pl)} ; + + ImpP3 np vp = {s = "let" ++ np.s ! NPAcc ++ infVP VVAux vp Simul CPos np.a} ; + + SelfAdvVP vp = insertObj reflPron vp ; + SelfAdVVP vp = insertAdVAgr reflPron vp ; + SelfNP np = { + s = \\c => np.s ! c ++ reflPron ! np.a ; + a = np.a + } ; +} -} + +} + diff --git a/src/egekusii/LangGus.gf b/src/egekusii/LangGus.gf new file mode 100644 index 000000000..abf594085 --- /dev/null +++ b/src/egekusii/LangGus.gf @@ -0,0 +1,11 @@ +--# -path=.:../abstract:../common:../api + +concrete LangGus of Lang = + GrammarGus, + LexiconGus +-- ,ConstructionGus + ** { + + + +} ; diff --git a/src/egekusii/LexiconGus.gf b/src/egekusii/LexiconGus.gf new file mode 100644 index 000000000..6bf8b40dc --- /dev/null +++ b/src/egekusii/LexiconGus.gf @@ -0,0 +1,79 @@ +--# -path=.:prelude + +concrete LexiconGus of Lexicon = CatGus ** + open ParadigmsGus,StructuralGus, Prelude in { + +flags + optimize=values ; + +lin +person_N = regN "omonto" omo_aba; + woman_N = regN "omosubati" omo_aba; + house_N = regN "enyomba" e_ci ; + tree_N = regN "omote" omo_eme; + big_A = regA "nene" ; + beautiful_A = regA "muya" ; + black_A = regA "mwamu"; + blue_A = regA "buluu" ; + broad_A = regA "gare" ; + brown_A = regA "maraba" ; + clean_A = iregA "safi" "safi"; + clever_A = regA "ng'aini" ; + cold_A = regA "kundu"; + correct_A = regA "keene" ; + dirty_A = regA "chabu" ; + dry_A = regA "kamoku" ; + full_A = regA "ichire" ; + good_A = regA "ya" ; + green_A = regA "machani" ; + heavy_A = regA "rito" ; + hot_A = regA "morero" ; + important_A = regA "eng'encho" ; + long_A = regA "tambe" ; + narrow_A = regA "nyerere" ; + near_A = regA "ang'e" ; + new_A = regA "nyia" ; + old_A = regA "koro" ; + red_A = regA "bariri" ; + rotten_A = regA "ng'undo" ; + round_A = regA "viringo" ; + sharp_A = regA "oge" ; + short_A = regA "eng'e" ; + small_A = regA "ke" ; + smooth_A = regA "terere" ; + straight_A = regA "ronge" ; + stupid_A = regA "riri" ; + thick_A = regA "netu" ; + thin_A = regA "reu" ; + ugly_A = regA "be"; + warm_A = regA "berera" ; + wet_A = regA "nyiu" ; + white_A = regA "rabu" ; + yellow_A = regA "yaye" ; + young_A = regA "ke" ; + certain_A=regA "maena"; + cow_N = regN "eng'ombe" e_ci ; + doctor_N = regN "omorwaria" omo_aba ; + dog_N = regN "esese" e_ci; + door_N = regN "omorangwa" omo_eme ; + enemy_N = regN "omobisa" omo_aba; + fish_N = regN "enswe" e_ci; + friend_N = regN "omosani" omo_aba; + garden_N = regN "omogondo" omo_eme; + girl_N = regN "omoiseke" omo_aba ; + lamp_N = regN "etaya" e_ci; + man_N = regN "omosacha" omo_aba ; + eye_N = iregN "eriso" "amaiso" eri_ama ; + tooth_N = regN "ero" eri_ama ; + wife_N = regN "omokungu" omo_aba; + +oper + aboutP = mkPrep "juu ya" ; + atP = mkPrep "vala ve" ; + forP = mkPrep "for" ; + fromP = mkPrep "kutoka" ; + inP = mkPrep "ndani" ; + onP = mkPrep "juu" ; + toP = mkPrep "hadi" ; + +} ; diff --git a/src/egekusii/MorphoGus.gf b/src/egekusii/MorphoGus.gf new file mode 100644 index 000000000..1f3063a5f --- /dev/null +++ b/src/egekusii/MorphoGus.gf @@ -0,0 +1,446 @@ +--# -path=.:../../prelude + +--1 Egekusii Resource Morphology + +resource MorphoGus = CommonBantu , +ResGus ** open Prelude, Predef +in { + + flags optimize=all ; + oper + Many_prefix: Gender -> Str = \g -> + case of { + =>"aba"; + || =>"ama"; + | =>"cini"; + =>"eme"; + | =>"ebi"; + => "ani" + } ; + + Few_prefix : Gender -> Str = \g -> + case of { + =>"basi"; + || =>"masi"; + | =>"cisi"; + =>"mesi"; + | =>"bisi"; + => "asi" + } ; + + + Detsomesgprefix : Gender -> Str = \g ->""; + {-} case of { + => "li" ; + => "ki" ; + => "me"; + => "pe" ; + => "kwi" ; + | => "nyi" ; + |||| | => "mwi" + + } ; -} + Some_prefix : Gender -> Str = \g -> + case of { + =>"beke"; + =>"bike"; + =>"make"; + =>"make"; + =>"nke"; + =>"nke"; + =>"mebe"; + =>"bike"; + =>"make"; + => "ake" + } ; + +Detsomeplprefix : Gender -> Str = \g ->""; + {-} case of { + => "we" ; + => "mi" ; + => "nyi" ; + => "pe" ; + => "kwi" ; + => "vi" ; + | => "nye" ; + | => "mwi" ; + | | => "me" + + } ; -} + + mkNum3 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ CardThirteenprefix g + two ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ second} ; + ten => table {NCard =>\\g =>"emerongo etato" ; + NOrd => \\g => Ordprefix g ++ "emerongo etato"}; + hund => table {NCard =>\\g =>"amagana atato " ; + NOrd => \\g => Ordprefix g ++ "amagana atato"} + } + } ; + mkNum4 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ Cardfouteenprefix g ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ second } ; + ten => table {NCard =>\\g =>"emerongo ene"; + NOrd => \\g => Ordprefix g ++ "emerongo ene"}; + hund => table {NCard =>\\g =>"amagana ane " ; + NOrd => \\g => Ordprefix g ++ "amagana ane"} + } + } ; + mkNum5 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ;-- create table totake care of eci and oroci which is isano not itano + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ Cardfifteenprefix g + two ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ second } ; + ten => table {NCard =>\\g =>"emerongo etano" ; + NOrd => \\g => Ordprefix g ++ "emerongo etano"}; + hund => table {NCard =>\\g =>"amagana atano " ; + NOrd => \\g => Ordprefix g ++ "amagana atano"} + } + } ; + + mkNum6 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ++Cardsixprefix g + second; + NOrd => \\g => Ordprefix g ++ "ga" + two ++ "ri" + second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ Cardfifteenprefix g + two ++ Cardsixprefix g + second ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ "ga" + two ++ "ri" + second} ; + ten => table {NCard =>\\g =>"emerongo etano" ++ Cardsixprefix g + second ; + NOrd => \\g => Ordprefix g ++ "emerongo etato"++ "ri" + second}; + hund => table {NCard =>\\g =>"amagana atano "++ Cardoneprefix g + second ; + NOrd => \\g => Ordprefix g ++ "amagana atano"++ "ri" + second} + } + } ; + + mkNum7 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ++Cardtwoprefix g + second; + NOrd => \\g => Ordprefix g ++ "ga" + two ++ "ka" + second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ Cardfifteenprefix g + two ++ Cardtwoprefix g + second ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ "ga" + two ++ "ka" + second} ; + ten => table {NCard =>\\g =>"emerongo etano" ++ Cardtwoprefix g + second ; + NOrd => \\g => Ordprefix g ++ "emerongo etano"++ "ka" + second}; + hund => table {NCard =>\\g =>"amagana atano "++ Cardtwoprefix g + second ; + NOrd => \\g => Ordprefix g ++ "amagana atano"++"ka" + second} + } + } ; + + mkNum8 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ++ Cardprefix g + second; + NOrd => \\g => Ordprefix g ++ "ga" + two ++ "ga" + second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ Cardfifteenprefix g + two ++ Cardprefix g + second ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ "ga" + two ++ "ga" + second} ; + ten => table {NCard =>\\g =>"emerongo etano" ++ Cardprefix g + second ; + NOrd => \\g => Ordprefix g ++ "emerongo etano"++ "ga" + second}; + hund => table {NCard =>\\g =>"amagana atano "++ Cardprefix g + second ; + NOrd => \\g => Ordprefix g ++ "amagana atano"++ "ga" + second} + } + } ; + mkNum2 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardtwoprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikomi na" ++ Cardtwelveprefix g + two ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ Cardtwelveprefix g + two } ; + ten => table {NCard =>\\g =>"emerongo ebere" ; + NOrd => \\g => Ordprefix g ++ "emerongo ebere" }; + hund => table {NCard =>\\g =>"amagana ebere" ; + NOrd => \\g => Ordprefix g ++ "amagana ebere" } + } + } ; + + mkNum1 : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardoneprefix g + two ; + NOrd => \\g => Ordoneprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikomi nemo" ; + NOrd => \\g => Ordprefix g ++ "ikomi " ++ "nemo"} ; + ten => table {NCard =>\\g =>"ikomi" ; + NOrd => \\g => Ordprefix g ++ "ikomi"}; + hund => table {NCard =>\\g =>"rigana erimo"; + NOrd => \\g => Ordprefix g ++ "rigana erimo" } + } + } ; + + regNum : Str -> {s : DForm => CardOrd => Gender => Str} = + \six -> {s = table { + unit => table {NCard =>\\g => six ; + NOrd => \\g => Ordprefix g ++ six} ; + teen => table {NCard =>\\g =>"ikomi na" ++ six ; + NOrd => \\g => Ordprefix g ++ "ikomi na" ++ six} ; + ten => table {NCard =>\\g =>"emerongo" ++ six ; + NOrd => \\g => Ordprefix g ++ "emerongo" ++ six}; + hund => table {NCard =>\\g =>"amagana " ++ six ; + NOrd => \\g => Ordprefix g ++ "amagana" ++ six} + } } ; + + + regCardOrd : Str -> {s : CardOrd => Gender => Str} = \ten -> + {s = table {NCard => \\g => ten ; + NOrd =>\\g => Ordprefix g ++ ten } } ; + + regCardone : Str -> Str -> {s : CardOrd => Gender => Str} = \ten,one -> + {s = table {NCard => \\g => ten ++ Cardoneprefix g + one ; + NOrd =>\\g => Ordprefix g ++ ten ++ Cardoneprefix g + one } } ; + + mkCard : CardOrd -> Str -> Gender => Str = \o,ten -> + (regCardOrd ten).s ! o ; + + + + + +regN : Str ->Gender -> Noun = \w, g ->let + ndeto= PrefixPlNom g + Predef.drop 3 w; + in case g of { + G4 => {s = table { Sg => table {Nom => w; Loc => ""} ; + Pl=>table{ Nom => "ama" + Predef.drop 2 w; Loc => "" } + }; g = g} ; + G3=> {s = table { Sg => table {Nom => w; Loc => ""} ; + Pl=>table{ Nom => "ci" + Predef.drop 1 w; Loc => "" } + }; g = g} ; + _ => {s = table { Sg => table {Nom => w; Loc => ""} ; + Pl=>table{ Nom => ndeto; Loc => "" } }; + g = g}}; + + iregN :Str-> Str ->Gender -> Noun= \man,men,g -> { + s = table{Sg => table{Nom => man ; Loc=> ""}; + Pl => table{Nom => men ; Loc=> ""}} ; + g = g + } ; + + regA:Str -> {s : AForm => Str} = \seo -> {s = table { + AAdj G1 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"u" => "omu" + seo; + "o" => "omw" + seo; + _ => ConsonantAdjprefix G1 Sg + seo }; + AAdj G1 Pl =>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G1 Pl + seo }; + + + AAdj G2 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"u" => "omu" + seo; + "o" => "omw" + seo; + _ => ConsonantAdjprefix G2 Sg + seo }; + AAdj G2 Pl =>case Predef.take 1 seo of { + "o" => "emi" + seo; + _ => ConsonantAdjprefix G2 Pl + seo }; + + AAdj G3 Sg=>case Predef.take 1 seo of { + "o" |"i" => "eng" + seo; + _ => ConsonantAdjprefix G3 Sg + seo }; + AAdj G3 Pl =>case Predef.take 1 seo of { + "o" |"i" => "ching" + seo; + _ => ConsonantAdjprefix G3 Pl + seo }; + AAdj G4 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"o"|"u" => "rigi" + seo; + _ => ConsonantAdjprefix G4 Sg + seo }; + AAdj G4 Pl =>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G4 Pl + seo }; + AAdj G5 Sg=>case Predef.take 1 seo of { + "i" => "eki" + seo; + _ => ConsonantAdjprefix G5 Sg + seo }; + AAdj G5 Pl =>case Predef.take 1 seo of { + "i" => "ebi" + seo; + _ => ConsonantAdjprefix G5 Pl + seo }; + + AAdj G6 Sg=>case Predef.take 1 seo of { + "i"|"o" => "oru"+ seo; + _ => ConsonantAdjprefix G6 Sg + seo }; + AAdj G6 Pl =>case Predef.take 1 seo of { + "i"|"o" => "ching'"+ seo; + _ => ConsonantAdjprefix G6 Pl + seo }; + AAdj G7 Sg=>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G7 Sg + seo }; + AAdj G7 Pl =>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G7 Pl + seo }; + AAdj G8 Sg=>case Predef.take 1 seo of { + "i"|"o" => "obu"+ seo; + _ => ConsonantAdjprefix G8 Sg + seo }; + AAdj G8 Pl =>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G8 Pl + seo }; + AAdj G9 Sg=>case Predef.take 1 seo of { + "i"|"o" => "oku" + seo; + _ => ConsonantAdjprefix G9 Sg + seo }; + AAdj G9 Pl =>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G9 Pl + seo }; + + AAdj G10 Sg=>case Predef.take 1 seo of { + _ => ConsonantAdjprefix G10 Sg + seo }; + AAdj G10 Pl =>[] }}; + + +lregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { + s = table { + AAdj g Sg => ProunSgprefix g + seo ++ seoo; + AAdj g Pl=> ProunPlprefix g + seo ++ seoo + } } ; + +iregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { + s = table { + AAdj g Sg=> seo; + AAdj g Pl => seoo} }; + +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 + } + }; + }; + + 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} ; + + 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" + +}; + + + + + + + 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" + } ; + + 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" + } ; + + +Cardtwelveprefix : Gender -> Str = \g -> + case of { + =>"ba"; + =>"ne"; + <_> => "i" + } ; + +CardThirteenprefix : Gender -> Str = \g -> + case of { + | |=>"bat"; + | | =>"at"; + | =>"is"; + =>"nit"; + =>"at" + } ; + +Cardsixprefix : Gender -> Str = \g -> + case of { + =>"o"; + |=>"bi"; + | || | | | =>"e" + } ; + + Cardfouteenprefix : Gender -> Str = \g -> + case of { + | |=>"bane"; + | | =>"ane"; + | =>"inye"; + =>"ene"; + =>"ene" + } ; + Cardfifteenprefix : Gender -> Str = \g -> + case of { + =>"ba"; + |=>"bi"; + | | =>"a"; + | =>"es"; + =>"e"; + =>"a" + } ; + Ordoneprefix : Gender -> Str = \g -> + case of { + | =>"omo"; + => "rita"; + => "ege"; + => "en"; + => "oro"; + => "aka"; + => "abo"; + => "oko"; + < G10> => "aa" + } ; + } diff --git a/src/egekusii/NounGus.gf b/src/egekusii/NounGus.gf new file mode 100644 index 000000000..3ef6f3cd4 --- /dev/null +++ b/src/egekusii/NounGus.gf @@ -0,0 +1,2 @@ +concrete NounGus of Noun = + CatGus ** NounBantu with (Structural = StructuralGus), (ResBantu = ResGus); diff --git a/src/egekusii/NumeralGus.gf b/src/egekusii/NumeralGus.gf new file mode 100644 index 000000000..b149a1001 --- /dev/null +++ b/src/egekusii/NumeralGus.gf @@ -0,0 +1,86 @@ +concrete NumeralGus of Numeral = CatGus [Numeral,Digits] ** open Prelude, +DiffGus,MorphoGus in { + +lincat + Digit = {s : DForm => CardOrd => Gender => Str} ; + Sub10 = {s : DForm => CardOrd => Gender => Str ; n : Number} ; + Sub100 = {s : CardOrd => Gender => Str ; n : Number} ; + Sub1000 = {s : CardOrd => Gender => Str ; n : Number} ; + Sub1000000 = {s : CardOrd => Gender => Str ; n : Number} ; + +lin num x = x ; +lin n2 = mkNum2 "bere" "kabere" ; +lin n3 = mkNum3 "ato" "gatatu" ; +lin n4 = mkNum4 "ne" "kane" ; +lin n5 = mkNum5 "tano" "gatano" ; +lin n6 = mkNum6 "tano" "mo"; +lin n7 = mkNum7 "tano" "bere"; +lin n8 = mkNum8 "tano" "tato"; +lin n9 = regNum "kianda" ; + +lin pot01 = mkNum1 "mo" "tang'ani" ** {n = Sg} ; +lin pot0 d = d ** {n = Pl} ; +lin pot110 = regCardOrd "ikomi" ** {n = Pl} ; +lin pot111 = regCardone "ikomi na" "mo" ** {n = Pl} ; -- creat another function to be gender specific +lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; +lin pot1plus d e = { s = table { + NCard => \\g => d.s ! ten ! NCard ! g ++ "na"++ e.s ! unit ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ d.s ! ten ! NCard ! g ++ "na"++ e.s ! unit ! NCard ! g } ; + n = Pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hund} ** {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 } ; + n = Pl} ; + lin pot2as3 n = n ; +lin pot3 n = { s = table { + NCard => \\g => mkCard NCard "chilibu" ! g ++ n.s ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ mkCard NCard "chilibu" ! g ++ n.s ! NCard ! g } ; + n = Pl} ; +lin pot3plus n m = { s = table { + NCard => \\g => "chilibu" ++ n.s ! NCard !g ++ m.s ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ "chilibu" ++ n.s ! NCard !g ++ m.s ! NCard ! g} ; + n = Pl} ; + +-- numerals as sequences of digits0' + + lincat + Dig = TDigit ; + + lin + IDig d = d ; + + IIDig d i = { + --s = \\o,g => d.s ! NCard ! g ++ i.s ! o ! g ; + s = table {NCard => \\g => d.s! NCard ! g ++ BIND ++ i.s ! NCard ! g ; + NOrd => \\g => d.s! NOrd! g ++ BIND ++ i.s !NCard! g } ; + n = Pl + } ; + + D_0 = mkDig "0" ; + D_1 = mk3Dig "1" "1" Sg ; + D_2 = mkDig "2" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + + oper + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; + + mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { + s = table {NCard => \\g => c ; NOrd => \\g =>Ordprefix g ++ o} ; + n = n} ; + + TDigit = { + n : Number ; + s : CardOrd => Gender => Str + } ; +} diff --git a/src/egekusii/ParadigmsGus.gf b/src/egekusii/ParadigmsGus.gf new file mode 100644 index 000000000..d3fc779a0 --- /dev/null +++ b/src/egekusii/ParadigmsGus.gf @@ -0,0 +1,437 @@ +--# -path=.:../abstract:../../prelude:../common + +resource ParadigmsGus = open + (Predef=Predef), + Prelude, + MorphoGus, + ResGus, + CatGus + in { + +oper + Gender : Type ; + omo_aba : Gender ;--% + omo_eme : Gender ; + e_ci : Gender ; + eri_ama : Gender ; + ege_ebi : Gender ; + oro_ci : Gender ; + aka_ebi : Gender ; --% + abo_ama : Gender ; + oko_ama : Gender ; + aa : Gender ; + +-- To abstract over number names, we define the following. + + Number : Type ; + + singular : Number ; + plural : Number ; + +-- To abstract over case names, we define the following. + + Case : Type ; --% + + nominative : Case ; --% + locative : Case ; --% + + npNumber : NP -> Number ; -- exctract the number of a noun phrase + + +--2 Nouns + +-- Nouns are constructed by the function $mkN$, which takes a varying +-- number of arguments. + + mkN : overload { + mkN : (flash : Str) -> Gender -> N ; --regular plural + mkN : (man,men : Str) ->Gender -> N ; -- irregular plural + mkN : Str -> N -> N -- e.g. baby + boom compound noun + } ; + +--3 Relational nouns + mkN2 : overload { + mkN2 : N -> Prep -> N2 ; + mkN2 : N -> Str -> N2 ; + mkN2 : N -> N2 ; + mkN2 : N -> (Gender => Number => Str)-> N2 ; + } ; + +oper dfltGender : Gender = G1 ; + dfltNumber : Number = Sg ; + +-- Three-place relational nouns ("the connection from x to y") need two prepositions. + + mkN3 : N -> Prep -> Prep -> N3 ; -- e.g. connection from x to y + + + +--3 Proper names and noun phrases +-- +-- Proper names, with a regular genitive, are formed from strings. + + mkPN : overload { + + mkPN : Str ->Gender -> PN ; + +-- Sometimes a common noun can be reused as a proper name, e.g. "Bank" + + mkPN : N -> PN --% + } ; + +--3 Determiners and quantifiers + + mkOrd : Str -> Ord ; --% + +--2 Adjectives + + mkA : overload { + mkA : (happy : Str) -> A ; + --mkA : (happy : Str) -> A ;-- regular adj, + mkA : (fat,fatter : Str) -> A ; -- irreg. + } ; + + +--3 Two-place adjectives + + mkA2 : overload { + mkA2 : A -> Prep -> A2 ; -- absent from + mkA2 : A -> Str -> A2 ; -- absent from --% + mkA2 : Str -> Prep -> A2 ; -- absent from --% + mkA2 : Str -> Str -> A2 -- absent from --% + + } ; + + +--2 Adverbs + +-- Adverbs are not inflected. Most lexical ones have position +-- after the verb. Some can be preverbal (e.g. "always"). + + mkAdv : Str -> Adv ; -- e.g. today + mkAdV : Str -> AdV ; -- e.g. always + +-- Adverbs modifying adjectives and sentences can also be formed. + + mkAdA : Str -> AdA ; -- e.g. quite + +-- Adverbs modifying numerals + + mkAdN : Str -> AdN ; -- e.g. approximately + +--2 Prepositions + + mkPrep : overload { + mkPrep : Str -> Prep ; + -- mkPrep : Str -> Str -> Prep ; + mkPrep : (Gender => Number => Str) -> Prep ; + } ; + + noPrep : Prep ; -- no preposition + +-- (These two functions are synonyms.) + +--2 Conjunctions +-- + + mkConj : overload { + mkConj : Str -> Conj ; -- and (plural agreement) --% + mkConj : Str -> Number -> Conj ; -- or (agrement number given as argument) --% + mkConj : Str -> Str -> Conj ; -- both ... and (plural) --% + mkConj : Str -> Str -> Number -> Conj ; -- either ... or (agrement number given as argument) --% + } ; + +--2 Verbs +-- + +-- Verbs are constructed by the function $mkV$, which takes a varying +-- number of arguments. + + mkV : overload { + mkV : (cry : Str) -> V ; -- regular, incl. cry-cries, kiss-kisses etc + mkV : Str -> V -> V ; -- fix compound, e.g. under+take + }; + + + + +--3 Two-place verbs +-- +-- Two-place verbs need a preposition, except the special case with direct object. +-- (transitive verbs). Notice that a particle comes from the $V$.-} + + mkV2 : overload { + mkV2 : Str -> V2 ; -- kill --% + mkV2 : V -> V2 ; -- transitive, e.g. hit + mkV2 : V -> Prep -> V2 ; -- with preposiiton, e.g. believe in + mkV2 : V -> Str -> V2 ; -- believe in --% + mkV2 : Str -> Prep -> V2 ; -- believe in --% + mkV2 : Str -> Str -> V2 -- believe in --% + }; + +--3 Three-place verbs +-- +-- Three-place (ditransitive) verbs need two prepositions, of which +-- the first one or both can be absent. + + mkV3 : overload { + mkV3 : V -> V3 ; -- ditransitive, e.g. give,_,_ + mkV3 : V -> Prep -> Prep -> V3 ; -- two prepositions, e.g. speak, with, about + mkV3 : V -> Prep -> V3 ; -- give,_,to --% + mkV3 : V -> Str -> V3 ; -- give,_,to --% + mkV3 : Str -> Str -> V3 ; -- give,_,to --% + mkV3 : Str -> V3 ; -- give,_,_ --% + }; + + +--2 Other categories + +mkSubj : Str -> Subj = \s -> lin Subj {s = s} ; --% +mkInterj : Str -> Interj + = \s -> lin Interj (ss s) ; + +--. +--2 Definitions of paradigms +-- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + + Gender = MorphoGus.Gender ; + Number = MorphoGus.Number ; + Case = MorphoGus.NPCase ; + omo_aba = G1 ; + omo_eme = G2 ; + e_ci = G3 ; + eri_ama = G4 ; + ege_ebi = G5 ; + oro_ci = G6 ; + aka_ebi = G7 ; + abo_ama = G8 ; + oko_ama = G9 ; + aa = G10 ; + singular = Sg ; + plural = Pl ; + nominative = npNom ; + locative = npLoc ; + + npNumber np = (agrFeatures np.a).n ; + + + + regN = MorphoGus.regN ; + iregN = MorphoGus.iregN ; + + + compoundN s n = lin N {s = \\x,y => s ++ n.s ! x ! y ; g=n.g} ; + + mkPN = overload { + mkPN : Str -> Gender -> PN = regPN; + mkPN : N -> PN = nounPN + } ; + + +mkN2 = overload { + mkN2 : N -> Prep -> N2 = prepN2 ; + mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPrep s); + mkN2 : N -> N2 = \n -> prepN2 n (mkPrep mkPrepof ) ; + mkN2 : N -> (Number =>Gender => Str)-> N2= \n,s -> prepN2 n (mkPrep mkPrepof) ; + } ; + + prepN2 = \n,p -> lin N2 (n ** {c2 = p}) ; + regN2 = \n -> (prepN2 n (mkPrep mkPrepof )) ; + mkN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; + mkPrepof : Number => Gender => Str = + table Number { Sg => table { + G1| G2 => "bwo" ; + G3 => "ya"; + G4 => "ria"; + G5 => "kia"; -- + G6 => "rwa"; + G7 => "ka"; + G8 => "bwa"; + G9 => "kwa"; + G10 => "a" + }; + + Pl => table { G1 => "ba" ; + G2 => "ya" ; + G3|G6 => "cia"; + G4 |G8|G9|G10 => "a"; + G5 => "bi"; -- + G7 => "bia"} } ; + + + + + cnN2 : CN -> Prep -> N2 ; + cnN3 : CN -> Prep -> Prep -> N3 ; + +-- This is obsolete. + cnN2 = \n,p -> lin N2 (n ** {c2 = p}) ; + cnN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; + + + regPN n g = lin PN {s = table {Loc => "" ; _ => n} ; g = g} ; + + + nounPN n = lin PN {s = n.s ! singular ; g = n.g} ; + + mkOrd : Str -> Ord = \x -> lin Ord { s =\\g => x}; + + + prepA2 a p = lin A2 (a ** {c2 = p.s!Sg!G1}) ; + + mkAdv x = lin Adv (ss x) ; + mkAdV x = lin AdV (ss x) ; + mkAdA x = lin AdA (ss x) ; + mkAdN x = lin AdN (ss x) ; + + mkPrep = overload { + mkPrep : Str -> Prep = \str -> lin Prep {s = \\n,g => str } ; + mkPrep : (Number => Gender => Str) -> Prep = \t ->lin Prep {s = t} ; + } ; + + noPrep = mkPrep [] ; + {-} mkPrep : Str -> Str -> Prep = \p,q -> lin Prep + {s = table{Sg => table{G1 => p; _=> "" }; + Pl => table{G1 => q; _=> ""}}} ; + prepV2 : V -> Prep -> V2 ; + prepV2 = \v,p -> lin V2 (v ** {c2 = p.s!Sg!G1}) ; + dirV2 : V -> V2 = \v -> prepV2 v noPrep ; + + prepPrepV3 v p q = lin V3 (v ** {c2 = p ; c3 = q}) ; + dirV3 v p = prepPrepV3 v noPrep p ; + dirdirV3 v = dirV3 v noPrep ; + + + mkA2V : A -> Prep -> Prep -> A2V; + A2S, A2V : Type = A2 ; + mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ; + + + mkAV v = v ** { lock_AV = <>} ; + mkAV : A -> AV ; + AS, AV : Type = A ; + + mkAS : A -> AS ; + mkAS v = v ** {lock_AS = <>} ; + + mkVS : V -> VS ; + mkVS v = v ** { lock_VS = <>} ; + + mkVQ : V -> VQ ; + mkVQ v = v ** {lock_VQ = <>} ; + + + -- mkVV : V -> VV ; + -- mkVV v = v ** { lock_VV = <>} ; + + mkVA : V -> VA ; + mkVA v = v ** {lock_VA = <>} ; + + mkV2V : V -> Prep -> Prep -> V2V ; + mkV2V v p q = prepPrepV3 v p q ** {lock_V2V = <>} ; + + mkV2S : V -> Prep -> V2S ; + mkV2S v p = prepV2 v p ** { lock_V2S = <>} ; + + mkV2Q : V -> Prep -> V2Q ; + mkV2Q v p = prepV2 v p ** {lock_V2Q = <>} ; + + mkV2A : V -> Prep -> Prep -> V2A ; + mkV2A v p q = prepPrepV3 v p q ** {lock_V2A = <>} ; + + + mkV0 : V -> V0 ; + V0 : Type ; + V0 : Type = V; + mkV0 v = v ** {lock_V0 = <>} ; +-} +-- pre-overload API and overload definitions + + -- regN : Str ->Gender -> N ; + --iregN : (man,men : Str) ->Gender -> N ; + compoundN : Str -> N -> N ; + + mkN = overload { + mkN : Str ->Gender -> N = \n, g -> lin N (regN n g ); + mkN : (man,men : Str) ->Gender -> N = \s,p,g -> lin N ( iregN s p g) ; + } ; +--mkN : Str -> N -> N = compoundN taken from mkN can be added later if need be +-- Relational nouns ("daughter of x") need a preposition. + + prepN2 : N -> Prep -> N2 ; + +-- The most common preposition is "of", and the following is a +-- shortcut for regular relational nouns with "of". + + regN2 : N -> N2 ; + + + + -- iregA : (free,freely : Str) -> A ; + regA : Str -> A = \s -> lin A (MorphoGus.regA s) ; + -- pregA : Str -> A = \s -> lin A (MorphoGus.pregA s) ; + iregA : (fat,fatter : Str) -> A =\a,b -> lin A (MorphoGus.iregA a b); + mkA = overload { + mkA : Str -> A = \a -> lin A (regA a);-- |lin A (pregA a) ; + mkA : (fat,fatter : Str) -> A =\a,b -> lin A (iregA a b); + } ; + + prepA2 : A -> Prep -> A2 ; + + mkA2 = overload { + mkA2 : A -> Prep -> A2 = prepA2 ; + mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPrep p) ; + mkA2 : Str -> Prep -> A2 = \a,p -> prepA2 (regA a) p; + mkA2 : Str -> Str -> A2 = \a,p -> prepA2 (regA a) (mkPrep p); + } ; + + {-} + regV=MorphoGus.regV ; + + mkV = overload { + mkV : Str -> V =\v ->lin V(regV v) ; + mkV : Str -> V -> V = prefixV + }; + + + prefixV : Str -> V -> V = \p,v -> lin V { s = \\b,vform => p + v.s! b ! vform } ; + mkV2 = overload { + mkV2 : V -> V2 = dirV2 ; + mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; + mkV2 : V -> Prep -> V2 = prepV2; + mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPrep p) ; + mkV2 : Str -> Prep -> V2 = \v,p -> prepV2 (regV v) p ; + mkV2 : Str -> Str -> V2 = \v,p -> prepV2 (regV v) (mkPrep p) + }; + + prepPrepV3 : V -> Prep -> Prep -> V3 ; + dirV3 : V -> Prep -> V3 ; + dirdirV3 : V -> V3 ; + + mkV3 = overload { + mkV3 : V -> Prep -> Prep -> V3 = prepPrepV3 ; + mkV3 : V -> Prep -> V3 = dirV3 ; + mkV3 : V -> Str -> V3 = \v,s -> dirV3 v (mkPrep s); + mkV3 : Str -> Str -> V3 = \v,s -> dirV3 (regV v) (mkPrep s); + mkV3 : V -> V3 = dirdirV3 ; + mkV3 : Str -> V3 = \v -> dirdirV3 (regV v) ; + } ; +-} + mkConj = overload { + mkConj : Str -> Conj = \y -> mk2Conj [] y plural ; + mkConj : Str -> Number -> Conj = \y,n -> mk2Conj [] y n ; + mkConj : Str -> Str -> Conj = \x,y -> mk2Conj x y plural ; + mkConj : Str -> Str -> Number -> Conj = mk2Conj ; + } ; + + mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> + lin Conj (sd2 x y ** {n = n}) ; + + regPN : Str ->Gender -> PN ; + nounPN : N -> PN ; + + + +} diff --git a/src/egekusii/PhraseGus.gf b/src/egekusii/PhraseGus.gf new file mode 100644 index 000000000..3a5cc5406 --- /dev/null +++ b/src/egekusii/PhraseGus.gf @@ -0,0 +1,3 @@ +concrete PhraseGus of Phrase = CatGus ** PhraseBantu with + (ResBantu = ResGus); + \ No newline at end of file diff --git a/src/egekusii/QuestionGus.gf b/src/egekusii/QuestionGus.gf new file mode 100644 index 000000000..071ef7b62 --- /dev/null +++ b/src/egekusii/QuestionGus.gf @@ -0,0 +1,2 @@ +concrete QuestionGus of Question = CatGus ** QuestionBantu with + (ResBantu = ResGus); \ No newline at end of file diff --git a/src/egekusii/RelativeGus.gf b/src/egekusii/RelativeGus.gf new file mode 100644 index 000000000..8d85fe09a --- /dev/null +++ b/src/egekusii/RelativeGus.gf @@ -0,0 +1,2 @@ +concrete RelativeGus of Relative = CatGus ** RelativeBantu with + (ResBantu = ResGus); \ No newline at end of file diff --git a/src/egekusii/ResGus.gf b/src/egekusii/ResGus.gf new file mode 100644 index 000000000..4c81fdd4f --- /dev/null +++ b/src/egekusii/ResGus.gf @@ -0,0 +1,7 @@ +--# -path=.:../abstract:../common:../../prelude + + +instance ResGus of ResBantu = DiffGus, CommonBantu ** open Prelude in { + +} ; + diff --git a/src/egekusii/SentenceGus.gf b/src/egekusii/SentenceGus.gf new file mode 100644 index 000000000..2983fb6d7 --- /dev/null +++ b/src/egekusii/SentenceGus.gf @@ -0,0 +1,3 @@ +concrete SentenceGus of Sentence = CatGus ** SentenceBantu with + (ResBantu = ResGus); + diff --git a/src/egekusii/StructuralGus.gf b/src/egekusii/StructuralGus.gf new file mode 100644 index 000000000..ec401c73b --- /dev/null +++ b/src/egekusii/StructuralGus.gf @@ -0,0 +1,236 @@ +concrete StructuralGus of Structural = CatGus ** + open MorphoGus, ParadigmsGus, + (C = ConstructX), Prelude in { + + flags optimize=all ; + + lin + above_Prep = mkPrep "igoro" ; + after_Prep = mkPrep "itina" ; + all_Predet = {s = \\g => MorphoGus.Allpredetprefix g + "onsi"} ; + almost_AdA = mkAdA "ang'e " ; + almost_AdN = mkAdN "vakuvi " ; + although_Subj = ss "ona kau" ; + always_AdV = mkAdV "botambe " ; + and_Conj = mkConj "na" ; + because_Subj = ss "nundu" | ss "ni kwithiwa" ; + before_Prep = mkPrep "mbee" |mkPrep "vau mbeange" ; + behind_Prep = mkPrep "itina" ; + between_Prep = mkPrep "kati" ; + both7and_DConj = mkConj "eli" "na"; + but_PConj = ss "korende" ; + by8agent_Prep = mkPrep "kwa" ; + by8means_Prep = mkPrep "kwa" ; + + during_Prep = mkPrep "during" ; + either7or_DConj = mkConj "kana" singular ; + everybody_NP = regNP "kila umwe" G1 singular ; + every_Det = {s = table {Obj g => "" ; + Sub => "kila" }; + n= Sg + } ; + + -- mkDeterminerSpec singular "every" "everyone" False ; + everything_NP = regNP "ase oboamo" G1 singular ; --gender confirm + everywhere_Adv = mkAdv "ase oboamo" ; + few_Det = {s = table {Obj g => Few_prefix g + "nini" ; + Sub => [] }; + n= Pl + } ; + -- mkDeterminer plural "few" ; +--- first_Ord = ss "first" ; DEPRECATED + for_Prep = mkPrep "aera" ; + from_Prep = mkPrep "kuma" ; + he_Pron = mkPron "ere" "je" G1 Sg P3 ; + here_Adv = mkAdv "vaa" ; + here7to_Adv = mkAdv ["kuvika vaa"] ; + here7from_Adv = mkAdv ["kuma vaa"] ; + how_IAdv = ss "ata" | ss "nzia myau" ; + how8much_IAdv = ss "mala meana" ; + --how8many_IDet = mkDeterminer plural ["mala meana"] ; + if_Subj = ss "enthwa" ; + in8front_Prep = mkPrep ["mbee wa"] ; + i_Pron =mkPron "inche" "ne" G1 Sg P1 ; + in_Prep = mkPrep "in" ; + it_Pron ={ s=\\c=>"yo"; poss=\\n,g=> ""; a=Ag G4 Sg P3};-- mkPron "yo" ""G4 Sg P3 ; + + less_CAdv = C.mkCAdv "ninangi" "kwi" ; + much_Det, many_Det = { s = table { + Obj g => Many_prefix g + "nge" ; + Sub => []} ; + n= Pl + } ; + more_CAdv = C.mkCAdv "mbeange" "kwi" ; -- more should be a function beccause og Gender + -- most_Predet = {s = \\g => MorphoGus.Mostpredetprefix g + "ingi"} ; + +{-} must_VV = { + s = table { + VVF VInf => ["have to"] ; + VVF VPres => "must" ; + VVF VPPart => ["had to"] ; + VVF VPres2Part => ["having to"] ; + VVF VPast => ["had to"] ; --# notpresent + VVPastNeg => ["hadn't to"] ; --# notpresent + VVPresNeg => "mustn't" + } ; + p = [] ; + typ = VVAux + + } ; -} +---b no_Phr = ss "no" ; + no_Utt = ss "yaya" ; + on_Prep = mkPrep "iulu wa" ; +---- one_Quant = mkDeterminer singular "one" ; -- DEPRECATED + only_Predet = {s = \\g => "tu" } ; + or_Conj = mkConj "kana" singular ; + otherwise_PConj = ss "otherwise" ; +--part_Prep = mkPrep "" ; + please_Voc = ss "ame" ; + part_Prep, possess_Prep = let + questo : ParadigmsGus.Number => MorphoGus.Gender => Str = table { + Sg => \\g=> case of { + | => "bwo" ; + => "ya"; + => "ria"; + => "kia"; -- + => "rwa"; + => "ka"; + => "bwa"; + => "kwa"; + => "a" + }; + + Pl => \\g=> case of{ + => "ba" ; + => "ya" ; + | => "cia"; + ||| => "a"; + => "bi"; -- + => "bia" + } + } + in { s= questo} ; + quite_Adv = mkAdv "o muno" ; + she_Pron = mkPron "ere" "je" G1 Sg P3 ; + + so_AdA = mkAdA "so" ; + somebody_NP = regNP " o mundu " G1 singular ; + someSg_Det = { s = table {Obj g => Some_prefix g ; + Sub => [] } ; + n= Sg + } ; + somePl_Det = {s = table {Obj g => Some_prefix g ; + Sub => [] }; + n= Pl + } ; + something_NP = regNP "o kindu" G1 singular ; --confirm gender + somewhere_Adv = mkAdv "o vandu" ; + that_Quant = let + questo : ParadigmsGus.Number => MorphoGus.Gender => Str = table { + Sg => \\g=> case of { + => "aria"; + => "oria"; + => "riira"; + => "keria"; + => "eria"; + => "roria"; + => "karia"; + => "boria"; + => "koria"; + => "aria" + }; + + Pl => \\g=> case of{ + => "baria" |"abuo"; + => "eria"|"eyio"; + | => "aria"|"ayio"; --confirm gendder 8 + => "baria" |"ebio"; + | => "ciria"|"ecio"; + => "biiraa" |"ebio"; + => "aria" |"eyio"; + => "ayio" + } + + } + in { + s = questo ; + } ; + there_Adv = mkAdv "vau" ; + there7to_Adv = mkAdv "vau" ; + there7from_Adv = mkAdv ["kuma vau"] ; + therefore_PConj = ss "kwoou" ; + they_Pron =mkPron "barabwo" "bo" G1 Pl P3 ; + + this_Quant = let + questo : ParadigmsGus.Number => MorphoGus.Gender => Str = table { + Sg => \\g=> case of { + => "oyo"; + => "oyo"; + => "eri"; + => "eke"; + => "eye"; + => "oro"; + => "aka"; + => "obo"; + => "oko"; + => "aa" + }; + + Pl => \\g=> case of{ + => "aba"; + => "eye"; + => "aya"; + | => "ebi"; + | => "eci"; + | => " aya"; + => "aa" + } + + } + in { + s = questo ; + } ; + through_Prep = mkPrep "kuvitila" ; + too_AdA = mkAdA "too" ; + to_Prep = mkPrep "kuvika" ; + under_Prep = mkPrep "itheo" ; + very_AdA = mkAdA "muno" ; + -- want_VV = mkVV (regV "enda") ; + we_Pron =mkPron "intwe" "ito" G1 Pl P1 ; + + --whatPl_IP = mkIP "ata" "ata" plural ; + -- whatSg_IP = mkIP "ata" "ata" singular ; + when_IAdv = ss "when" ; + when_Subj = ss "when" ; + where_IAdv = ss "where" ; + which_IQuant = {s = \\_ => "which"} ; +---b whichPl_IDet = mkDeterminer plural ["which"] ; +---b whichSg_IDet = mkDeterminer singular ["which"] ; + -- whoPl_IP = mkIP "uu" "whom" "whose" plural ; + -- whoSg_IP = mkIP "who" "whom" "whose" singular ; + why_IAdv = ss "why" ; + without_Prep = mkPrep "nza" ; + with_Prep = mkPrep "vamwe na" ; + --yes_Phr = ss "ii" ; + yes_Utt = ss "eee" ; + youSg_Pron = mkPron "aye" "o" G1 Sg P2 ; + + youPol_Pron,youPl_Pron = mkPron "inwe" "no" G1 Pl P3 ; + not_Predet = {s = \\g => "nongi"} ; + --no_Quant = {s = \\g,n => nonExist} ; + if_then_Conj = mkConj "ethiwa" "indi" singular ; + nobody_NP = regNP "obosa" G1 singular ; + nothing_NP = regNP "obosa" G1 singular ; --confirm gender + + at_least_AdN = mkAdN "at least" ; + at_most_AdN = mkAdN "at most" ; + except_Prep = mkPrep "ate o" ; + as_CAdv = C.mkCAdv "nundu" "ta" ; + + -- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ; + that_Subj = ss "ati" ; + lin language_title_Utt = ss "egekusii" ; + + +} + diff --git a/src/egekusii/VerbGus.gf b/src/egekusii/VerbGus.gf new file mode 100644 index 000000000..6026f09ee --- /dev/null +++ b/src/egekusii/VerbGus.gf @@ -0,0 +1,2 @@ +concrete VerbGus of Verb = CatGus ** VerbBantu with + (ResBantu = ResGus); From 3c76051d8b41c62d35e815500ee45d1343561ea2 Mon Sep 17 00:00:00 2001 From: benson kituku <31066831+kitukb@users.noreply.github.com> Date: Wed, 3 Oct 2018 11:40:26 +0300 Subject: [PATCH 3/4] added kikamba language based on Bantu functor --- src/kikamba/AdjectiveKam.gf | 1 + src/kikamba/AdverbKam.gf | 2 + src/kikamba/CatKam.gf | 2 + src/kikamba/ConjunctionKam.gf | 2 + src/kikamba/DiffKam.gf | 198 ++++++++++++++++ src/kikamba/GrammarKam.gf | 30 +++ src/kikamba/IdiomKam.gf | 48 ++++ src/kikamba/LangKam.gf | 11 + src/kikamba/LexiconKam.gf | 388 ++++++++++++++++++++++++++++++ src/kikamba/MorphoKam.gf | 434 ++++++++++++++++++++++++++++++++++ src/kikamba/NounKam.gf | 2 + src/kikamba/NumeralKam.gf | 85 +++++++ src/kikamba/ParadigmsKam.gf | 429 +++++++++++++++++++++++++++++++++ src/kikamba/PhraseKam.gf | 3 + src/kikamba/QuestionKam.gf | 2 + src/kikamba/RelativeKam.gf | 2 + src/kikamba/ResKam.gf | 7 + src/kikamba/SentenceKam.gf | 3 + src/kikamba/StructuralKam.gf | 231 ++++++++++++++++++ src/kikamba/VerbKam.gf | 2 + 20 files changed, 1882 insertions(+) create mode 100644 src/kikamba/AdjectiveKam.gf create mode 100644 src/kikamba/AdverbKam.gf create mode 100644 src/kikamba/CatKam.gf create mode 100644 src/kikamba/ConjunctionKam.gf create mode 100644 src/kikamba/DiffKam.gf create mode 100644 src/kikamba/GrammarKam.gf create mode 100644 src/kikamba/IdiomKam.gf create mode 100644 src/kikamba/LangKam.gf create mode 100644 src/kikamba/LexiconKam.gf create mode 100644 src/kikamba/MorphoKam.gf create mode 100644 src/kikamba/NounKam.gf create mode 100644 src/kikamba/NumeralKam.gf create mode 100644 src/kikamba/ParadigmsKam.gf create mode 100644 src/kikamba/PhraseKam.gf create mode 100644 src/kikamba/QuestionKam.gf create mode 100644 src/kikamba/RelativeKam.gf create mode 100644 src/kikamba/ResKam.gf create mode 100644 src/kikamba/SentenceKam.gf create mode 100644 src/kikamba/StructuralKam.gf create mode 100644 src/kikamba/VerbKam.gf diff --git a/src/kikamba/AdjectiveKam.gf b/src/kikamba/AdjectiveKam.gf new file mode 100644 index 000000000..331444339 --- /dev/null +++ b/src/kikamba/AdjectiveKam.gf @@ -0,0 +1 @@ +concrete AdjectiveKam of Adjective = CatKam **AdjectiveBantu with (ResBantu = ResKam) ; diff --git a/src/kikamba/AdverbKam.gf b/src/kikamba/AdverbKam.gf new file mode 100644 index 000000000..5d0f2ae16 --- /dev/null +++ b/src/kikamba/AdverbKam.gf @@ -0,0 +1,2 @@ +concrete AdverbKam of Adverb = CatKam **AdverbBantu with + (ResBantu = ResKam); \ No newline at end of file diff --git a/src/kikamba/CatKam.gf b/src/kikamba/CatKam.gf new file mode 100644 index 000000000..4d51ce951 --- /dev/null +++ b/src/kikamba/CatKam.gf @@ -0,0 +1,2 @@ +concrete CatKam of Cat = CommonX - [Pol] + ** CatBantu with (ResBantu = ResKam); diff --git a/src/kikamba/ConjunctionKam.gf b/src/kikamba/ConjunctionKam.gf new file mode 100644 index 000000000..dca83b3e0 --- /dev/null +++ b/src/kikamba/ConjunctionKam.gf @@ -0,0 +1,2 @@ +concrete ConjunctionKam of Conjunction = CatKam ** ConjunctionBantu with + (ResBantu = ResKam); \ No newline at end of file diff --git a/src/kikamba/DiffKam.gf b/src/kikamba/DiffKam.gf new file mode 100644 index 000000000..3d53b88f8 --- /dev/null +++ b/src/kikamba/DiffKam.gf @@ -0,0 +1,198 @@ +instance DiffKam of DiffBantu = open CommonBantu, Prelude in { + +param + GenderKam = G1 | G2 | G3 | G4 | G5 | G6 | G7| G8 | G9 |G10 ; +oper + Gender = GenderKam ; + firstGender = G1 ; secondGender = G2 ; + + conjGender : Gender -> Gender -> Gender = \m,n -> + case m of { G1 => n ; _ => G2 } ; + + ProunSgprefix : Gender -> Str = \g -> + case g of { + G1 | G2|G8 |G9 => "w" ; + G3 | G7 => "y" ; + G4 => "ky" ; + G5 => "k"; + G10 => "kw"; + G6 => "v" + } ; + + ProunPlprefix : Gender -> Str = \g -> + case g of { + G1 | G3 |G8 |G10 => "m" ; + G2 => "y" ; + G4 | G7 |G9 => "sy" ; + G5 => "tw" ; + G6 => "kw" + } ; +Allpredetprefix : Gender -> Str = \g -> + case of { + | | | => "" ; + => "y" ; + | | => "sy" ; + => "two" ; + => "kwo" + } ; + Mostpredetprefix : Gender -> Str = \g -> + case of { + => "ala a" ; + => "ila m" ; + | => "ala ma" ; + | => "ila mb" ; + => "tula twi" ; + => "kula kwi" ; + | => "ila mb" + + } ; +ConsonantAdjprefix: Gender -> Number -> Str = \n,g -> + case of { + => "mu" ; + => "a" ; + => "mu" ; + => "mi" ; + => "i" ; + => "ma" ; + => "ki" ; + => "" ; + => "ka" ; + => "tu" ; + => "va" ; + => "ku" ; + => "" ; + => "mu" ; + => "ma" ; + => "mu" ; + => "" ; + => "ku" ; + => "ma" + } ; + + VowelAdjprefix: Gender -> Number -> Str = \n,g -> + case of { + => "mw" ; + => "a" ; + => "mw" ; + => "mi" ; + => "y" ; + => "ma" ; + => "ky" ; + => "sy" ; + => "ka" ; + => "tw" ; + => "va" ; + => "kw" ; + => "sy" ; + => "mw" ; + <_,_> => "ma" + } ; + Adjpprefix : Gender -> Number -> Str = \n,g -> + case of { + => "wi" ; + => "me" ; + => "wi" ; + => "yi" ; + => "yi" ; + => "me" ; + => "ki" ; + => "syi" ; + => "ke" ; + => "twi" ; + => "ve" ; + => "kwi" ; + => "yi" ; + => "syi"; + <_,_> => "" + } ; + + PrefixPlNom : Gender -> Str = \g -> + case of { + => "a" ; + => "mi" ; + => "i" ; + => "tu"; + => "ku" ; + => [] ; + => "mb" ; + _ => "ma" + + } ; +mkprefix,Ordprefix : Gender -> Str = \g -> + case of { + | | | => "wa" ; + | => "ya" ; + => "kya" ; + => "ka"; + => "kwa"; + => "va" + } ; + Cardprefix : Gender -> Str = \g -> + case of { + | | => "a" ; + | | | | => "i" ; + => "tu" ; + => "ku" + } ; + +Cardoneprefix : Gender -> Str = \g -> + case of { + | | | => "u" ; + => "ki" ; + => "ku" ; + => "yi" ; + => "ka" ; + => "va"; + => "i" + } ; + Cardtwoprefix : Gender -> Str = \g -> + case of { + | | | => "e" ; + | | | => "i" ; + => "twi" ; + => "kwi" + + } ; + + Detprefix : Gender -> Str = \g -> + case of { + | => "a" ; + => "mi" ; + | => "ma" ; + | | => "" ; + => "tu" ; + => "ku" + + } ; + + +--------------------------------------------- + +oper + conjThan = "kuvita" ; + conjThat = "kuvita" ; + + reflPron : Agr => Str = \\ag=> case ag of { + Ag G1 Sg P1 => "nyie" ; + Ag G1 Sg P2 => "we" ; + Ag G1 Sg P3 => "we" ; + Ag _ Sg P3 => "yo" ; + Ag G1 Pl P1 => "ithyi" ; + Ag G1 Pl P2 => "nyui" ; + Ag G1 Pl P3 => "mo" ; + Ag _ _ _ => "" + }; + + superVery ="vyu"; + +param + VForm = VInf + | VPres Gender Number Person + | VPast Gender Number Person + | VFut Gender Number Person + -- | notpresent + ; + + DForm = unit | teen | ten | hund ; + AForm = AAdj Gender Number | AComp Gender Number ; +} diff --git a/src/kikamba/GrammarKam.gf b/src/kikamba/GrammarKam.gf new file mode 100644 index 000000000..60df0ab90 --- /dev/null +++ b/src/kikamba/GrammarKam.gf @@ -0,0 +1,30 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarKam of Grammar = + NounKam, + VerbKam, + AdjectiveKam, + AdverbKam, + NumeralKam, + SentenceKam, + QuestionKam, + RelativeKam, + ConjunctionKam, + PhraseKam, + TextX - [Pol,PPos,PNeg,Pres], + StructuralKam, + IdiomKam, + TenseX - [Pol,PPos,PNeg,Pres] + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text; + +--lin + --PPos = {s = [] ; p = CPos} ; + -- PNeg = {s = [] ; p = CNeg True} ; -- contracted: don't + --PPos = {s = [] ; b = True} ; + -- PNeg = {s = [] ; b = False} ; + -- TPres = {s = [] ; t = ResKam.Pres} ; + -- TPast = {s = [] ; t = ResKam.Past }; + -- TFut = {s = [] ; t = ResKam.Fut }; +} ; diff --git a/src/kikamba/IdiomKam.gf b/src/kikamba/IdiomKam.gf new file mode 100644 index 000000000..b5606fd87 --- /dev/null +++ b/src/kikamba/IdiomKam.gf @@ -0,0 +1,48 @@ +concrete IdiomKam of Idiom = CatKam ** open Prelude, ResKam in { + + flags optimize=all_subs ; +{- + lin + ImpersCl vp = mkClause "it" (agrP3 Sg) vp ; + GenericCl vp = mkClause "one" (agrP3 Sg) vp ; + + CleftNP np rs = mkClause "it" (agrP3 Sg) + (insertObj (\\_ => rs.s ! np.a) + (insertObj (\\_ => np.s ! rs.c) (predAux auxBe))) ; + + CleftAdv ad s = mkClause "it" (agrP3 Sg) + (insertObj (\\_ => conjThat ++ s.s) + (insertObj (\\_ => ad.s) (predAux auxBe))) ; + + ExistNP np = + mkClause "there" (agrP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPAcc) (predAux auxBe)) ; + + ExistIP ip = + mkQuestion (ss (ip.s ! npNom)) + (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ; + + ExistNPAdv np adv = + mkClause "there" (agrP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPAcc ++ adv.s) (predAux auxBe)) ; + + ExistIPAdv ip adv = + mkQuestion (ss (ip.s ! npNom)) + (mkClause "there" (agrP3 ip.n) (insertObj (\\_ => adv.s) (predAux auxBe))) ; + + ProgrVP vp = insertObj (\\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a) (predAux auxBe) ; + + ImpPl1 vp = {s = "let's" ++ infVP VVAux vp Simul CPos (AgP1 Pl)} ; + + ImpP3 np vp = {s = "let" ++ np.s ! NPAcc ++ infVP VVAux vp Simul CPos np.a} ; + + SelfAdvVP vp = insertObj reflPron vp ; + SelfAdVVP vp = insertAdVAgr reflPron vp ; + SelfNP np = { + s = \\c => np.s ! c ++ reflPron ! np.a ; + a = np.a + } ; +} -} + +} + diff --git a/src/kikamba/LangKam.gf b/src/kikamba/LangKam.gf new file mode 100644 index 000000000..29a393291 --- /dev/null +++ b/src/kikamba/LangKam.gf @@ -0,0 +1,11 @@ +--# -path=.:../abstract:../common:../api + +concrete LangKam of Lang = + GrammarKam, + LexiconKam +-- ,ConstructionKam + ** { + + + +} ; diff --git a/src/kikamba/LexiconKam.gf b/src/kikamba/LexiconKam.gf new file mode 100644 index 000000000..80dc84a64 --- /dev/null +++ b/src/kikamba/LexiconKam.gf @@ -0,0 +1,388 @@ +--# -path=.:prelude + +concrete LexiconKam of Lexicon = CatKam ** + open ParadigmsKam,StructuralKam, Prelude in { + +flags + optimize=values ; + +lin + add_V3=regV "ongela" ; +already_Adv= mkAdv "tenange" ; +animal_N=regN "nyamu" n_n ; +answer_V2S=regV "sungia" ; +ashes_N=regN "muu" mu_mi ; +ask_V2Q=regV "kulya" ; +back_N=regN "muongo" mu_mi; +bark_N=regN "ikonde" i_ma ; +become_VA=regV "ithiwa" ; +beg_V2V=regV "voya" ; +belly_N=regN "ivu" i_ma ; +bite_V2=regV "uma" ; +blood_N=regN "nthakame" n_n ; +blow_V=regV "uutana" ; +bone_N=regN "ivindi" i_ma ; +break_V2=regV "vunzya" ; +breast_N=regN "nondo" n_n; +breathe_V=regV "veva" ; +burn_V=regV "vya" ; +close_V2=regV "vinga" ; +cloud_N=regN "ithweo" i_ma ; +come_V=regV "uka" ; +count_V2=regV "tala" ; +cut_V2=regV "tema" ; +day_N=regN "muthenya" mu_mi; +die_V=regV "kw'a" ; +dig_V=regV "inza" ; +do_V2=regV "ika" ; +drink_V2=regV "nyw'a" ; +dull_A=regA "tuku" ; --- check the actual translation +dust_N=regN "kitoo" ki_i; +ear_N=regN "kutu" ku_ma; +earth_N=regN "nthi" n_n; +--easy_A2V=regV "vuthu" ; +eat_V2=regV "ya" ; +egg_N=regN "itumbi" i_ma; +fall_V=regV "valuka" ; +far_Adv=mkAdv"kuasa" ; +fat_N=regN "mauta" i_ma ; +fear_V2=regV "kia" ; +fear_VS=regV "kia" ; +feather_N=regN "iwia" i_ma ; +fight_V2=regV "ukita" ; +find_V2=regV "ona" ; +fingernail_N=regN "waa" u_n; +fire_N=regN "mwaki" mu_mi; +float_V=regV "lela" ; +flow_V=regV "nyunyuluka" ; +flower_N=regN "ilaa" i_ma; +fly_V=regV "uluka" ; +fog_N=regN "muumbi" mu_mi; +foot_N=regN "kuu" ku_ma ; +forest_N=regN "kitheka" ki_i ; +forget_V2=regV "ulwa" ; +freeze_V=regV "thitha" ; +--fun_AV=regV "uthekan'yo" ; +give_V3=regV "nengane" ; +go_V=regV "thi" ; +grass_N=regN "nyeki" n_n ; +guts_N=regN "muluku" mu_mi; +hair_N=regN "nzwii" n_n; +hand_N=iregN "kw'oko" "moko" ku_ma; +hate_V2=regV "mena" ; +head_N=regN "mutw'e" mu_mi ; +hear_V2=regV "iw'a" ; +heart_N=regN "ngoo" n_n; +hit_V2=regV "kima" ; +hold_V2=regV "kwata" ; +hope_VS=regV "ikwatye" ; +horn_N=iregN "uvya" "mbvya" u_n; +hunt_V2=regV "syima" ; +husband_N=regN "muume" mu_a ; +ice_N=iregN "ia" "maia" i_ma; +industry_N= regN "kiwanda" ki_i ; +jump_V=regV "thaanyaku" ; +kill_V2=regV "uua" ; +knee_N=regN "iu" i_ma; +know_V2=regV "manya" ; +know_VQ=regV "manya" ; +know_VS=regV "manya" ; +laugh_V=regV "theka" ; +leaf_N=regN "itu" i_ma; +learn_V2=regV "soma" ; +leather_N=regN "kithuma" ki_i; +leave_V2=regV "tia" ; +lie_V=regV "kenga" ; +like_V2=regV "enda" ; +listen_V2=regV "ithukisye" ; +live_V=regV "ithiwa thayu" ; +liver_N=regN "itema" i_ma; +lose_V2=regV "asya" ; +louse_N=regN "ndaa" n_n; +love_N=regN "wende" u_ma; +love_V2=regV "enda" ; +meat_N=regN "nyama" n_n ; +milk_N=regN "iia" i_ma; +moon_N=regN "mwei" mu_mi; +mountain_N=regN "kiima" ki_i ; +mouth_N=regN "munuka" mu_mi; +music_N=regN "wini" u_ma ; +name_N=regN "isyitwa" i_ma; +neck_N=regN "ngingo" n_n ; +newspaper_N=regN "ikaseti" i_ma ; +night_N=regN "utuku" u_ma; +nose_N=regN "inyuu" i_ma; +now_Adv=mkAdv "yuyu" ; +number_N=regN "utalo" u_ma ; +oil_N=regN "iuta" i_ma ; +open_V2=regV "vingua" ; +paint_V2A=regV "vaka langi" ; +paper_N=regN "ikalatasi" i_ma ; +peace_N=regN "muuo" mu_mi; +pen_N=regN "kiandiki" ki_i; +planet_N=regN "pulaneti" n_n; +plastic_N=regN "pulasitiki" n_n; +play_V=regV "thauka" ; +play_V2=regV "thauka" ; +policeman_N=regN "musikali wa volisi" mu_a ; +priest_N=regN "muthembi" mu_a ; +--probable_AS=regV "" ; +pull_V2=regV "kusya" ; +push_V2=regV "sukuma" ; +put_V2=regV "ikia" ; +queen_N=regN "kiveti kya musumbi" mu_a; +radio_N=regN "rendio" n_n; +rain_N=regN "mbua" n_n ; +rain_V0=regV "ua" ; +read_V2=regV "soma" ; +religion_N=regN "ndini" n_n ; +restaurant_N=regN "uteli" n_n ; +river_N=regN "usi" u_n ; +road_N=regN "nzia" n_n ; +rock_N=regN "ivia" i_ma; +roof_N=regN "kiala" ki_i ; +root_N=regN "mui" mu_mi ; +rope_N=regN "mukwa" mu_mi; +rub_V2=regV "kiitha" ; +rubber_N=regN "kivuti" ki_i ; +run_V=regV "sema" ; +salt_N=regN "munyu" mu_mi; +sand_N=regN "kithangathi" ki_i; +say_VS=regV "asya" ; +school_N=regN "sukulu" n_n; +science_N=regN "sayasi" n_n ; +scratch_V2=regV "thua" ; +sea_N=regN "ukanga" u_ma; +see_V2=regV "ona" ; +seed_N=regN "mbeu" n_n ; +seek_V2=regV "mantha" ; +sell_V3=regV "thoosya" ; +send_V3=regV "tuma" ; +sew_V=regV "tuma" ; +sheep_N=regN "ilondu" i_ma; +ship_N=regN "ngalawa" n_n ; +shoe_N=regN "kiatu" ki_i; +shop_N=regN "nduka" n_n ; +silver_N=iregN "vetha" "vetha" u_n; +sing_V=regV "ina" ; +sister_N=regN "mwiitu-a-inya" mu_a; +sit_V=regV "ikala" ; +skin_N=regN "kikonde" i_ma; +sky_N=regN "yayaya" i_ma ; +sleep_V=regV "koma" ; +smell_V=regV "nyunga" ; +smoke_N=regN "syuki" i_ma; +snake_N=regN "nzoka" n_n ; +snow_N=iregN "ia""maia" i_ma; +sock_N=regN "sokisi" n_n; +song_N=iregN "wathi" "mbathi" u_n; +speak_V2=regV "neena" ; +spit_V=regV "tw'ila" ; +split_V2=regV "tilany'a" ; +squeeze_V2=regV "mitua" ; +stab_V2=regV "tonya" ; +stand_V=regV "ungama" ; +star_N=regN "ndata" n_n; +steel_N=regN "kiaa" ki_i; +stick_N=regN "munzyu" mu_mi ; +stone_N=regN "ivia" i_ma; +stop_V=regV "ungama" ; +stove_N=iregN "iko" "maiko" i_ma; +student_N=regN "musomi" mu_a ; +suck_V2=regV "mumunya" ; +sun_N=regN "syua" i_ma; +swell_V=regV "imba" ; +swim_V=regV "thambia" ; +switch8off_V2=regV "vosya" ; +switch8on_V2=regV "kwatya" ; +table_N=regN "mesa" n_n ; +tail_N=regN "mwithe" mu_mi ; +talk_V3=regV "neena" ; +teacher_N=regN "mumanyisya" mu_a ; +television_N=regN "televesini" n_n ; +think_V=regV "suania" ; +tie_V2=regV "ova" ; +tongue_N=regN "uimi" u_ma ; +train_N=iregN "ngali ya mwaki" "ngali sya mwaki" n_n ; +travel_V=regV "thi" ; +turn_V=regV "alyula" ; +understand_V2=regV "elewa" ; +university_N=regN "nyunivasiti" n_n; +village_N=regN "ndua" n_n ; +vomit_V=regV "tavika" ; +wait_V2=regV "eteela" ; +walk_V=regV "tembea" ; +war_N=regN "kau" u_ma; +wash_V2=regV"thamba" ; +watch_V2=regV "syaiisya" ; +water_N=regN "kiwu" ki_i; +wide_A=regA "aamu" ; +win_V2=regV "shinda" ; +wind_N=regN "kiseve" ki_i; +window_N=regN "mbuthi" n_n; +wine_N=regN "mbinyu" n_n ; +wing_N=regN "uthwau" u_ma; +leg_N = regN "kuu" ku_ma; +wipe_V2=regV "vangula" ; +wonder_VQ=regV "senga" ; +wood_N=iregN "uku" "nguku" u_n; +write_V2=regV "andika" ; +year_N=regN "mwaka" mu_mi; + hill_N =regN "kiima" ki_i; + king_N= regN "musumbi" mu_a; + brother_N2 = mkN2 (mkN "mwana inya" mu_a) ; + father_N2 = mkN2 (mkN "nau" "nau"mu_a) mkPrepof ; + mother_N2 = mkN2 (mkN "mwaitu" mu_a) mkPrepof; + person_N = regN "mundu" mu_a ; + woman_N =regN "kiveti" ki_i ; + house_N = regN "nyumba" n_n ; + tree_N = regN "muti" mu_mi ; + big_A = regA "nene" ; + beautiful_A = regA "nake" ; + black_A = regA "iu" ; + + broad_A = regA "amu" ; + brown_A = cregA " kaki" ; + clean_A = regA "theu" ; + clever_A = regA "ui" ; + cold_A = regA "thithu" ; + correct_A = regA "seo" ; + dry_A = regA "nyau" ; + full_A = regA "usuu" ; + good_A = regA "seo" ; + heavy_A = regA "ito" ; + important_A = regA "vata" ; + long_A = regA "asa" ; + narrow_A = regA "theke" ; + near_A = regA "kuvi" ; + new_A = regA "sau" ; + old_A = regA "kuu" ; + red_A = regA "tune" ; + rotten_A = regA "oou" ; + round_A = regA "thyululu" ; + sharp_A = regA "ui" ; + short_A = regA "kuvi"; + smooth_A = regA "mbinyu" ; + straight_A = regA "laini" ; + stupid_A = regA "tumanu" ; + thick_A = regA "amu" ; + thin_A = regA "theke" ; + ugly_A = regA "thuku" ; + warm_A = regA "utea" ; + wet_A = regA "iu" ; + white_A = regA "eu" ; + yellow_A = cregA "nyelo" ; + young_A = regA "nini"; + + small_A = regA "nini" ; + shirt_N= iregN "sati" "sati" n_n; + cow_N = regN "ngombe" n_n ; + doctor_N = regN "muiiti" mu_a ; + dog_N = regN "ngiti" n_n ; + door_N = regN " muomo" mu_mi ; + enemy_N = regN "muthiny'a" mu_a ; + fish_N = regN "ikuyu" i_ma ; + friend_N = regN "munyanya" mu_a ; + garden_N = regN "muunda" mu_mi ; + girl_N = regN "mwiitu" mu_a ; +lamp_N = iregN "taa" "taa" n_n ; + man_N = regN " muume" mu_a ; +eye_N = regN "iitho" i_ma ; +tooth_N = regN "ieo" i_ma ; +wife_N = regN "muka" mu_a ; +left_Ord = mkOrd "kwoko kwa aka" ; + right_Ord = mkOrd "lungalu" |mkOrd "ailu" ; + grammar_N = regN "ngulama" n_n ; + language_N = regN "kithiomo" ki_i ; + rule_N = regN "mwiao" mu_mi ; + married_A2 = mkA2 (regA "twae") "ni" ; + airplane_N = regN "ndeke" n_n; + alas_Interj = ss "asi" ; + answer_V2S = regV "sungia" ; + apartment_N = regN "nyumba" n_n; + apple_N = regN "avuu" i_ma ; + art_N = regN "ithaa" i_ma ; + ask_V2Q = regV "kulya" ; + baby_N = regN "kana" ka_tu; + bad_A = regA "thuku" ; + bank_N = regN "vengi" n_n ; + beer_N = regN "nzovi" n_n ; + big_A = regA "nene" ; + bike_N = regN "kisululu" ki_i ; + bird_N = regN "nyunyi" n_n; + black_A = regA "iu" ; + blue_A = cregA "waiyu" ; + boat_N = regN "italu" i_ma; + book_N = regN "ivuku" i_ma ; + boot_N = regN "mbuti" n_n ; + boss_N = regN "munene" mu_a ; + boy_N = regN "kivisi" ki_i ; + bread_N = regN "mukate" mu_mi ; + butter_N = regN "kimoesyo" ki_i ; + buy_V2 = regV "ua" ; + camera_N = regN "kamela" n_n; + cap_N = regN "kakovila" ka_tu ; + car_N = regN "mutokaa" mu_mi ; + carpet_N = regN "mukeka" mu_mi ; + cat_N = regN "mbaka" n_n ; + ceiling_N = regN "kisumba" ki_i ; + chair_N = regN "kivila" ki_i ; + cheese_N = regN "iuta" i_ma ; + child_N = iregN "mwana" "syana" mu_a ; + church_N = regN "ikanisa" i_ma; + city_N = regN "musyi" mu_mi; + clean_A = regA "theu" ; + clever_A = regA "ui" ; + coat_N = regN "ikoti" i_ma; + computer_N = regN "kombyuta" n_n ; + country_N = regN "nthi" n_n; + cousin_N = regN "mwendw'asa" mu_a | regN "mwana a mwendya" mu_a ; + dirty_A = iregA "kiko" "kiko" ; + dog_N = regN "ngiti" n_n; + empty_A = regA "thei" ; + factory_N = regN "kithii" ki_i ; + fish_N = regN "ikuyu" i_ma ; + floor_N = iregN "nginyo" "nginyo" n_n ; + fridge_N = regN "frinji" n_n ; + friend_N = regN "munyanya"mu_a ; + fruit_N = regN "itunda" i_ma ; + --fun_AV = mkAV (regA "fun") ; + garden_N = regN "muunda" mu_mi; + girl_N = regN "mwiitu" mu_a ; + glove_N = regN "ngloovu" n_n; + gold_N = regN "thaavu" n_n; + good_A = regA "seo" ; + green_A = cregA "matu" ; + harbour_N = regN "kilindi" ki_i ; + hat_N = regN "ngovia" n_n; + hill_N = regN "kiima" ki_i; + horse_N = regN "mbalasi" n_n ; + hot_A = regA "latiku" ; + house_N = regN "nyumba" n_n; + important_A = regA "vata" ;--check + iron_N = regN "kyuma" ki_i ; + lake_N = regN "ia" i_ma; + teach_V2 = regV "somethya"; + throw_V2 = regV "isya"; + + +-- added 4/6/2007 + paris_PN = regPN "Paris" va_ku ; -- this is alreay name of place avoid kwa + john_PN = regPN "Yoana" mu_a ; + question_N = regN "Ikulyo" i_ma ; + ready_A = regA "ready" ; + reason_N = regN "kitumi" ki_i ; + today_Adv = mkAdv "umuthi" ; + uncertain_A = regA "uncertain" ; + distance_N3 = mkN3 (mkN "muendo" mu_mi ) fromP toP ; + +oper + aboutP = mkPrep "undu wa" ; + atP = mkPrep "vala ve" ; + forP = mkPrep "for" ; + fromP = mkPrep "kuma" ; + inP = mkPrep "thini" ; + onP = mkPrep "iulu" ; + toP = mkPrep "kuvika" ; + -- ofp = possess_Prep.sp ; +} ; diff --git a/src/kikamba/MorphoKam.gf b/src/kikamba/MorphoKam.gf new file mode 100644 index 000000000..e68bc9cb0 --- /dev/null +++ b/src/kikamba/MorphoKam.gf @@ -0,0 +1,434 @@ +--# -path=.:../../prelude + +--Kikamba Resource Morphology +-- +-- Benson Kituku 2017 -- 2018 + +resource MorphoKam = CommonBantu ,ResKam ** open Prelude, Predef +in { + + flags optimize=all ; + + oper + mkDet: (i, mine : Str) -> Number -> {s : DetForm => Str ; n : Number} = + \i,mine, m -> + { s = table { + Sub => i; + Obj g => Detprefix g + mine} ; + n = m } ; + + + Detsomesgprefix : Gender -> Str = \g -> + case of { + | | | => "u" ; + => "yi" ; + => "ki" ; + => "ka" ; + => "ku" ; + => "va" ; + => "i" + } ; + +Detsomeplprefix : Gender -> Str = \g -> + case of { + | | | => "a" ; + => "i" ; + => "i" ; + => "tu" ; + => "ku" ; + | => "i" + + } ; + + + + mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, twelve, twenty, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikumi na" ++ twelve ; + NOrd => \\g => Ordprefix g ++ "ikumi na" ++ twelve} ; + ten => table {NCard =>\\g =>"miongo " ++ twelve ; + NOrd => \\g => Ordprefix g ++ "miongo" ++ twelve}; + hund => table {NCard =>\\g =>"maana " ++ twenty ; + NOrd => \\g => Ordprefix g ++ "maana" ++ twenty} + } + } ; + + mkNumn : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, twelve, twenty, second -> + {s = table { + unit => table {NCard =>\\g => Cardtwoprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikumi na" ++ twelve ; + NOrd => \\g => Ordprefix g ++ "ikumi na" ++ twelve} ; + ten => table {NCard =>\\g =>"miongo " ++ twelve ; + NOrd => \\g => Ordprefix g ++ "miongo" ++ twelve}; + hund => table {NCard =>\\g =>"maana " ++ twenty ; + NOrd => \\g => Ordprefix g ++ "maana" ++ twenty} + } + } ; + + mkNume : Str -> Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, twenty, second -> + {s = table { + unit => table {NCard =>\\g => Cardoneprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"ikumi na" ++ Cardoneprefix g + two ; + NOrd => \\g => Ordprefix g ++ "ikumi na" ++ Cardoneprefix g + two} ; + ten => table {NCard =>\\g =>"ikumi" ; + NOrd => \\g => Ordprefix g ++ "ikumi"}; + hund => table {NCard =>\\g =>"yiana " ++ twenty ; + NOrd => \\g => Ordprefix g ++ "yiana" ++ twenty} + } + } ; + + regNum : Str -> {s : DForm => CardOrd => Gender => Str} = + \six -> {s = table { + unit => table {NCard =>\\g => six ; + NOrd => \\g => Ordprefix g ++ six} ; + teen => table {NCard =>\\g =>"ikumi na" ++ six ; + NOrd => \\g => Ordprefix g ++ "ikumi na" ++ six} ; + ten => table {NCard =>\\g =>"miongo " ++ six ; + NOrd => \\g => Ordprefix g ++ "miongo" ++ six}; + hund => table {NCard =>\\g =>"maana " ++ six ; + NOrd => \\g => Ordprefix g ++ "maana" ++ six} + } } ; + + + regCardOrd : Str -> {s : CardOrd => Gender => Str} = \ten -> + {s = table {NCard => \\g => ten ; + NOrd =>\\g => Ordprefix g ++ ten } } ; + + regCardone : Str -> Str -> {s : CardOrd => Gender => Str} = \ten,one -> + {s = table {NCard => \\g => ten ++ Cardoneprefix g + one ; + NOrd =>\\g => Ordprefix g ++ ten ++ Cardoneprefix g + one } } ; + + mkCard : CardOrd -> Str -> Gender => Str = \o,ten -> + (regCardOrd ten).s ! o ; + + + regN : Str ->Gender -> Noun = \w, g -> let wpl = case g of { + G1=>case w of { + "mwa" + _ => Predef.drop 2 w ; + "mwi" + _ => "e" + Predef.drop 3 w ; + _ => PrefixPlNom G1 + Predef.drop 2 w }; + + G2=>case w of { + "mw" + _ => "my" + Predef.drop 2 w ; + _ => PrefixPlNom G2 + Predef.drop 2 w }; + G3 => PrefixPlNom G3 + Predef.drop 1 w; + G4=> case w of { + "ky" + _ => "sy" + Predef.drop 2 w ; + _ => PrefixPlNom G4 + Predef.drop 2 w }; + G5 => PrefixPlNom G5 + Predef.drop 2 w; + G6 => PrefixPlNom G6 + Predef.drop 2 w; + G8 => PrefixPlNom G8 + w; + G9 => PrefixPlNom G9 + w ; + G10 => PrefixPlNom G10 + Predef.drop 2 w; + G7 => w }; + in iregN w wpl g ; + + + + + + iregN :Str-> Str ->Gender -> Noun= \man,men,g -> { -- for irregular noun + s = table{Sg => table{Nom => man ; + Loc=> man + "ni" | men + "ni" }; + Pl => table{Nom => men ; Loc=> ""}} ; + g = g + } ; + regA:Str -> {s : AForm => Str} = \seo -> {s = table { + AAdj G1 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"o" => "mw" + seo; + "u" => "m" + seo; + _ => ConsonantAdjprefix G1 Sg + seo }; + AAdj G1 Pl =>case Predef.take 1 seo of { + "u" => "o" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G1 Pl + seo }; + + AAdj G2 Sg=>case Predef.take 1 seo of { + "i" => "mw" + seo; + "a" => "my" + seo; + "u" => "m" + seo; + _ => ConsonantAdjprefix G2 Sg + seo }; + AAdj G2 Pl =>case Predef.take 1 seo of { + "u" => "my" + seo; + "i" => "m" + seo; + _ => ConsonantAdjprefix G2 Pl + seo }; + + AAdj G3 Sg=>case Predef.take 1 seo of { + "i"|"u" => "y" + seo; + "a" => "yi" + seo; + _ => ConsonantAdjprefix G3 Sg + seo }; + AAdj G3 Pl =>case Predef.take 1 seo of { + "u" => "mo"+ Predef.drop 1 seo; + _ => ConsonantAdjprefix G3 Pl + seo }; + + + AAdj G4 Sg=>case Predef.take 1 seo of { + "i" => "k" + seo; + "u" |"a" => "ky" + seo; + _ => ConsonantAdjprefix G4 Sg + seo }; + AAdj G4 Pl =>case Predef.take 1 seo of { + "u" => "mb"+ seo; + "i" => "sy" + seo; + "a" => "nd" + seo; + _ => ConsonantAdjprefix G4 Pl + seo }; + AAdj G5 Sg=>case Predef.take 1 seo of { + "u" => "ko" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G5 Sg + seo }; + AAdj G5 Pl =>case Predef.take 1 seo of { + "u" => "t"+ seo; + "a" | "i" => "tw" + seo; + _ => ConsonantAdjprefix G5 Pl + seo }; + + AAdj G6 Sg=>case Predef.take 1 seo of { + "u" => "vo" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G6 Sg + seo }; + AAdj G6 Pl =>case Predef.take 1 seo of { + "u" => "k" + seo; + "i"|"a" => "kw" + seo; + _ => ConsonantAdjprefix G6 Pl + seo }; + + AAdj G7 n =>case Predef.take 1 seo of { + "s" |"i" => "nz" + seo; + "v" | "u" => "mb" + seo; + "k" => "ng" + seo; + "t" | "a" => "nd" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G7 n + seo }; + + AAdj G9 Pl =>case Predef.take 1 seo of { + "s" |"i" => "nz" + seo; + "v" | "u" => "mb" + seo; + "k" => "ng" + seo; + "t" | "a" => "nd" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G9 Pl + seo }; + AAdj G10 Sg =>case Predef.take 1 seo of { + "u" => "k" + seo; + "i"|"a" => "kw" + seo; + _ => ConsonantAdjprefix G10 Sg + seo }; + + AAdj g Pl =>case Predef.take 1 seo of { + "u" => "mo" + Predef.drop 1 seo; + _ => ConsonantAdjprefix g Pl + seo }; + AAdj g Sg=>case Predef.take 1 seo of { + "i" => "mw" + seo; + "a" => "my" + seo; + "u" => "m" + seo; + _ => ConsonantAdjprefix g Sg + seo }; + AComp G1 Sg=>let af : Str = case Predef.take 1 seo of { + "a"|"e"|"i"|"o" => "mw" + seo; + "u" => "m" + seo; + _ => ConsonantAdjprefix G1 Sg + seo }; + in init af + "ang" + last af; + AComp G1 Pl =>let af : Str = case Predef.take 1 seo of { + "u" => "o" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G1 Pl + seo } + in init af + "ang" + last af; + + + AComp G2 Sg=>let af : Str = case Predef.take 1 seo of { + "i" => "mw" + seo; + "a" => "my" + seo; + "u" => "m" + seo; + _ => ConsonantAdjprefix G2 Sg + seo }; + in init af + "ang" + last af; + AComp G2 Pl =>let af : Str = case Predef.take 1 seo of { + "u" => "my" + seo; + "i" => "m" + seo; + _ => ConsonantAdjprefix G2 Pl + seo } + in init af + "ang" + last af; + + AComp G3 Sg=>let af : Str = case Predef.take 1 seo of { + "i"|"u" => "y" + seo; + "a" => "yi" + seo; + _ => ConsonantAdjprefix G3 Sg + seo }; + in init af + "ang" + last af; + AComp G3 Pl =>let af : Str = case Predef.take 1 seo of { + "u" => "mo"+ Predef.drop 1 seo; + _ => ConsonantAdjprefix G3 Pl + seo } + in init af + "ang" + last af; + + AComp G4 Sg=>let af : Str = case Predef.take 1 seo of { + "i" => "k" + seo; + "u" => "ky" + seo; + _ => ConsonantAdjprefix G4 Sg + seo }; + in init af + "ang" + last af; + AComp G4 Pl =>let af : Str = case Predef.take 1 seo of { + "u" => "mb"+ seo; + "i" => "sy" + seo; + "a" => "nd" + seo; + _ => ConsonantAdjprefix G4 Pl + seo } + in init af + "ang" + last af; + AComp G5 Sg=>let af : Str = case Predef.take 1 seo of { + "u" => "ko" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G5 Sg + seo }; + in init af + "ang" + last af; + AComp G5 Pl =>let af : Str = case Predef.take 1 seo of { + "u" => "t"+ seo; + "a" | "i" => "tw" + seo; + _ => ConsonantAdjprefix G5 Pl + seo } + in init af + "ang" + last af; + + AComp G6 Sg=>let af : Str = case Predef.take 1 seo of { + "u" => "vo" + Predef.drop 1 seo; + _ => ConsonantAdjprefix G6 Sg + seo }; + in init af + "ang" + last af; + AComp G6 Pl =>let af : Str = case Predef.take 1 seo of { + "u" => "k" + seo; + "i"|"a" => "kw" + seo; + _ => ConsonantAdjprefix G6 Pl + seo } + in init af + "ang" + last af; + + AComp G7 n =>let af : Str = case Predef.take 1 seo of { + "s" |"i" => "nz" + seo; + "v" | "u" => "mb" + seo; + "k" => "ng" + seo; + "t" | "a" => "nd" + seo; + _ => ConsonantAdjprefix G7 n + seo }; + in init af + "ang" + last af; + +AComp G9 Pl =>let af : Str = case Predef.take 1 seo of { + "s" |"i" => "nz" + seo; + "v" | "u" => "mb" + seo; + "k" => "ng" + seo; + "t" | "a" => "nd" + seo; + _ => ConsonantAdjprefix G9 Pl + seo }; + in init af + "ang" + last af; + AComp G10 Sg =>let af : Str = case Predef.take 1 seo of { + "u" => "k" + seo; + "i"|"a" => "kw" + seo; + _ => ConsonantAdjprefix G10 Sg + seo } + in init af + "ang" + last af; + AComp g Pl => let af : Str = case Predef.take 1 seo of { + "u" => "mo" + Predef.drop 1 seo; + _ => ConsonantAdjprefix g Pl + seo } + in init af + "ang" + last af; + + AComp g Sg=>let af : Str = case Predef.take 1 seo of { + "i" => "mw" + seo; + "a" => "my" + seo; + "u" => "m" + seo; + _ => ConsonantAdjprefix g Sg + seo }; + in init af + "ang" + last af + + } }; + + + +iregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { + s = table { + AAdj g Sg => seo; + AAdj g Pl=> seoo ; + AComp g Sg => init seo + "ang" + last seo; + AComp g Pl => init seoo + "ang" + last seoo} + + } ; + +--regular expression for adjective colours + cregA : Str-> {s : AForm => Str} = \seo -> { + s = table { + AAdj g Sg => ProunSgprefix g + "a" ++"langi" ++"wa" ++ seo; + AAdj g Pl=> ProunPlprefix g + "a" ++"langi" ++"wa" ++ seo; + AComp g n => ""} } ; + +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 + } + }; + }; + + 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} ; + + 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" + +}; + + + + + + + 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" ; + <_,Sg,_> => "ya" ; + <_,Pl,_> => "sya" + } ; + + 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" ; + <_,Sg,_> => "ika" ; + <_,Pl,_> => "ika" + } ; +} + + + diff --git a/src/kikamba/NounKam.gf b/src/kikamba/NounKam.gf new file mode 100644 index 000000000..5221c50d3 --- /dev/null +++ b/src/kikamba/NounKam.gf @@ -0,0 +1,2 @@ +concrete NounKam of Noun = CatKam ** + NounBantu with (Structural = StructuralKam), (ResBantu = ResKam) ; diff --git a/src/kikamba/NumeralKam.gf b/src/kikamba/NumeralKam.gf new file mode 100644 index 000000000..d66ae9192 --- /dev/null +++ b/src/kikamba/NumeralKam.gf @@ -0,0 +1,85 @@ +concrete NumeralKam of Numeral = CatKam [Numeral,Digits] ** open Prelude,CommonBantu,DiffKam, MorphoKam in { + +lincat + Digit = {s : DForm => CardOrd => Gender => Str} ; + Sub10 = {s : DForm => CardOrd => Gender => Str ; n : Number} ; + Sub100 = {s : CardOrd => Gender => Str ; n : Number} ; + Sub1000 = {s : CardOrd => Gender => Str ; n : Number} ; + Sub1000000 = {s : CardOrd => Gender => Str ; n : Number} ; + +lin num x = x ; +lin n2 = mkNumn "li" "ili" "eli" "keli" ; +lin n3 = mkNum "tatu" "itatu" " atatu" "katatu" ; +lin n4 = mkNum "nya" "ina" "ana" "kana" ; +lin n5 = mkNum "tano" "itano" "atano" "katano" ; +lin n6 = regNum "nthathatu" ; +lin n7 = regNum "muonza" ; +lin n8 = regNum "nyanya" ; +lin n9 = regNum "kenda" ; + +lin pot01 = mkNume "mwe" " yimwe" "mbee" ** {n = Sg} ; +lin pot0 d = d ** {n = Pl} ; +lin pot110 = regCardOrd "ikumi" ** {n = Pl} ; +lin pot111 = regCardone "ikumi na" "mwe" ** {n = Pl} ; +lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; +lin pot1plus d e = { s = table { + NCard => \\g => d.s ! ten ! NCard ! g ++ "na"++ e.s ! unit ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ d.s ! ten ! NCard ! g ++ "na"++ e.s ! unit ! NCard ! g } ; + n = Pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hund} ** {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 } ; + n = Pl} ; + lin pot2as3 n = n ; +lin pot3 n = { s = table { + NCard => \\g => mkCard NCard "ngili" ! g ++ n.s ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ mkCard NCard "ngili" ! g ++ n.s ! NCard ! g } ; + n = Pl} ; +lin pot3plus n m = { s = table { + NCard => \\g => "ngili" ++ n.s ! NCard !g ++ m.s ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ "ngili" ++ n.s ! NCard !g ++ m.s ! NCard ! g} ; + n = Pl} ; + +-- numerals as sequences of digits0' + + lincat + Dig = TDigit ; + + lin + IDig d = d ; + + IIDig d i = { + s = table {NCard => \\g => d.s! NCard ! g ++ BIND ++ i.s ! NCard ! g ; + NOrd => \\g => d.s! NOrd! g ++ BIND ++ i.s !NCard! g } ; + n = Pl + } ; + + D_0 = mkDig "0" ; + D_1 = mk3Dig "1" "1" Sg ; + D_2 = mkDig "2" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + + oper + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; + + mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { + s = table {NCard => \\g => c ; NOrd => \\g =>Ordprefix g ++ o} ; --Ordprefix g ++ + n = n} ; + + TDigit = { + n : Number ; + s : CardOrd => Gender => Str + } ; + +} diff --git a/src/kikamba/ParadigmsKam.gf b/src/kikamba/ParadigmsKam.gf new file mode 100644 index 000000000..a47bb8e07 --- /dev/null +++ b/src/kikamba/ParadigmsKam.gf @@ -0,0 +1,429 @@ +--# -path=.:../abstract:../../prelude:../common + +resource ParadigmsKam = open + (Predef=Predef), + Prelude, + MorphoKam, + ResKam, + CatKam + in { + +oper + Gender : Type ; + mu_a : Gender ; + mu_mi : Gender ; + i_ma : Gender ; + ki_i : Gender ; + ka_tu : Gender ; + va_ku : Gender ; + n_n : Gender ; + u_ma : Gender ; + u_n : Gender ; + ku_ma : Gender ; + + Number : Type ; + singular : Number ; + plural : Number ; + + + + Case : Type ; + + nominative : Case ; + locative : Case ; + npNumber : NP -> Number ; -- exctract the number of a noun phrase + + +--2 Nouns + + mkN : overload { + mkN : (flash : Str) -> Gender -> N ; --regular plural + mkN : (man,men : Str) ->Gender -> N ; -- irregular plural + mkN : Str -> N -> N + } ; + +--3 Relational nouns + mkN2 : overload { + mkN2 : N -> Prep -> N2 ; + mkN2 : N -> Str -> N2 ; + mkN2 : N -> N2 ; + mkN2 : N -> (Gender => Number => Str)-> N2 ; + } ; + +oper dfltGender : Gender = G1 ; + dfltNumber : Number = Sg ; + +-- Three-place relational nouns ("the connection from x to y") need two prepositions. + + mkN3 : N -> Prep -> Prep -> N3 ; -- e.g. connection from x to y + + + +--3 Proper names and noun phrases +-- +-- Proper names, with a regular genitive, are formed from strings. + + mkPN : overload { + + mkPN : Str ->Gender -> PN ; + +-- Sometimes a common noun can be reused as a proper name, e.g. "Bank" + + mkPN : N -> PN --% + } ; + +--3 Determiners + + mkOrd : Str -> Ord ; --% + +--2 Adjectives + + mkA : overload { + mkA : (happy : Str) -> A ; + mkA : (fat,fatter : Str) -> A ; -- irreg. + } ; + + +--3 Two-place adjectives + + mkA2 : overload { + mkA2 : A -> Prep -> A2 ; + mkA2 : A -> Str -> A2 ; + mkA2 : Str -> Prep -> A2 ; + mkA2 : Str -> Str -> A2 + } ; + + +--2 Adverbs + +-- Adverbs are not inflected. Most lexical ones have position +-- after the verb. Some can be preverbal (e.g. "always"). + + mkAdv : Str -> Adv ; -- e.g. umuthi + mkAdV : Str -> AdV ; -- e.g. lila + +-- Adverbs modifying adjectives and sentences can also be formed. + + mkAdA : Str -> AdA ; -- e.g. pi + +-- Adverbs modifying numerals + + mkAdN : Str -> AdN ; -- e.g. approximately + +--2 Prepositions + + mkPrep : overload { + mkPrep : Str -> Prep ; + mkPrep : (Gender => Number => Str) -> Prep ; + } ; + + noPrep : Prep ; -- no preposition + +--2 Conjunctions +-- + + mkConj : overload { + mkConj : Str -> Conj ; -- and (plural agreement) --% + mkConj : Str -> Number -> Conj ; -- or (agrement number given as argument) --% + mkConj : Str -> Str -> Conj ; -- both ... and (plural) --% + mkConj : Str -> Str -> Number -> Conj ; -- either ... or (agrement number given as argument) --% + } ; + +--2 Verbs +-- + +-- Verbs are constructed by the function $mkV$, which takes a varying +-- number of arguments. + + mkV : overload { + mkV : (cry : Str) -> V ; -- regular, incl. cry-cries, kiss-kisses etc + mkV : Str -> V -> V ; -- fix compound, e.g. under+take + }; + + + + +--3 Two-place verbs +-- +-- Two-place verbs need a preposition, except the special case with direct object. +-- (transitive verbs). Notice that a particle comes from the $V$.-} + + mkV2 : overload { + mkV2 : Str -> V2 ; -- kill --% + mkV2 : V -> V2 ; -- transitive, e.g. hit + mkV2 : V -> Prep -> V2 ; -- with preposiiton, e.g. believe in + mkV2 : V -> Str -> V2 ; -- believe in --% + mkV2 : Str -> Prep -> V2 ; -- believe in --% + mkV2 : Str -> Str -> V2 -- believe in --% + }; + +--3 Three-place verbs +-- +-- Three-place (ditransitive) verbs need two prepositions, of which +-- the first one or both can be absent. + + mkV3 : overload { + mkV3 : V -> V3 ; -- ditransitive, e.g. give,_,_ + mkV3 : V -> Prep -> Prep -> V3 ; -- two prepositions, e.g. speak, with, about + mkV3 : V -> Prep -> V3 ; -- give,_,to --% + mkV3 : V -> Str -> V3 ; -- give,_,to --% + mkV3 : Str -> Str -> V3 ; -- give,_,to --% + mkV3 : Str -> V3 ; -- give,_,_ --% + }; + + +--2 Other categories + +mkSubj : Str -> Subj = \s -> lin Subj {s = s} ; --% +mkInterj : Str -> Interj + = \s -> lin Interj (ss s) ; + +--. +--2 Definitions of paradigms +-- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + + Gender = MorphoKam.Gender ; + Number = MorphoKam.Number ; + Case = MorphoKam.NPCase ; + mu_a = G1 ;--% + mu_mi = G2 ; + i_ma = G3 ; + ki_i = G4 ; + ka_tu = G5 ; + va_ku = G6 ; + n_n = G7 ; + u_ma = G8; + u_n =G9 ; + ku_ma = G10 ; + singular = Sg ; + plural = Pl ; + nominative = npNom ; + locative = npLoc ; + + npNumber np = (agrFeatures np.a).n ; + + + + regN = MorphoKam.regN ; + iregN = MorphoKam.iregN ; + + + compoundN s n = lin N {s = \\x,y => s ++ n.s ! x ! y ; g=n.g} ; + + mkPN = overload { + mkPN : Str -> Gender -> PN = regPN; + mkPN : N -> PN = nounPN + } ; + + +mkN2 = overload { + mkN2 : N -> Prep -> N2 = prepN2 ; + mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPrep s); + mkN2 : N -> N2 = \n -> prepN2 n (mkPrep mkPrepof ) ; + mkN2 : N -> (Number =>Gender => Str)-> N2= \n,s -> prepN2 n (mkPrep mkPrepof) ; + } ; + + prepN2 = \n,p -> lin N2 (n ** {c2 = p}) ; + regN2 = \n -> (prepN2 n (mkPrep mkPrepof )) ; + mkN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; + mkPrepof : Number => Gender => Str = + table Number { Sg => table { + G3| G7 => "ya" ; + G4 => "kya" ; + G5 => "ka" ; + G6 => "va" ; + G10 => "kwa"; + _ => "wa" } ; + + Pl => table { G1|G3| G8 | G10 => "ma" ; + G4| G7 |G9 => "sya" ; + G2 => "ya" ; + G5 => "twa" ; + G6 => "kwa"} } ; + + + + +--3 Relational common noun phrases + + + cnN2 : CN -> Prep -> N2 ; + cnN3 : CN -> Prep -> Prep -> N3 ; + + + cnN2 = \n,p -> lin N2 (n ** {c2 = p}) ; + cnN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; + + + regPN n g = lin PN {s = table {Loc => "kwa" + n ; _ => n} ; g = g} ; + + + nounPN n = lin PN {s = n.s ! singular ; g = n.g} ; + + mkOrd : Str -> Ord = \x -> lin Ord { s =\\g => x}; + + + prepA2 a p = lin A2 (a ** {c2 = p.s!Sg!G1}) ; + + mkAdv x = lin Adv (ss x) ; + mkAdV x = lin AdV (ss x) ; + mkAdA x = lin AdA (ss x) ; + mkAdN x = lin AdN (ss x) ; + + mkPrep = overload { + mkPrep : Str -> Prep = \str -> lin Prep {s = \\n,g => str } ; + mkPrep : (Number => Gender => Str) -> Prep = \t ->lin Prep {s = t} ; + } ; + + noPrep = mkPrep [] ; + {-} mkPrep : Str -> Str -> Prep = \p,q -> lin Prep + {s = table{Sg => table{G1 => p; _=> "" }; + Pl => table{G1 => q; _=> ""}}} ; + prepV2 : V -> Prep -> V2 ; + prepV2 = \v,p -> lin V2 (v ** {c2 = p.s!Sg!G1}) ; + dirV2 : V -> V2 = \v -> prepV2 v noPrep ; + + prepPrepV3 v p q = lin V3 (v ** {c2 = p ; c3 = q}) ; + dirV3 v p = prepPrepV3 v noPrep p ; + dirdirV3 v = dirV3 v noPrep ; + + + mkA2V : A -> Prep -> Prep -> A2V; + A2S, A2V : Type = A2 ; + mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ; + + + mkAV v = v ** { lock_AV = <>} ; + mkAV : A -> AV ; + AS, AV : Type = A ; + + mkAS : A -> AS ; + mkAS v = v ** {lock_AS = <>} ; + + mkVS : V -> VS ; + mkVS v = v ** { lock_VS = <>} ; + + mkVQ : V -> VQ ; + mkVQ v = v ** {lock_VQ = <>} ; + + + -- mkVV : V -> VV ; + -- mkVV v = v ** { lock_VV = <>} ; + + mkVA : V -> VA ; + mkVA v = v ** {lock_VA = <>} ; + + mkV2V : V -> Prep -> Prep -> V2V ; + mkV2V v p q = prepPrepV3 v p q ** {lock_V2V = <>} ; + + mkV2S : V -> Prep -> V2S ; + mkV2S v p = prepV2 v p ** { lock_V2S = <>} ; + + mkV2Q : V -> Prep -> V2Q ; + mkV2Q v p = prepV2 v p ** {lock_V2Q = <>} ; + + mkV2A : V -> Prep -> Prep -> V2A ; + mkV2A v p q = prepPrepV3 v p q ** {lock_V2A = <>} ; + + + mkV0 : V -> V0 ; + V0 : Type ; + V0 : Type = V; + mkV0 v = v ** {lock_V0 = <>} ; +-} +-- pre-overload API and overload definitions + + -- regN : Str ->Gender -> N ; + --iregN : (man,men : Str) ->Gender -> N ; + compoundN : Str -> N -> N ; + + mkN = overload { + mkN : Str ->Gender -> N = \n, g -> lin N (regN n g ); + mkN : (man,men : Str) ->Gender -> N = \s,p,g -> lin N ( iregN s p g) ; + } ; + + + prepN2 : N -> Prep -> N2 ; + +-- The most common preposition is "of", and the following is a +-- shortcut for regular relational nouns with "of". + + regN2 : N -> N2 ; + + + + + regA : Str -> A = \s -> lin A (MorphoKam.regA s) ; + cregA : Str -> A = \s -> lin A (MorphoKam.cregA s) ; + iregA : (fat,fatter : Str) -> A =\a,b -> lin A (MorphoKam.iregA a b); + + mkA = overload { + mkA : Str -> A = \a -> lin A (regA a |cregA a); + mkA : (fat,fatter : Str) -> A =\a,b -> lin A (iregA a b ); + + } ; + + prepA2 : A -> Prep -> A2 ; + + mkA2 = overload { + mkA2 : A -> Prep -> A2 = prepA2 ; + mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPrep p) ; + mkA2 : Str -> Prep -> A2 = \a,p -> prepA2 (regA a) p; + mkA2 : Str -> Str -> A2 = \a,p -> prepA2 (regA a) (mkPrep p); + } ; + + + regV=MorphoKam.regV ; +{-} + mkV = overload { + mkV : Str -> V =\v ->lin V(regV v) ; + mkV : Str -> V -> V = prefixV + }; + + + prefixV : Str -> V -> V = \p,v -> lin V { s = \\b,vform => p + v.s! b ! vform } ; + mkV2 = overload { + mkV2 : V -> V2 = dirV2 ; + mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; + mkV2 : V -> Prep -> V2 = prepV2; + mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPrep p) ; + mkV2 : Str -> Prep -> V2 = \v,p -> prepV2 (regV v) p ; + mkV2 : Str -> Str -> V2 = \v,p -> prepV2 (regV v) (mkPrep p) + }; + + prepPrepV3 : V -> Prep -> Prep -> V3 ; + dirV3 : V -> Prep -> V3 ; + dirdirV3 : V -> V3 ; + + mkV3 = overload { + mkV3 : V -> Prep -> Prep -> V3 = prepPrepV3 ; + mkV3 : V -> Prep -> V3 = dirV3 ; + mkV3 : V -> Str -> V3 = \v,s -> dirV3 v (mkPrep s); + mkV3 : Str -> Str -> V3 = \v,s -> dirV3 (regV v) (mkPrep s); + mkV3 : V -> V3 = dirdirV3 ; + mkV3 : Str -> V3 = \v -> dirdirV3 (regV v) ; + } ; +-} + mkConj = overload { + mkConj : Str -> Conj = \y -> mk2Conj [] y plural ; + mkConj : Str -> Number -> Conj = \y,n -> mk2Conj [] y n ; + mkConj : Str -> Str -> Conj = \x,y -> mk2Conj x y plural ; + mkConj : Str -> Str -> Number -> Conj = mk2Conj ; + } ; + + mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> + lin Conj (sd2 x y ** {n = n}) ; + + + + + regPN : Str ->Gender -> PN ; + + + nounPN : N -> PN ; + + + +} diff --git a/src/kikamba/PhraseKam.gf b/src/kikamba/PhraseKam.gf new file mode 100644 index 000000000..c705839fe --- /dev/null +++ b/src/kikamba/PhraseKam.gf @@ -0,0 +1,3 @@ +concrete PhraseKam of Phrase = CatKam ** PhraseBantu with + (ResBantu = ResKam); + \ No newline at end of file diff --git a/src/kikamba/QuestionKam.gf b/src/kikamba/QuestionKam.gf new file mode 100644 index 000000000..1c87078c9 --- /dev/null +++ b/src/kikamba/QuestionKam.gf @@ -0,0 +1,2 @@ +concrete QuestionKam of Question = CatKam ** QuestionBantu with + (ResBantu = ResKam); \ No newline at end of file diff --git a/src/kikamba/RelativeKam.gf b/src/kikamba/RelativeKam.gf new file mode 100644 index 000000000..68ef8ea35 --- /dev/null +++ b/src/kikamba/RelativeKam.gf @@ -0,0 +1,2 @@ +concrete RelativeKam of Relative = CatKam ** RelativeBantu with + (ResBantu = ResKam); \ No newline at end of file diff --git a/src/kikamba/ResKam.gf b/src/kikamba/ResKam.gf new file mode 100644 index 000000000..bb222a4c4 --- /dev/null +++ b/src/kikamba/ResKam.gf @@ -0,0 +1,7 @@ +--# -path=.:../abstract:../common:../../prelude + + +instance ResKam of ResBantu = DiffKam, CommonBantu ** open Prelude in { + + +} ; diff --git a/src/kikamba/SentenceKam.gf b/src/kikamba/SentenceKam.gf new file mode 100644 index 000000000..2a04b865a --- /dev/null +++ b/src/kikamba/SentenceKam.gf @@ -0,0 +1,3 @@ +concrete SentenceKam of Sentence = CatKam ** SentenceBantu with + (ResBantu = ResKam); + diff --git a/src/kikamba/StructuralKam.gf b/src/kikamba/StructuralKam.gf new file mode 100644 index 000000000..e3ac2282a --- /dev/null +++ b/src/kikamba/StructuralKam.gf @@ -0,0 +1,231 @@ +concrete StructuralKam of Structural = CatKam ** + open MorphoKam, ParadigmsKam, + (C = ConstructX), Prelude in { + + flags optimize=all ; + + lin + above_Prep = mkPrep "iulu" ; + after_Prep = mkPrep "itina" ; + all_Predet = {s = \\g => MorphoKam.Allpredetprefix g + "onthe"} ; + almost_AdA = mkAdA "vakuvi " ; + almost_AdN = mkAdN "vakuvi " ; + although_Subj = ss "ona kau" ; + always_AdV = mkAdV "mavinda onthe" ; + and_Conj = mkConj "na" ; + because_Subj = ss "nundu" | ss "ni kwithiwa" ; + before_Prep = mkPrep "mbee" ; + behind_Prep = mkPrep "itina" ; + between_Prep = mkPrep "kati" ; + both7and_DConj = mkConj "eli" "na"; + but_PConj = ss "ndi" ; + by8agent_Prep = mkPrep "kwa" ; + by8means_Prep = mkPrep "kwa" ; + +{-} can8know_VV, can_VV = { + s = table { + VVF VInf => ["be able to"] ; + VVF VPres => "can" ; + VVF VPPart => ["been able to"] ; + VVF VPresPart => ["being able to"] ; + VVF VPast => "could" ; --# notpresent + VVPastNeg => "couldn't" ; --# notpresent + VVPresNeg => "can't" -- | "cannot" ---- shouldn't be a variant, but replace "can not" + } ; + p = [] ; + typ = VVAux + } | + { + s = table { + VVF VInf => ["be able to"] ; + VVF VPres => "can" ; + VVF VPPart => ["been able to"] ; + VVF VPresPart => ["being able to"] ; + VVF VPast => "could" ; --# notpresent + VVPastNeg => "couldn't" ; --# notpresent + VVPresNeg => "cannot" ---- shouldn't be a variant, but replace "can not" + } ; + p = [] ; + typ = VVAux + } ; -} + during_Prep = mkPrep "during" ; + either7or_DConj = mkConj "kana" singular ; + everybody_NP = regNP "kila umwe" mu_a singular ; + every_Det = mkDet "kila" [] Sg ; + everything_NP = regNP "kila kindu" ki_i singular ; + everywhere_Adv = mkAdv "kila vandu" ; + few_Det = mkDet [] "nini" Pl; + for_Prep = mkPrep nonExist ; + from_Prep = mkPrep "kuma" ; + he_Pron = mkPron "we" "ake" G1 Sg P3 ; + here_Adv = mkAdv "vaa" ; + here7to_Adv = mkAdv ["kuvika vaa"] ; + here7from_Adv = mkAdv ["kuma vaa"] ; + how_IAdv = ss "ata" | ss "nzia myau" ; + how8much_IAdv = ss "mala meana" ; + --how8many_IDet = mkDeterminer plural ["mala meana"] ; + if_Subj = ss "enthwa" ; + in8front_Prep = mkPrep ["mbee wa"] ; + i_Pron =mkPron "nyie" "akwa" G1 Sg P1 ; + in_Prep = mkPrep "in" ; + it_Pron ={ s=\\c=>"yo"; poss=\\n,g=> ""; a=Ag G4 Sg P3}; + + less_CAdv = C.mkCAdv "ninangi" "kwi" ; + much_Det, many_Det =mkDet [] "ingi" Pl; + more_CAdv = C.mkCAdv "mbeange" "kwi" ; + most_Predet = {s = \\g => MorphoKam.Mostpredetprefix g + "ingi"} ; + +{-} must_VV = { + s = table { + VVF VInf => ["have to"] ; + VVF VPres => "must" ; + VVF VPPart => ["had to"] ; + VVF VPres2Part => ["having to"] ; + VVF VPast => ["had to"] ; --# notpresent + VVPastNeg => ["hadn't to"] ; --# notpresent + VVPresNeg => "mustn't" + } ; + p = [] ; + typ = VVAux + + } ; -} +---b no_Phr = ss "no" ; + no_Utt = ss "aeee" ; + on_Prep = mkPrep "iulu wa" ; +---- one_Quant = mkDeterminer singular "one" ; -- DEPRECATED + only_Predet = {s = \\g => "tu" } ; + or_Conj = mkConj "kana" singular ; + otherwise_PConj = ss "otherwise" ; + please_Voc = ss "ame" ; + part_Prep, possess_Prep = let + questo : ParadigmsKam.Number => MorphoKam.Gender => Str = table { + Sg => \\g=> case of { + | | | => "wa"; + => "kya"; + => "ka"; + => "va"; + => "kwa"; + _ => "ya" + }; + + Pl => \\g=> case of{ + => "ya"; + => "twa"; + => "kwa"; + || => "sya"; + _ => "ma" + } + + } + in { s= questo} ; + quite_Adv = mkAdv "o muno" ; + she_Pron = mkPron "we" "ake" G1 Sg P3 ; + + so_AdA = mkAdA "so" ; + somebody_NP = regNP " o mundu " mu_a singular ; + someSg_Det = mkDet [] "mwe" Sg; + somePl_Det = mkDet [] "mwe" Pl; + something_NP = regNP "o kindu" ki_i singular ; + somewhere_Adv = mkAdv "o vandu" ; + that_Quant = let + questo : ParadigmsKam.Number => MorphoKam.Gender => Str = table { + Sg => \\g=> case of { + => "iya"; + => "yiya"; + => "kiya"; + => "kaya"; + => "kuya"; + => "vaya"; + | | => "uya" ; + _ => "iya" + }; + + Pl => \\g=> case of{ + => "iya"; + => "iya"; + => "tuya"; + => "kuya"; + | => "iya"; + _ => "aya" + } + + } + in { + s = questo ; + } ; + there_Adv = mkAdv "vau" ; + there7to_Adv = mkAdv "vau" ; + there7from_Adv = mkAdv ["kuma vau"] ; + therefore_PConj = ss "kwoou" ; + they_Pron =mkPron "mo" "oo" G1 Pl P3 ; + + this_Quant = let + questo : ParadigmsKam.Number => MorphoKam.Gender => Str = table { + Sg => \\g=> case of { + => "yii"; + => "kii"; + => "kaa"; + => "vaa"; + => "ii"; + => "kuu"; + _ => "uu" + }; + + Pl => \\g=> case of{ + => "tuu"; + => "kuu"; + | | | => "ii"; + _ => "aa" + } + } + in { + s = questo ; + } ; + through_Prep = mkPrep "kuvitila" ; + too_AdA = mkAdA "too" ; + to_Prep = mkPrep "kuvika" ; + under_Prep = mkPrep "itheo" ; + very_AdA = mkAdA "muno" ; + -- want_VV = mkVV (regV "enda") ; + we_Pron =mkPron "ithyi" "itu" G1 Pl P1 ; + + --whatPl_IP = mkIP "ata" "ata" plural ; + -- whatSg_IP = mkIP "ata" "ata" singular ; + when_IAdv = ss "when" ; + when_Subj = ss "when" ; + where_IAdv = ss "where" ; + which_IQuant = {s = \\_ => "which"} ; +---b whichPl_IDet = mkDeterminer plural ["which"] ; +---b whichSg_IDet = mkDeterminer singular ["which"] ; + -- whoPl_IP = mkIP "uu" "whom" "whose" plural ; + -- whoSg_IP = mkIP "who" "whom" "whose" singular ; + why_IAdv = ss "why" ; + without_Prep = mkPrep "nza" ; + with_Prep = mkPrep "vamwe na" ; + --yes_Phr = ss "ii" ; + yes_Utt = ss "ii" ; + youSg_Pron = mkPron "we" "aku" G1 Sg P2 ; + + youPol_Pron,youPl_Pron = mkPron "inyui" "enyu" G1 Pl P3 ; + + + + not_Predet = {s = \\g => "nongi"} ; + no_Quant = {s = \\g,n => nonExist} ; + if_then_Conj = mkConj "ethiwa" "indi" singular ; + nobody_NP = regNP "vai mundu" mu_a singular ; + nothing_NP = regNP "vathei" va_ku singular ; + + at_least_AdN = mkAdN "muvaka" ; + at_most_AdN = mkAdN "nginya" ; + + except_Prep = mkPrep "ate o" ; + + as_CAdv = C.mkCAdv "nundu" "ta" ; + + -- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ; + that_Subj = ss "ati" ; + lin language_title_Utt = ss "kikamba" ; + +} + diff --git a/src/kikamba/VerbKam.gf b/src/kikamba/VerbKam.gf new file mode 100644 index 000000000..304c3b421 --- /dev/null +++ b/src/kikamba/VerbKam.gf @@ -0,0 +1,2 @@ +concrete VerbKam of Verb = CatKam ** VerbBantu with + (ResBantu = ResKam); From 4859ff2be8944ad3e2ee79ebc665fd79e4d893a2 Mon Sep 17 00:00:00 2001 From: benson kituku <31066831+kitukb@users.noreply.github.com> Date: Wed, 3 Oct 2018 11:42:40 +0300 Subject: [PATCH 4/4] added kiswahili language based on Bantu functor --- src/kiswahili/AdjectiveKis.gf | 16 ++ src/kiswahili/AdverbKis.gf | 13 + src/kiswahili/CatKis.gf | 2 + src/kiswahili/ConjunctionKis.gf | 2 + src/kiswahili/DiffKis.gf | 235 +++++++++++++++++ src/kiswahili/GrammarKis.gf | 30 +++ src/kiswahili/IdiomKis.gf | 48 ++++ src/kiswahili/LangKis.gf | 8 + src/kiswahili/LexiconKis.gf | 373 +++++++++++++++++++++++++++ src/kiswahili/MorphoKis.gf | 351 +++++++++++++++++++++++++ src/kiswahili/NounKis.gf | 2 + src/kiswahili/NumeralKis.gf | 87 +++++++ src/kiswahili/ParadigmsKis.gf | 437 ++++++++++++++++++++++++++++++++ src/kiswahili/PhraseKis.gf | 3 + src/kiswahili/QuestionKis.gf | 2 + src/kiswahili/RelativeKis.gf | 2 + src/kiswahili/ResKis.gf | 8 + src/kiswahili/SentenceKis.gf | 3 + src/kiswahili/StructuralKis.gf | 200 +++++++++++++++ src/kiswahili/VerbKis.gf | 2 + 20 files changed, 1824 insertions(+) create mode 100644 src/kiswahili/AdjectiveKis.gf create mode 100644 src/kiswahili/AdverbKis.gf create mode 100644 src/kiswahili/CatKis.gf create mode 100644 src/kiswahili/ConjunctionKis.gf create mode 100644 src/kiswahili/DiffKis.gf create mode 100644 src/kiswahili/GrammarKis.gf create mode 100644 src/kiswahili/IdiomKis.gf create mode 100644 src/kiswahili/LangKis.gf create mode 100644 src/kiswahili/LexiconKis.gf create mode 100644 src/kiswahili/MorphoKis.gf create mode 100644 src/kiswahili/NounKis.gf create mode 100644 src/kiswahili/NumeralKis.gf create mode 100644 src/kiswahili/ParadigmsKis.gf create mode 100644 src/kiswahili/PhraseKis.gf create mode 100644 src/kiswahili/QuestionKis.gf create mode 100644 src/kiswahili/RelativeKis.gf create mode 100644 src/kiswahili/ResKis.gf create mode 100644 src/kiswahili/SentenceKis.gf create mode 100644 src/kiswahili/StructuralKis.gf create mode 100644 src/kiswahili/VerbKis.gf diff --git a/src/kiswahili/AdjectiveKis.gf b/src/kiswahili/AdjectiveKis.gf new file mode 100644 index 000000000..98b3d4d9d --- /dev/null +++ b/src/kiswahili/AdjectiveKis.gf @@ -0,0 +1,16 @@ +concrete AdjectiveKis of Adjective = CatKis **AdjectiveBantu-[ComparA,UseComparA,ComplA2] +with (ResBantu = ResKis)** open DiffKis in +{ +flags coding=utf8; + lin + ComparA a np = { + s = \\g,n => a.s !AAdj g n ++ conjThan ++ np.s ! npNom ; + isPre = False} ; + + UseComparA a = {s = \\g,n=> a.s !AAdj g n;isPre = True}; + + ComplA2 a np = { + s = \\g,n => a.s !AAdj g n ++ a.c2 ++ np.s ! NPAcc; + isPre = False + } ; + } \ No newline at end of file diff --git a/src/kiswahili/AdverbKis.gf b/src/kiswahili/AdverbKis.gf new file mode 100644 index 000000000..205fb8416 --- /dev/null +++ b/src/kiswahili/AdverbKis.gf @@ -0,0 +1,13 @@ +concrete AdverbKis of Adverb = CatKis **AdverbBantu -[ComparAdvAdj,ComparAdvAdjS] with + (ResBantu = ResKis)** open DiffKis in +{ +flags coding=utf8; + lin + 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 + } ; + ComparAdvAdjS cadv a s = { + s = cadv.s ++ a.s !AAdj G1 Sg ++ cadv.p ++ s.s + } ; + } \ No newline at end of file diff --git a/src/kiswahili/CatKis.gf b/src/kiswahili/CatKis.gf new file mode 100644 index 000000000..0f93da545 --- /dev/null +++ b/src/kiswahili/CatKis.gf @@ -0,0 +1,2 @@ +concrete CatKis of Cat = CommonX - [Pol] + ** CatBantu with (ResBantu = ResKis); diff --git a/src/kiswahili/ConjunctionKis.gf b/src/kiswahili/ConjunctionKis.gf new file mode 100644 index 000000000..4e0b34ef3 --- /dev/null +++ b/src/kiswahili/ConjunctionKis.gf @@ -0,0 +1,2 @@ +concrete ConjunctionKis of Conjunction = CatKis ** ConjunctionBantu with + (ResBantu = ResKis); \ No newline at end of file diff --git a/src/kiswahili/DiffKis.gf b/src/kiswahili/DiffKis.gf new file mode 100644 index 000000000..c0bdc842e --- /dev/null +++ b/src/kiswahili/DiffKis.gf @@ -0,0 +1,235 @@ +instance DiffKis of DiffBantu = open CommonBantu, Prelude in { + +param + GenderKis = G1|G2|G3|G4|G5|G6|G7|G8|G9|G10|G11|G12|G13 ; +oper + Gender = GenderKis ; + firstGender = G1 ; secondGender = G2 ; + conjThan = "kuliko" ; + conjThat = "kuvita" ; + + conjGender : Gender -> Gender -> Gender = \m,n -> + case m of { G1 => n ; _ => G2 } ; + reflPron :Agr => Str = \\ag=> case of { + < Ag G1 Sg P1 > => "mimi" ; + < Ag G1 Sg P2 > => "wewe" ; + < Ag G1 Sg P3 > => "yeye" ; + < Ag _ Sg P3 > => "" ; + < Ag G1 Pl P1 > => "sisi" ; + < Ag G1 Pl P2 > => "nyinyi" ; + < Ag G1 Pl P3 > => "wao" ; + < Ag _ _ _ > => "" + + }; +possess_Prepof,part_Prepof:Number => Gender => Str = + table Number { Sg => table { G3=> "la" ; + G4 => "cha" ; + G5 => "ya" ; + G11 => "pa"; + G12 => "kwa"; + G13 => "mwa"; + G1 |G2|G6|G7 |G8 => "wa" ; + _ => ""} ; + + Pl => table { G1 => "wa" ; + G4 => "vya" ; + G5|G6 => "za" ; + G2|G3 |G8 |G9 |G10 => "ya" ; + _ => ""} } ; + + + superVery ="vyu"; + +Cardoneprefix : Gender -> Str = \g -> + case of { + => "ki" ; + | | | => "m" ; + _ => "" + } ; +Cardtwoprefix : Gender -> Str = \g -> + case of { + => "waw" ; + => "miw" ; + | => "maw" ; + => "viw" ; + _=> "mb" + } ; + Allpredetprefix : Gender -> Str = \g -> + case of { + => "vy" ; + => "p"; + => "k"; + => "m"; + | => "z" ; + | => "w" ; + | | | | => "y" + } ; + PrefixPlNom : Gender -> Str = \g -> + case of { + => "wa" ; + => "mi" ; + => "ma" ; + => "vi" ; + _ => [] + } ; + mkprefix,Ordprefix : Gender -> Str = \g -> + case of { + + => "la" ; + => "cha" ; + | | => "ya"; + | | => "pa"; + | | | | => "wa" + } ; + Cardprefix : Gender -> Str = \g -> + case of { + => "wa" ; + => "mi" ; + | => "ma" ; + => "vi" ; + _ => "" + } ; + Mostpredetprefix : Gender -> Str = \g -> + case of { + => "we" ; + => "mi" ; + => "nyi" ; + => "pe" ; + => "kwi" ; + => "vi" ; + | => "nye" ; + | => "mwi" ; + | | => "me" + + + } ; + ConsonantAdjprefix: Gender -> Number -> Str = \n,g -> + case of { + => "m" ; + => "wa" ; + => "m" ; + => "mi" ; + => "ma" ; + => "ki" ; + => "vi" ; + => "m" ; + => "m" ; + => "m" ; + => "ma" ; + => "ma" ; + => "pa" ; + => "ku" ; + => "m" ; + <_,_> => "" + } ; + + VowelAdjprefix: Gender -> Number -> Str = \n,g -> + case of { + => "mw" ; + => "w" ; + => "mw" ; + => "my" ; + => "j" ; + => "m" ; + => "ch" ; + => "vy" ; + => "ny"; + => "ny"; + => "mw" ; + => "y" ; + => "mw" ; + => "mw" ; + => "mw" ; + => "m" ; + => "m" ; + => "ny" ; + => "p" ; + => "kw" ; + => "mu" ; + <_,_> => "" + } ; + + VoweliAdjprefix: Gender -> Number -> Str = \n,g -> + case of { + => "mwi" ; + => "we" ; + => "mwi" ; + => "mi" ; + => "ji" ; + => "me" ; + => "ki" ; + => "vi" ; + => "zi"; + => "zi"; + => "mwi" ; + => "zi" ; + => "mwi" ; + => "mwi" ; + => "mwi" ; + => "me" ; + => "me" ; + => "zi" ; + => "pe" ; + => "kwi" ; + => "mwi" ; + <_,_> => "" + } ; + Adjpprefix : Gender -> Number -> Str = \n,g -> + case of { + => "wi" ; + => "me" ; + => "wi" ; + => "yi" ; + => "yi" ; + => "me" ; + => "ki" ; + => "syi" ; + => "ke" ; + => "twi" ; + => "ve" ; + => "kwi" ; + => "yi" ; + => "syi" ; + <_,_> => "" + } ; + ProunSgprefix : Gender -> Str = \g -> + case of { + => "l" ; + => "ch" ; + => "p"; + => "kw"; + => "mw"; + | | => "y"; + _ => "w" + + } ; + + ProunPlprefix : Gender -> Str = \g -> + case of { + => "vy" ; + => "p"; + => "kw"; + => "mw"; + | => "z" ; + | => "w" ; + | | | | => "y" + + + } ; + dfltGender : Gender = G1 ; + dflt2Gender : Gender = G2 ; + + + + param + + VForm = VInf + | VPres Gender Number Person + | VPast Gender Number Person + | VFut Gender Number Person + -- | notpresent + ; + + DForm = unit | teen | ten |hund ; + AForm = AAdj Gender Number; +} diff --git a/src/kiswahili/GrammarKis.gf b/src/kiswahili/GrammarKis.gf new file mode 100644 index 000000000..71e663393 --- /dev/null +++ b/src/kiswahili/GrammarKis.gf @@ -0,0 +1,30 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarKis of Grammar = + NounKis, + VerbKis, + AdjectiveKis, + AdverbKis, + NumeralKis, + SentenceKis, + QuestionKis, + RelativeKis, + ConjunctionKis, + PhraseKis, + TextX - [Pol,PPos,PNeg,Pres], + StructuralKis, + IdiomKis, + TenseX - [Pol,PPos,PNeg,Pres] + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text; + +--lin + --PPos = {s = [] ; p = CPos} ; + -- PNeg = {s = [] ; p = CNeg True} ; -- contracted: don't + --PPos = {s = [] ; b = True} ; + -- PNeg = {s = [] ; b = False} ; + -- TPres = {s = [] ; t = ResKis.Pres} ; + -- TPast = {s = [] ; t = ResKis.Past }; + -- TFut = {s = [] ; t = ResKis.Fut }; +} ; diff --git a/src/kiswahili/IdiomKis.gf b/src/kiswahili/IdiomKis.gf new file mode 100644 index 000000000..089f74b0d --- /dev/null +++ b/src/kiswahili/IdiomKis.gf @@ -0,0 +1,48 @@ +concrete IdiomKis of Idiom = CatKis ** open Prelude, ResKis in { + + flags optimize=all_subs ; +{- + lin + ImpersCl vp = mkClause "it" (agrP3 Sg) vp ; + GenericCl vp = mkClause "one" (agrP3 Sg) vp ; + + CleftNP np rs = mkClause "it" (agrP3 Sg) + (insertObj (\\_ => rs.s ! np.a) + (insertObj (\\_ => np.s ! rs.c) (predAux auxBe))) ; + + CleftAdv ad s = mkClause "it" (agrP3 Sg) + (insertObj (\\_ => conjThat ++ s.s) + (insertObj (\\_ => ad.s) (predAux auxBe))) ; + + ExistNP np = + mkClause "there" (agrP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPAcc) (predAux auxBe)) ; + + ExistIP ip = + mkQuestion (ss (ip.s ! npNom)) + (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ; + + ExistNPAdv np adv = + mkClause "there" (agrP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPAcc ++ adv.s) (predAux auxBe)) ; + + ExistIPAdv ip adv = + mkQuestion (ss (ip.s ! npNom)) + (mkClause "there" (agrP3 ip.n) (insertObj (\\_ => adv.s) (predAux auxBe))) ; + + ProgrVP vp = insertObj (\\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a) (predAux auxBe) ; + + ImpPl1 vp = {s = "let's" ++ infVP VVAux vp Simul CPos (AgP1 Pl)} ; + + ImpP3 np vp = {s = "let" ++ np.s ! NPAcc ++ infVP VVAux vp Simul CPos np.a} ; + + SelfAdvVP vp = insertObj reflPron vp ; + SelfAdVVP vp = insertAdVAgr reflPron vp ; + SelfNP np = { + s = \\c => np.s ! c ++ reflPron ! np.a ; + a = np.a + } ; +} -} + +} + diff --git a/src/kiswahili/LangKis.gf b/src/kiswahili/LangKis.gf new file mode 100644 index 000000000..115e8f537 --- /dev/null +++ b/src/kiswahili/LangKis.gf @@ -0,0 +1,8 @@ +--# -path=.:../abstract:../common:../api + +concrete LangKis of Lang = + GrammarKis, + LexiconKis +-- ,ConstructionSwa + ** { +} ; diff --git a/src/kiswahili/LexiconKis.gf b/src/kiswahili/LexiconKis.gf new file mode 100644 index 000000000..cec711b56 --- /dev/null +++ b/src/kiswahili/LexiconKis.gf @@ -0,0 +1,373 @@ +--# -path=.:prelude + +concrete LexiconKis of Lexicon = CatKis ** + open ParadigmsKis,StructuralKis, Prelude in { + +flags + optimize=values ; + +lin + person_N =regN "mtu" a_wa ; + woman_N =iregN "mwanamke" "wanwake" a_wa ; + house_N =regN "nyumba" i_zi ; + tree_N = regN "mti" u_i ; + big_A =regA "kubwa" ; + beautiful_A = regA "rembo" ; + black_A =regA "eusi" ; + blue_A =cregA "buluu" ; + broad_A = regA "pana" ; + brown_A =regA "hudhurungi" ; + clean_A = regA "safi" ; + clever_A = regA "hodari" ; + cold_A = regA "baridi" ; + correct_A =regA "sahihi" ; + dirty_A =regA "chafu" ; + dry_A = regA "kavu" ; + full_A =regA "tele" ; + good_A =regA "zuri" ; + green_A =cregA "kijani" ; + heavy_A = regA "zito" ; + hot_A =regA "moto" ; + important_A = regA "muhimu" ; + long_A = regA "refu" ; + narrow_A = regA "embamba" ; + near_A = regA "karibu" ; + new_A =regA "pya" ; + old_A =regA "zee" ; + red_A =regA "ekundu" ; + rotten_A = regA "oza" ; + round_A = regA "virgo" ; + sharp_A = regA "kali" ; + short_A = regA "fupi" ; + smooth_A = regA "lai" ; + straight_A =regA "nyofu" ; + stupid_A =regA "jiga" ; + thick_A =regA "nene" ; + thin_A = regA "embamba" ; + ugly_A =regA "baya"; + warm_A =regA "fufutende" ; + wet_A =regA "nyevu" ; + white_A =regA "eupe" ; + yellow_A =regA "njano" ; + young_A = regA "bichi" ; + small_A = regA "dogo" ; + cow_N = regN "ngombe" i_zi ; + doctor_N =iregN "daktari" "daktari" a_wa ; + dog_N =iregN "mbwa" "mbwa" a_wa ; + door_N =regN "mlango" u_i ; + enemy_N =regN "adui" a_wa ; + fish_N = regN "samaki" a_wa ; + friend_N =iregN "rafiki" "rafiki" a_wa ; + garden_N = iregN "bustani" "bustani" li_ya ; + girl_N = regN "msichana" a_wa ; + lamp_N = regN "taa" li_ya ; + man_N = iregN "mwanaume" "wanaume" a_wa ; + eye_N = iregN "jicho" "macho" li_ya ; + tooth_N = regN "jino" li_ya ; + wife_N = iregN "bibi" "bibi"a_wa ; + bird_N = regN "ndege" a_wa ; + country_N = regN "nchi" i_zi ; + cousin_N = iregN "binamu" "Binami" a_wa; + father_N = regN "baba" "baba" a_wa ; + water_N = iregN "maji" "maji" ya_ya ; + ear_N = regN "sikio" li_ya ; + fingernail_N = regN "ukucha" u_zi ; + nose_N = regN "pua" li_ya ; + road_N = iregN "barabara" "barabara" i_zi ; + river_N = regN "mto" u_i ; + come_V = regV "kuja"; + walk_V = regV "tembea"; + sleep_V = regV "lala"; + smell_V = regV "nuka"; + stand_V = regV "simama"; + stop_V = regV "simama"; + swell_V = regV "fura"; + swim_V = regV "ogelea"; + think_V = regV "waza"; + travel_V = regV "safiri"; + big_A = regA "kubwa"; + paris_PN = regPN "Paris" ku_ku ; -- this is alreay name of place avoid kwa + john_PN = regPN "Yoana" a_wa ; + question_N = regN "swali" i_zi ; + -- ready_A = regA "ready" ; + reason_N = regN "sababu" i_zi ; + today_Adv = mkAdv "today" ; + --uncertain_A = regA "uncertain" ; + distance_N3 = mkN3 (mkN "umbali" "umbali" i_zi ) fromP toP ; + add_V3= regV "ongeza"; + airplane_N=iregN "ndege" "ndege" i_zi ; + alas_Interj= ss "ala"; + animal_N=regN "mnyama" a_wa; + ask_V2Q=regV "uliza" ; + baby_N=regN "mtoto" a_wa; + belly_N=regN "tumbo" i_zi ; + blood_N=iregN "damu" "damu" i_zi ; + book_N=regN "kitabu" ki_vi; + boss_N=iregN "bosi" "bosi"a_wa; + boy_N=regN "kijana" a_wa; + bread_N=regN " mkate" u_i; + breast_N=regN "titi" li_ya; + brother_N2= mkN2(mkN "kaka" "kaka" a_wa) mkPrepof ; + burn_V=regV "choma"; + buy_V2=regV "nunua"; + car_N=regN "gari" li_ya; + cat_N=iregN "paka" "paka" a_wa; + chair_N=regN "kiti" ki_vi; + child_N=regN "mtoto" a_wa; + church_N=regN "mtoto" a_wa; + city_N=regN "mji" u_i; + close_V2=regV "karibu"; + coat_N=regN "koti" li_ya; + computer_N=iregN "kompyuta" "kompyuta" li_ya; + cut_V2=regV "kata"; + day_N=regN "siku" li_ya; + die_V=regV "kufa"; + dig_V=regV "kulima"; + do_V2=regV " fanya"; + drink_V2=regV " kunywa"; + earth_N=iregN "ardhi" "ardhi" i_zi; + eat_V2=regV " kula" ; + egg_N=regN " yai" li_ya; + fall_V=regV "anguka" ; + far_Adv=mkAdv"mbali"; + fat_N=regN "mafuta" li_ya; + father_N2=mkN2 ( mkN "baba" "baba"a_wa) mkPrepof ; + fear_V2=regV "ongopa" ; + find_V2=regV "tafuta"; + fire_N=iregN "moto" "moto" u_i; + foot_N=regN" mguu" u_i; + forest_N=regN "msitu" u_i; + go_V=regV "enda" ; + gold_N=iregN "dhahabu" "dhahabu" li_ya; + grass_N=regN "nyasi" i_zi; + hair_N=iregN "nywele" "Nywele" i_zi; + hand_N=regN "mkono" u_i; + hat_N=iregN "kofia" "kofia" i_zi; + head_N=regN "kichwa" ki_vi; + hear_V2=regV " sikia"; + heart_N=regN "moyo" u_i; + hill_N=regN " kilima" ki_vi; + husband_N=regN" mume" a_wa; + ice_N=iregN "barafu" "barafu" i_zi; + jump_V=regV "ruka"; + kill_V2=regV "ua"; + king_N=regN "mfalame" a_wa; + knee_N=regN "goti" li_ya; + know_V2=regV "jua"; + laugh_V=regV "cheka"; + leaf_N=regN "jani" li_ya; + learn_V2=regV "soma"; + leg_N=regN " mguu" u_i; + listen_V2=regV " sikiza"; + love_N=regN "upendo" u_zi; + married_A2= mkA2(regA "oa") "ni"; + meat_N=regN "nyama" i_zi; + milk_N=regN "maziwa" i_zi; + moon_N=regN "mwezi" u_i; + mother_N2=mkN2( mkN "mama""mama" a_wa) mkPrepof ; + mountain_N=regN "mlima" u_i; + mouth_N=regN "mdomo" u_i; + name_N=regN " jina" li_ya; + neck_N=regN "shingo" li_ya; + night_N=regN "usiku" u_zi; + number_N=regN "namba" li_ya; + oil_N=regN "mafuta" ya_ya; + open_V2=regV " fungua"; + paper_N=regN " karatasi" li_ya; + peace_N=regN "amani" ya_ya; + play_V=regV " cheza"; + policeman_N=regN "askari" a_wa; + priest_N=regN "kasisi" a_wa; + rain_N=regN "mvua" i_zi; + rock_N=regN "jabali" li_ya; + root_N=regN "mzizi" u_i; + rope_N=regN "kamba" li_ya; + run_V=regV "imbia"; + salt_N=iregN "chumvi" "chumvi" i_zi; + sand_N=iregN "changarawe" "changarawe" ki_vi; + school_N=iregN " shule" "shule" i_zi; + sea_N=iregN "bahari" "Bahari" li_ya; + see_V2=regV "angalia"; + seed_N=regN "mbengu" i_zi; + seek_V2=regV " tafuta"; + sell_V3=regV "uza"; + send_V3=regV "tuma"; + sheep_N=iregN "Kondoo" "Kondoo" li_ya; + shoe_N=regN "kiatu" ki_vi; + shop_N=iregN "duka" "duka" li_ya; + sing_V=regV "imba"; + sister_N=iregN "dada" "dada" a_wa; + sit_V=regV"keti"; + snake_N=iregN "nyoka" "nyoka" a_wa; + song_N=regN "wimbo" u_zi; + speak_V2=regV "ongea"; + star_N=regN "nyota" i_zi; + student_N=regN "mwanafunzi" a_wa; + sun_N=regN "jua" li_ya; + table_N=regN "meza" i_zi; + teach_V2=regV "somesha"; + teacher_N=regN "mwalimu" a_wa; + tongue_N=regN "ulimi" u_zi; + understand_V2=regV" elewa"; + wait_V2=regV "gojea"; + war_N=iregN "vita" "vita" u_zi; + wash_V2=regV "osha"; + win_V2=regV "shinda"; + wind_N=regN " upepo" u_zi; + window_N=regN "dirisha" li_ya; + write_V2=regV " andika"; + year_N=regN "mwaka" u_i; + already_Adv=mkAdv "zamani"; + answer_V2S=regV" jibu"; + apartment_N=iregN " nyumba ya ghorofa" "nyumba za ghorofa" i_zi; + apple_N=iregN "tofaa" "tofaa" li_ya; + art_N=iregN "weledi" "weledi" u_zi; + ashes_N=regN "jivu" li_ya; + back_N=regN "mgongo" u_i; + bad_A=regA"ovu" ; + bank_N=iregN "benki" "benki" i_zi; + bark_N=regN "gamba" li_ya; + become_VA=regV "ingia"; + beer_N=regN "mtindi" u_i; + beg_V2V=regV "omba"; + bike_N=iregN " baisikeli" "basikeli" i_zi; + bite_V2=regV "donoa"; + blow_V=regV"puliza"; + boat_N=regN "shua" li_ya; + bone_N=regN "mfupa" u_i; + boot_N=regN "buti" li_ya; + break_V2=regV "goboa"; + breathe_V=regV "pumua"; + butter_N=iregN "siagi" "siagi" i_zi; + camera_N=iregN "kamera" "kamera" i_zi; + cap_N=iregN "heti" "heti" i_zi; + carpet_N=regN "zulia" li_ya; + ceiling_N=regN "dari" li_ya; + cheese_N=regN " chisi" li_ya; + cloud_N=regN "wingu" li_ya; + count_V2=regV "hesabu"; + dull_A=iregA "butu" "butu" ; + dust_N=regN "fumbi" li_ya; + --easy_A2V= regA "epesi"; + empty_A=regA "tupu" ; + factory_N=regN "banda" i_zi; + fear_VS=regV "ogopa"; + feather_N=regN "unyoya" u_ya; + fight_V2=regV "pigana"; + float_V=regV "elea"; + floor_N=iregN "sakafu" "sakafu" i_zi; + flow_V=regV "tiririk"; + flower_N=regN "ua" li_ya; + fly_V=regV"pepea"; + fog_N=regN "ukungu" u_ya; + forget_V2=regV "sahau"; + freeze_V=regV"ganda"; + fridge_N=iregN "friji" "friji" i_zi; + fruit_N=regN "zao" u_ya; + fun_AV=regA "kejeli"; + give_V3=regV "patiana"; + glove_N=iregN "glavu" "glavu" i_zi; + grammar_N=iregN "sarafi" "sarafi" i_zi; + guts_N= regN "tumbo" li_ya; --confirm the tranlation + harbour_N=regN"bandari" li_ya; + hate_V2=regV"chukia"; + hit_V2=regV "gonga"; + hold_V2=regV "shika"; + hope_VS=regV "tumai"; + horn_N=iregN "pembe" " Pembe" i_zi; + horse_N=iregN "farasi" "farasi" a_wa; + hunt_V2=regV "saka"; + industry_N=regN "kiwanda" ki_vi; + iron_N=regN "chuma" ki_vi; + know_VQ=regV "fahamu"; + know_VS=regV "jua"; + lake_N=regN "ziwa" li_ya; + language_N=regN "lugha" u_zi; + leather_N=iregN "ngozi" "ngozi" i_zi; + leave_V2=regV "achwa"; + left_Ord= mkOrd "kushoto"; --what is the translation + lie_V=regV "daganya"; + like_V2=regV "pendea"; + live_V=regV "penda"; + liver_N=regN "ini" li_ya; + lose_V2=regV "poteza"; + louse_N=iregN "chawa" "chawa" i_zi; + love_V2=regV "pendwa"; + music_N=regN "muziki" u_i; + newspaper_N=regN "jarida" li_ya; + now_Adv=mkAdv "sasa"; + paint_V2A=regV "paka"; + pen_N=iregN " kalamu" "kalamu" i_zi; + planet_N=iregN "sayari" "sayari" i_zi; + plastic_N=iregN "plastiki" "plastiki" i_zi; + play_V2=regV "cheza"; + probable_AS=regA"kini"; + pull_V2=regV "vuta"; + push_V2=regV "sukuma"; + put_V2=regV "tia"; + queen_N=iregN "malkia" "malkia" a_wa; + radio_N=iregN "redio" "redio" i_zi; + rain_V0=regV "nyesha"; + read_V2=regV "soma"; + ready_A=iregA "tayari" "tayari"; + religion_N=regN "dini" li_ya; + restaurant_N=regN "mkahawa" u_i; + right_Ord= mkOrd"kulia"; + roof_N=regN "paa" li_ya; + rub_V2=regV "sugua"; + rubber_N=regN "mpira" u_i; + rule_N=regN "utawala" u_zi; + say_VS=regV "tamka"; + science_N=iregN "sayansi" "sayansi" i_zi; + scratch_V2=regV "kwaruza"; + sew_V=regV "shona"; + ship_N=iregN "meli" "meli" i_zi; + shirt_N=regN "shati" li_ya; + silver_N=iregN "fedha" "fedha" i_zi; + skin_N=iregN "ngozi" "ngozi" i_zi; + sky_N=regN "anga" li_ya; + smoke_N=iregN "moshi" "moshi" u_zi; + snow_N=iregN "theluji" "theluji" i_zi; + sock_N=iregN "soksi" "soksi" i_zi; + spit_V=regV"tema"; + split_V2=regV"pasua"; + squeeze_V2=regV "finya"; + stab_V2=regV" tofua"; + steel_N=regN "chuma" ki_vi; + stick_N=regN "kijiti" ki_vi; + stone_N=iregN " jiwe" "mawe" li_ya; + stove_N=iregN "jiko" "meko" li_ya; + suck_V2=regV "fyonza"; + switch8off_V2=regV "poesha"; + switch8on_V2=regV "akisha"; + tail_N=regN "mkia" u_i; + talk_V3=regV "ongea"; + television_N=iregN "televisheni" " televisheni" i_zi; + throw_V2=regV "tupa"; + tie_V2=regV "funga"; + train_N=iregN "gari ya moshi" "magari ya moshi" li_ya; + turn_V=regV "geuka"; + uncertain_A=iregA "geugeu" "geugeu"; + university_N=iregN "chuo kikuu" "vyuo vikuu" ki_vi; + village_N=regN "kitongoji" ki_vi; + vomit_V=regV "tapika"; + watch_V2=regV "dhibiti"; + wide_A=iregA "panapana" "panapana"; + wine_N=regN "mvinyo" u_i; + wing_N=regN"bawa" li_ya; + wipe_V2=regV"futa"; + wonder_VQ=regV "shangaa"; + wood_N=regN "mti" u_i; + worm_N=regN "funza" li_ya; + + +oper + aboutP = mkPrep "juu ya" ; + atP = mkPrep "vala ve" ; + forP = mkPrep "for" ; + fromP = mkPrep "kutoka" ; + inP = mkPrep "ndani" ; + onP = mkPrep "juu" ; + toP = mkPrep "hadi" ; + +} ; diff --git a/src/kiswahili/MorphoKis.gf b/src/kiswahili/MorphoKis.gf new file mode 100644 index 000000000..0b2e0dd08 --- /dev/null +++ b/src/kiswahili/MorphoKis.gf @@ -0,0 +1,351 @@ +--# -path=.:../../prelude + +--1 Kiswahili morphology Resource Morphology +-- +-- Benson Kituku 2017-2018 + + +resource MorphoKis = CommonBantu ,ResKis +** open Prelude, Predef +in { + + flags optimize=all ; + oper + + Many_prefix : Gender -> Str = \g -> + case of { + => "we" ; + => "mi" ; + => "nyi" ; + => "pe" ; + => "kwi" ; + => "vi" ; + | => "nyi" ; + | => "mwi" ; + | | => "me" + } ; + + + Few_prefix : Gender -> Str = \g -> + case of { + => "wa" ; + => "mi" ; + => "" ; + => "pa" ; + => "ku" ; + => "vi" ; + | => "" ; + | => "m" ; + | | => "ma" + } ; + + Detsomesgprefix : Gender -> Str = \g -> + case of { + => "li" ; + => "ki" ; + => "me"; + => "pe" ; + => "kwi" ; + | => "nyi" ; + |||| | => "mwi" + + } ; + +Detsomeplprefix : Gender -> Str = \g -> + case of { + => "we" ; + => "mi" ; + => "nyi" ; + => "pe" ; + => "kwi" ; + => "vi" ; + | => "nye" ; + | => "mwi" ; + | | => "me" + + } ; + + + + + mkNum : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardprefix g + two ; + NOrd => \\g => Ordprefix g ++ two} ; + teen => table {NCard =>\\g =>"kumi na" ++ Cardprefix g + two ; + NOrd => \\g => Ordprefix g ++ "kumi na" ++ Cardprefix g + two} ; + ten => table {NCard =>\\g =>second ++"na" ++ Cardprefix g + two ; + NOrd => \\g => Ordprefix g ++ second ++"na" ++ Cardprefix g + two}; + hund => table {NCard =>\\g =>"mia " ++ two ; + NOrd => \\g => Ordprefix g ++ "mia " ++ two } + } + } ; + + mkNumn : Str -> Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, twelve, second -> + {s = table { + unit => table {NCard =>\\g => Cardtwoprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"kumi na" ++ Cardtwoprefix g + two; + NOrd => \\g => Ordprefix g ++ "kumi na" ++ Cardtwoprefix g + two} ; + ten => table {NCard =>\\g =>twelve ; + NOrd => \\g => Ordprefix g ++ twelve}; + hund => table {NCard =>\\g =>"mia mb " + two ; + NOrd => \\g => Ordprefix g ++ "mia mb" + two} + } + } ; + + mkNume : Str -> Str -> {s : DForm => CardOrd => Gender => Str} = + \two, second -> + {s = table { + unit => table {NCard =>\\g => Cardoneprefix g + two ; + NOrd => \\g => Ordprefix g ++ second} ; + teen => table {NCard =>\\g =>"kumi na" ++ Cardoneprefix g + two ; + NOrd => \\g => Ordprefix g ++ "kumi na" ++ Cardoneprefix g + two} ; + ten => table {NCard =>\\g =>"kumi" ; + NOrd => \\g => Ordprefix g ++ "kumi"}; + hund => table {NCard =>\\g =>"mia " ++ two ; + NOrd => \\g => Ordprefix g ++ "mia" ++ two} + } + } ; + + regNum : Str ->Str -> {s : DForm => CardOrd => Gender => Str} = + \six,sixth -> {s = table { + unit => table {NCard =>\\g => six ; + NOrd => \\g => Ordprefix g ++ six} ; + teen => table {NCard =>\\g =>"kumi na" ++ six ; + NOrd => \\g => Ordprefix g ++ "kumi na" ++ six} ; + ten => table {NCard =>\\g =>sixth ++"na" ++ six ; + NOrd => \\g => Ordprefix g ++ sixth ++"na" ++ six }; + hund => table {NCard =>\\g =>"mia " ++ six ; + NOrd => \\g => Ordprefix g ++ "mia" ++ six} + } } ; + + + regCardOrd : Str -> {s : CardOrd => Gender => Str} = \ten -> + {s = table {NCard => \\g => ten ; + NOrd =>\\g => Ordprefix g ++ ten } } ; + + regCardone : Str -> Str -> {s : CardOrd => Gender => Str} = \ten,one -> + {s = table {NCard => \\g => ten ++ Cardoneprefix g + one ; + NOrd =>\\g => Ordprefix g ++ ten ++ Cardoneprefix g + one } } ; + + mkCard : CardOrd -> Str -> Gender => Str = \o,ten -> + (regCardOrd ten).s ! o ; + + regN : Str ->Gender -> Noun = \w, g -> let wpl = case g of { + G1=>case w of { + "mwa" + _ => PrefixPlNom G1 + Predef.drop 3 w ; + "mwi" + _ => "we" + Predef.drop 3 w ; + "ki" + _ => PrefixPlNom G4 + Predef.drop 2 w ; + "m" + _ => PrefixPlNom G1 + Predef.drop 1 w ; + _ => w }; + G2=>case w of { + "mw" + _ => PrefixPlNom G2 + Predef.drop 2 w ; + "mu" + _ => PrefixPlNom G2 + Predef.drop 2 w ; + _ => PrefixPlNom G2 + Predef.drop 1 w }; + G4=> case w of { + "ki" + _ => PrefixPlNom G4 + Predef.drop 2 w ; + "ch" + _ => "vy" + Predef.drop 2 w ; + _ => w }; + G6 |G8 => PrefixPlNom g + Predef.drop 1 w; + G11 |G12|G13 => "" ; + _ => PrefixPlNom g + w }; + + in iregN w wpl g ; + + + + + + iregN :Str-> Str ->Gender -> Noun= \man,men,g -> { -- for irregular noun + s = table{Sg => table{Nom => man ; + Loc=> man + "ni" | men + "ni" }; + Pl => table{Nom => men ; Loc=> ""}} ; + g = g + } ; + + regA:Str -> {s : AForm => Str} = \seo -> {s = table { + AAdj G1 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"o"|"u" => VowelAdjprefix G1 Sg + seo; + _ => ConsonantAdjprefix G1 Sg + seo }; + AAdj G1 Pl =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G1 Pl + seo; + "i" => VoweliAdjprefix G1 Pl + seo; + _ => ConsonantAdjprefix G1 Pl + seo }; + + AAdj G2 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"o"|"u" => VowelAdjprefix G2 Sg + seo; + _ => ConsonantAdjprefix G2 Sg + seo }; + AAdj G2 Pl =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G2 Pl + seo; + "i" => VoweliAdjprefix G2 Pl + seo; + _ => ConsonantAdjprefix G2 Pl + seo }; + AAdj G3 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"o"|"u" => VowelAdjprefix G3 Sg + seo; + _ => ConsonantAdjprefix G3 Sg + seo }; + AAdj G3 Pl =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G3 Pl + seo; + "i" => VoweliAdjprefix G3 Pl + seo; + _ => ConsonantAdjprefix G3 Pl + seo }; + + AAdj G4 n =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G4 n + seo; + "i" => VoweliAdjprefix G4 n + seo; + _ => ConsonantAdjprefix G4 n + seo }; + AAdj G5 n => case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G5 n + seo; + "i" => "ny" + Predef.drop 1 seo; + "d"|"g"|"z" => "n" + seo; + "b"|"p"|"v" => "m" + seo; + _ => ConsonantAdjprefix G5 n + seo }; + + AAdj G6 Sg=>case Predef.take 1 seo of { + "a"|"e"|"i"|"o"|"u" => VowelAdjprefix G6 Sg + seo; + _ => ConsonantAdjprefix G6 Sg + seo }; + AAdj G6 Pl =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G6 Pl + seo; + "i" => "ny" + Predef.drop 1 seo; + "d"|"g"|"z" => "n" + seo; + "b"|"p"|"v" => "m" + seo; + _ => ConsonantAdjprefix G6 Pl + seo }; + + AAdj G7 n =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G7 n + seo; + "i" => VoweliAdjprefix G7 n + seo; + _ => ConsonantAdjprefix G7 n + seo }; + AAdj G8 n =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G8 n + seo; + "i" => VoweliAdjprefix G8 n + seo; + _ => ConsonantAdjprefix G8 n + seo }; + AAdj G9 n =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G9 n + seo; + "i" => VoweliAdjprefix G9 n + seo; + _ => ConsonantAdjprefix G9 n + seo }; + AAdj G10 n =>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G9 n + seo; + "i" => VoweliAdjprefix G9 n + seo; + _ => ConsonantAdjprefix G9 n + seo }; + + AAdj G11 Sg=>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G11 Sg + seo; + "i" => VoweliAdjprefix G11 Sg + seo; + _ => ConsonantAdjprefix G11 Sg + seo }; + + AAdj G12 Sg=>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G12 Sg + seo; + "i" => VoweliAdjprefix G12 Sg + seo; + _ => ConsonantAdjprefix G12 Sg + seo }; + AAdj G13 Sg=>case Predef.take 1 seo of { + "a"|"e"|"o"|"u" => VowelAdjprefix G13 Sg + seo; + "i" => VoweliAdjprefix G13 Sg + seo; + _ => ConsonantAdjprefix G13 Sg + seo }; + AAdj _ Pl =>[] }}; + + + + + +iregA : Str-> Str -> {s : AForm => Str} = \seo,seoo -> { + s = table { + AAdj g Sg=> seo; + AAdj g Pl => seoo} }; + + + cregA : Str-> {s : AForm => Str} = \seo -> { + s = table { + 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 + } + }; + }; + + 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} ; + + 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" + +}; + + + 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" + } ; + + 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" + } ; +} + diff --git a/src/kiswahili/NounKis.gf b/src/kiswahili/NounKis.gf new file mode 100644 index 000000000..45f24b93e --- /dev/null +++ b/src/kiswahili/NounKis.gf @@ -0,0 +1,2 @@ +concrete NounKis of Noun = + CatKis ** NounBantu with (Structural = StructuralKis), (ResBantu = ResKis); diff --git a/src/kiswahili/NumeralKis.gf b/src/kiswahili/NumeralKis.gf new file mode 100644 index 000000000..9cd45e2aa --- /dev/null +++ b/src/kiswahili/NumeralKis.gf @@ -0,0 +1,87 @@ +concrete NumeralKis of Numeral = CatKis [Numeral,Digits] ** +open Prelude,DiffKis,MorphoKis in { + +lincat + Digit = {s : DForm => CardOrd => Gender => Str} ; + Sub10 = {s : DForm => CardOrd => Gender => Str ; n : Number} ; + Sub100 = {s : CardOrd => Gender => Str ; n : Number} ; + Sub1000 = {s : CardOrd => Gender => Str ; n : Number} ; + Sub1000000 = {s : CardOrd => Gender => Str ; n : Number} ; + +lin num x = x ; +lin n2 = mkNumn "ili" "ishirini" "pili" ; +lin n3 = mkNum "tatu" "thelathini" ; +lin n4 = mkNum "nne" "arobaini" ; +lin n5 = mkNum "tano" "hamsini" ; +lin n6 = regNum "sita" "sitini"; +lin n7 = regNum "saba" "sabini"; +lin n8 = regNum "nane" "themanini"; +lin n9 = regNum "tisa" "tisini" ; + +lin pot01 = mkNume "moja" "kwanza" ** {n = Sg} ; +lin pot0 d = d ** {n = Pl} ; +lin pot110 = regCardOrd "kumi" ** {n = Pl} ; +lin pot111 = regCardone "kumi na" "moja" ** {n = Pl} ; -- creat another function to be gender specific +lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; +lin pot1plus d e = { s = table { + NCard => \\g => d.s ! ten ! NCard ! g ++ "na"++ e.s ! unit ! NCard ! g ; + NOrd => \\g =>Ordprefix g++ d.s ! ten ! NCard ! g ++ "na"++ e.s ! unit ! NCard ! g } ; + n = Pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hund} ** {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 } ; + n = Pl} ; + lin pot2as3 n = n ; +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 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} ; + +-- numerals as sequences of digits0' + + lincat + Dig = TDigit ; + + lin + IDig d = d ; + + IIDig d i = { + --s = \\o,g => d.s ! NCard ! g ++ i.s ! o ! g ; + s = table {NCard => \\g => d.s! NCard ! g ++ BIND ++ i.s ! NCard ! g ; + NOrd => \\g => d.s! NOrd! g ++ BIND ++ i.s !NCard! g } ; + n = Pl + } ; + + D_0 = mkDig "0" ; + D_1 = mk3Dig "1" "1" Sg ; + D_2 = mkDig "2" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + + oper + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; + + mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { + s = table {NCard => \\g => c ; NOrd => \\g =>Ordprefix g ++ o} ; --Ordprefix g ++ + n = n} ; + + TDigit = { + n : Number ; + s : CardOrd => Gender => Str + } ; + +} diff --git a/src/kiswahili/ParadigmsKis.gf b/src/kiswahili/ParadigmsKis.gf new file mode 100644 index 000000000..bd1e894ff --- /dev/null +++ b/src/kiswahili/ParadigmsKis.gf @@ -0,0 +1,437 @@ +--# -path=.:../abstract:../../prelude:../common + +resource ParadigmsKis = open + (Predef=Predef), + Prelude, + MorphoKis, + ResKis, + CatKis + in { + +oper + Gender : Type ; + a_wa : Gender ; --m-wa + u_i : Gender ; --m-mi + li_ya : Gender ; --ji-ma + ki_vi : Gender ; --kivi + i_zi : Gender ; -- nn + u_zi : Gender ; --uu + u_u : Gender ; --uu + u_ya : Gender; + ya_ya : Gender; + i_i : Gender; + ku_ku : Gender ; --uu + pa_pa : Gender ; --uu + mu_mu : Gender ; --uu + +-- To abstract over number names, we define the following. + + Number : Type ; + + singular : Number ; + plural : Number ; + +-- To abstract over case names, we define the following. + + Case : Type ; --% + + nominative : Case ; --% + locative : Case ; --% + + + + npNumber : NP -> Number ; -- exctract the number of a noun phrase + + +--2 Nouns + +-- Nouns are constructed by the function $mkN$, which takes a varying +-- number of arguments. + + mkN : overload { + mkN : (flash : Str) -> Gender -> N ; --regular plural + mkN : (man,men : Str) ->Gender -> N ; -- irregular plural + mkN : Str -> N -> N -- e.g. chuo + kikuu compound noun + } ; + +--3 Relational nouns + mkN2 : overload { + mkN2 : N -> Prep -> N2 ; + mkN2 : N -> Str -> N2 ; + mkN2 : N -> N2 ; + mkN2 : N -> (Gender => Number => Str)-> N2 ; + } ; + +oper dfltGender : Gender = G1 ; + dfltNumber : Number = Sg ; + +-- Three-place relational nouns ("the connection from x to y") need two prepositions. + + mkN3 : N -> Prep -> Prep -> N3 ; -- e.g. connection from x to y + + + +--3 Proper names and noun phrases +-- +-- Proper names, with a regular genitive, are formed from strings. + + mkPN : overload { + + mkPN : Str ->Gender -> PN ; + +-- Sometimes a common noun can be reused as a proper name, e.g. "Bank" + + mkPN : N -> PN --% + } ; + +--3 Determiners and quantifiers + + mkOrd : Str -> Ord ; --% + +--2 Adjectives + + mkA : overload { + mkA : (happy : Str) -> A ; + mkA : (fat,fatter : Str) -> A ; -- irreg. + } ; + + +--3 Two-place adjectives + + mkA2 : overload { + mkA2 : A -> Prep -> A2 ; -- absent from + mkA2 : A -> Str -> A2 ; -- absent from --% + mkA2 : Str -> Prep -> A2 ; -- absent from --% + mkA2 : Str -> Str -> A2 -- absent from --% + + } ; + + +--2 Adverbs + +-- Adverbs are not inflected. Most lexical ones have position +-- after the verb. Some can be preverbal (e.g. "always"). + + mkAdv : Str -> Adv ; -- e.g. today + mkAdV : Str -> AdV ; -- e.g. always + +-- Adverbs modifying adjectives and sentences can also be formed. + + mkAdA : Str -> AdA ; -- e.g. quite + +-- Adverbs modifying numerals + + mkAdN : Str -> AdN ; -- e.g. approximately + +--2 Prepositions + + mkPrep : overload { + mkPrep : Str -> Prep ; + mkPrep : (Gender => Number => Str) -> Prep ; + } ; + + noPrep : Prep ; -- no preposition + +-- (These two functions are synonyms.) + +--2 Conjunctions +-- + + mkConj : overload { + mkConj : Str -> Conj ; -- and (plural agreement) --% + mkConj : Str -> Number -> Conj ; -- or (agrement number given as argument) --% + mkConj : Str -> Str -> Conj ; -- both ... and (plural) --% + mkConj : Str -> Str -> Number -> Conj ; -- either ... or (agrement number given as argument) --% + } ; + +--2 Verbs +-- + +-- Verbs are constructed by the function $mkV$, which takes a varying +-- number of arguments. + + mkV : overload { + mkV : (cry : Str) -> V ; -- regular, incl. cry-cries, kiss-kisses etc + mkV : Str -> V -> V ; -- fix compound, e.g. under+take + }; + + + + +--3 Two-place verbs +-- +-- Two-place verbs need a preposition, except the special case with direct object. +-- (transitive verbs). Notice that a particle comes from the $V$.-} + + mkV2 : overload { + mkV2 : Str -> V2 ; -- kill --% + mkV2 : V -> V2 ; -- transitive, e.g. hit + mkV2 : V -> Prep -> V2 ; -- with preposiiton, e.g. believe in + mkV2 : V -> Str -> V2 ; -- believe in --% + mkV2 : Str -> Prep -> V2 ; -- believe in --% + mkV2 : Str -> Str -> V2 -- believe in --% + }; + +--3 Three-place verbs +-- +-- Three-place (ditransitive) verbs need two prepositions, of which +-- the first one or both can be absent. + + mkV3 : overload { + mkV3 : V -> V3 ; -- ditransitive, e.g. give,_,_ + mkV3 : V -> Prep -> Prep -> V3 ; -- two prepositions, e.g. speak, with, about + mkV3 : V -> Prep -> V3 ; -- give,_,to --% + mkV3 : V -> Str -> V3 ; -- give,_,to --% + mkV3 : Str -> Str -> V3 ; -- give,_,to --% + mkV3 : Str -> V3 ; -- give,_,_ --% + }; + + +--2 Other categories + +mkSubj : Str -> Subj = \s -> lin Subj {s = s} ; --% +mkInterj : Str -> Interj + = \s -> lin Interj (ss s) ; + +--. +--2 Definitions of paradigms +-- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + + Gender = MorphoKis.Gender ; + Number = MorphoKis.Number ; + Case = MorphoKis.NPCase ; + a_wa = G1 ;--% + u_i = G2 ; + li_ya = G3 ; + ki_vi = G4 ; + i_zi = G5 ; + u_zi = G6 ; + u_u = G7 ; + u_ya = G8 ; + ya_ya = G9 ; + i_i =G10 ; + ku_ku = G11; + pa_pa =G12 ; + mu_mu =G13; + singular = Sg ; + plural = Pl ; + nominative = npNom ; + locative = npLoc ; + + npNumber np = (agrFeatures np.a).n ; + + + regN = MorphoKis.regN ; + iregN = MorphoKis.iregN ; + + + compoundN s n = lin N {s = \\x,y => s ++ n.s ! x ! y ; g=n.g} ; + + mkPN = overload { + -- mkPN : Str -> PN = regPN ; + mkPN : Str -> Gender -> PN = regPN; + mkPN : N -> PN = nounPN + } ; + + +mkN2 = overload { + mkN2 : N -> Prep -> N2 = prepN2 ; + mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPrep s); + mkN2 : N -> N2 = \n -> prepN2 n (mkPrep mkPrepof ) ; + mkN2 : N -> (Number =>Gender => Str)-> N2= \n,s -> prepN2 n (mkPrep mkPrepof) ; + } ; + + prepN2 = \n,p -> lin N2 (n ** {c2 = p}) ; + regN2 = \n -> (prepN2 n (mkPrep mkPrepof )) ; + mkN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; + mkPrepof : Number => Gender => Str = + table Number { Sg => table { G1 |G2|G6|G7 |G8 => "wa" ; + G3=> "la" ; + G4 => "cha" ; + G5 => "ya" ; + G11 => "pa"; + G12 => "kwa"; + G13 => "mwa"; + _ => ""} ; + + Pl => table { G1 => "wa" ; + G2|G3 |G8 |G9 |G10 => "ya" ; + G4 => "vya" ; + G5|G6 => "za" ; + _ => ""} } ; + + + + +--3 Relational common noun phrases + cnN2 : CN -> Prep -> N2 ; + cnN3 : CN -> Prep -> Prep -> N3 ; + + + cnN2 = \n,p -> lin N2 (n ** {c2 = p}) ; + cnN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; + + + regPN n g = lin PN {s = table {Loc => "" ; _ => n} ; g = g} ; + + + nounPN n = lin PN {s = n.s ! singular ; g = n.g} ; + + mkOrd : Str -> Ord = \x -> lin Ord { s =\\g => x}; + + + prepA2 a p = lin A2 (a ** {c2 = p.s!Sg!G1}) ; + + mkAdv x = lin Adv (ss x) ; + mkAdV x = lin AdV (ss x) ; + mkAdA x = lin AdA (ss x) ; + mkAdN x = lin AdN (ss x) ; + + mkPrep = overload { + mkPrep : Str -> Prep = \str -> lin Prep {s = \\n,g => str } ; + mkPrep : (Number => Gender => Str) -> Prep = \t ->lin Prep {s = t} ; + } ; + + noPrep = mkPrep [] ; + {-} mkPrep : Str -> Str -> Prep = \p,q -> lin Prep + {s = table{Sg => table{G1 => p; _=> "" }; + Pl => table{G1 => q; _=> ""}}} ; + prepV2 : V -> Prep -> V2 ; + prepV2 = \v,p -> lin V2 (v ** {c2 = p.s!Sg!G1}) ; + dirV2 : V -> V2 = \v -> prepV2 v noPrep ; + + prepPrepV3 v p q = lin V3 (v ** {c2 = p ; c3 = q}) ; + dirV3 v p = prepPrepV3 v noPrep p ; + dirdirV3 v = dirV3 v noPrep ; + + + mkA2V : A -> Prep -> Prep -> A2V; + A2S, A2V : Type = A2 ; + mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ; + + + mkAV v = v ** { lock_AV = <>} ; + mkAV : A -> AV ; + AS, AV : Type = A ; + + mkAS : A -> AS ; + mkAS v = v ** {lock_AS = <>} ; + + mkVS : V -> VS ; + mkVS v = v ** { lock_VS = <>} ; + + mkVQ : V -> VQ ; + mkVQ v = v ** {lock_VQ = <>} ; + + + -- mkVV : V -> VV ; + -- mkVV v = v ** { lock_VV = <>} ; + + mkVA : V -> VA ; + mkVA v = v ** {lock_VA = <>} ; + + mkV2V : V -> Prep -> Prep -> V2V ; + mkV2V v p q = prepPrepV3 v p q ** {lock_V2V = <>} ; + + mkV2S : V -> Prep -> V2S ; + mkV2S v p = prepV2 v p ** { lock_V2S = <>} ; + + mkV2Q : V -> Prep -> V2Q ; + mkV2Q v p = prepV2 v p ** {lock_V2Q = <>} ; + + mkV2A : V -> Prep -> Prep -> V2A ; + mkV2A v p q = prepPrepV3 v p q ** {lock_V2A = <>} ; + + + mkV0 : V -> V0 ; + V0 : Type ; + V0 : Type = V; + mkV0 v = v ** {lock_V0 = <>} ; +-} +-- pre-overload API and overload definitions + + -- regN : Str ->Gender -> N ; + --iregN : (man,men : Str) ->Gender -> N ; + compoundN : Str -> N -> N ; + + mkN = overload { + mkN : Str ->Gender -> N = \n, g -> lin N (regN n g ); + mkN : (man,men : Str) ->Gender -> N = \s,p,g -> lin N ( iregN s p g) ; + } ; +--mkN : Str -> N -> N = compoundN taken from mkN can be added later if need be +-- Relational nouns ("daughter of x") need a preposition. + + prepN2 : N -> Prep -> N2 ; + +-- The most common preposition is "of", and the following is a +-- shortcut for regular relational nouns with "of". + + regN2 : N -> N2 ; + + regA : Str -> A = \s -> lin A (MorphoKis.regA s) ; + cregA : Str -> A = \s -> lin A (MorphoKis.cregA s) ; + iregA : (fat,fatter : Str) -> A =\a,b -> lin A (MorphoKis.iregA a b); + mkA = overload { + mkA : Str -> A = \a -> lin A (regA a |cregA a); + mkA : (fat,fatter : Str) -> A =\a,b -> lin A (iregA a b); + } ; + + prepA2 : A -> Prep -> A2 ; + + mkA2 = overload { + mkA2 : A -> Prep -> A2 = prepA2 ; + mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPrep p) ; + mkA2 : Str -> Prep -> A2 = \a,p -> prepA2 (regA a) p; + mkA2 : Str -> Str -> A2 = \a,p -> prepA2 (regA a) (mkPrep p); + } ; + + + regV=MorphoKis.regV ; +{- + mkV = overload { + mkV : Str -> V =\v ->lin V(regV v) ; + mkV : Str -> V -> V = prefixV + }; + + + prefixV : Str -> V -> V = \p,v -> lin V { s = \\b,vform => p + v.s! b ! vform } ; + mkV2 = overload { + mkV2 : V -> V2 = dirV2 ; + mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; + mkV2 : V -> Prep -> V2 = prepV2; + mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPrep p) ; + mkV2 : Str -> Prep -> V2 = \v,p -> prepV2 (regV v) p ; + mkV2 : Str -> Str -> V2 = \v,p -> prepV2 (regV v) (mkPrep p) + }; + + prepPrepV3 : V -> Prep -> Prep -> V3 ; + dirV3 : V -> Prep -> V3 ; + dirdirV3 : V -> V3 ; + + mkV3 = overload { + mkV3 : V -> Prep -> Prep -> V3 = prepPrepV3 ; + mkV3 : V -> Prep -> V3 = dirV3 ; + mkV3 : V -> Str -> V3 = \v,s -> dirV3 v (mkPrep s); + mkV3 : Str -> Str -> V3 = \v,s -> dirV3 (regV v) (mkPrep s); + mkV3 : V -> V3 = dirdirV3 ; + mkV3 : Str -> V3 = \v -> dirdirV3 (regV v) ; + } ; +-} + mkConj = overload { + mkConj : Str -> Conj = \y -> mk2Conj [] y plural ; + mkConj : Str -> Number -> Conj = \y,n -> mk2Conj [] y n ; + mkConj : Str -> Str -> Conj = \x,y -> mk2Conj x y plural ; + mkConj : Str -> Str -> Number -> Conj = mk2Conj ; + } ; + + mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> + lin Conj (sd2 x y ** {n = n}) ; + + regPN : Str ->Gender -> PN ; + nounPN : N -> PN ; + + + +} diff --git a/src/kiswahili/PhraseKis.gf b/src/kiswahili/PhraseKis.gf new file mode 100644 index 000000000..265316439 --- /dev/null +++ b/src/kiswahili/PhraseKis.gf @@ -0,0 +1,3 @@ +concrete PhraseKis of Phrase = CatKis ** PhraseBantu with + (ResBantu = ResKis); + \ No newline at end of file diff --git a/src/kiswahili/QuestionKis.gf b/src/kiswahili/QuestionKis.gf new file mode 100644 index 000000000..b3c2c9cb5 --- /dev/null +++ b/src/kiswahili/QuestionKis.gf @@ -0,0 +1,2 @@ +concrete QuestionKis of Question = CatKis ** QuestionBantu with + (ResBantu = ResKis); \ No newline at end of file diff --git a/src/kiswahili/RelativeKis.gf b/src/kiswahili/RelativeKis.gf new file mode 100644 index 000000000..e10032bb8 --- /dev/null +++ b/src/kiswahili/RelativeKis.gf @@ -0,0 +1,2 @@ +concrete RelativeKis of Relative = CatKis ** RelativeBantu with + (ResBantu = ResKis); \ No newline at end of file diff --git a/src/kiswahili/ResKis.gf b/src/kiswahili/ResKis.gf new file mode 100644 index 000000000..94a501241 --- /dev/null +++ b/src/kiswahili/ResKis.gf @@ -0,0 +1,8 @@ +--# -path=.:../abstract:../common:../../prelude + +--1 Swalish auxiliary operations. + +instance ResKis of ResBantu = DiffKis, CommonBantu ** open Prelude in { + +} ; + diff --git a/src/kiswahili/SentenceKis.gf b/src/kiswahili/SentenceKis.gf new file mode 100644 index 000000000..ef3ddc737 --- /dev/null +++ b/src/kiswahili/SentenceKis.gf @@ -0,0 +1,3 @@ +concrete SentenceKis of Sentence = CatKis ** SentenceBantu with + (ResBantu = ResKis); + diff --git a/src/kiswahili/StructuralKis.gf b/src/kiswahili/StructuralKis.gf new file mode 100644 index 000000000..2967c2fc0 --- /dev/null +++ b/src/kiswahili/StructuralKis.gf @@ -0,0 +1,200 @@ +concrete StructuralKis of Structural = CatKis ** + open MorphoKis, ParadigmsKis, + (C = ConstructX), Prelude in { + flags optimize=all ; + lin + above_Prep = mkPrep "juu ya" ; + after_Prep = mkPrep "baada ya" ; + all_Predet = {s = \\g => Allpredetprefix g + "ote"} ; + almost_AdA = mkAdA "karibu " ; + almost_AdN = mkAdN "nusura " ; + although_Subj = ss "ingawa" ; + always_AdV = mkAdV "dawama" ; + and_Conj = mkConj "na" ; + because_Subj = ss "maana" ; + before_Prep = mkPrep "kabla ya" ; + behind_Prep = mkPrep "baada" ; + between_Prep = mkPrep "katikati" ; + both7and_DConj = mkConj "eli" "na"; + but_PConj = ss "ila" ; + by8agent_Prep = mkPrep "kwa" ; + by8means_Prep = mkPrep "kwa" ; +-- can8know_VV, can_VV = { + during_Prep = mkPrep "katika" ; + either7or_DConj = mkConj "ama" singular ; + everybody_NP = regNP "kila mtu" a_wa singular ; + every_Det = { s = table {Sub => "kila"; Obj g =>[]} ;n = Sg} ; + everything_NP = regNP "kila kitu" ki_vi singular ; + everywhere_Adv = mkAdv "kila sehemu" ; + few_Det = {s = table {Obj g => Few_prefix g + "chache" ; + Sub => [] }; + n= Pl + } ; + for_Prep = mkPrep nonExist ; + 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" ; + 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}; + --less_CAdv = C.mkCAdv "kasoro" ; + much_Det, many_Det = { s = table { + Obj g => Many_prefix g + "ngi" ; + Sub => []} ; + n= Pl + } ; + more_Adv = mkAdv "zaidi" ; + most_Predet = {s = \\g => MorphoKis.Mostpredetprefix g + "ngi"} ; + -- must_VV = { +---b no_Phr = ss "no" ; + no_Utt = ss "hapana" ; + on_Prep = mkPrep "juu ya" ; + one_Quant = {s = \\n,g => "moja" } ; + only_Predet = {s = \\g => "tu" } ; + or_Conj = mkConj "kana" singular ; + otherwise_PConj = ss "ila" ; + please_Voc = ss "tafadhari" ; + part_Prep, possess_Prep = let + questo : ParadigmsKis.Number => MorphoKis.Gender => Str = table { + Sg => \\g=> case of { => "la" ; + => "cha" ; + => "ya" ; + => "pa"; + => "kwa"; + => "mwa"; + ||| | => "wa" ; + _ => ""}; + + Pl => \\g=> case of{ => "wa" ; + => "vya" ; + | => "za" ; + | | | | => "ya"; + _ => ""}} + in { s= questo}; + quite_Adv = mkAdv "kabisa" ; + she_Pron = mkPron "yeye" "ake" G1 Sg P3; + so_AdA = mkAdA "so" ; + somebody_NP = regNP "mtu fulani" a_wa singular; + someSg_Det = { s = table { + Obj g => Detsomesgprefix g + "ngi"; + Sub => []} ; + n= Sg + } ; + somePl_Det = { s = table { + Obj g => Detsomeplprefix g + "ngi" ; + Sub => []} ; + n= Pl + } ; + something_NP = regNP "kitu fulani" ki_vi singular ; + somewhere_Adv = mkAdv "seheme fulani" ; + that_Quant = let + questo : ParadigmsKis.Number => MorphoKis.Gender => Str = table { + Sg => \\g=> case of { + => "huyo" ; + => "huo"; + => "hilo"; + => "hicho"; + => "hiyo"; + => "huo"; + => "huo"; + => "huo" ; + => "hapo"; + => "huko"; + => "humo"; + | => "" + }; + + Pl => \\g=> case of{ + => "hao" ; + => "hiyo"; + => "hayo"; + => "hivyo"; + => "hizo"; + => "hizo"; + => "hayo" ; + => "hiyo"; + => "huko"; + => "humo"; + _ => "" + } + + }; + in { + s = questo ; + } ; + there_Adv = mkAdv "hapo" ; + there7to_Adv = mkAdv "hapa kuvika" ; + there7from_Adv = mkAdv ["hapa kutoka"] ; + therefore_PConj = ss "kwa ajili" ; + they_Pron =mkPron "wao" "ao" G1 Pl P3 ; + this_Quant = let + questo : ParadigmsKis.Number => MorphoKis.Gender => Str = table { + Sg => \\g=> case of { + => "huyu" ; + => "hapa" ; + => "huku" ; + => "humu" ; + => "hiki"; + => "hili"; + => "hii"; + |=> ""; + || | => "huu" + }; + + Pl => \\g=> case of{ + => "hawa" ; + => "hivi"; + | => "hizi"; + | => "hii"; + || => "haya"; + _=> "" + } + + } + in { + s = questo ; + } ; + through_Prep = mkPrep "kuvitila" ; + too_AdA = mkAdA "vile" ; + to_Prep = mkPrep "kuvika" ; + under_Prep = mkPrep "chini ya" ; + very_AdA = mkAdA "mno" ; + -- want_VV = mkVV (regV "enda") ; + 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" ; + where_IAdv = ss "wapi" ; + which_IQuant = {s = \\_ => "wapi"} ; +---b whichPl_IDet = mkDeterminer plural ["which"] ; +---b whichSg_IDet = mkDeterminer singular ["which"] ; + -- whoPl_IP = mkIP "uu" "whom" "whose" plural ; + -- whoSg_IP = mkIP "who" "whom" "whose" singular ; + why_IAdv = ss "kwa nini" ; + without_Prep = mkPrep "bila" ; + with_Prep = mkPrep "pamoja na" ; + --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 ; + 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 ; + 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" ; + lin language_title_Utt = ss "kiswahili" ; +} + diff --git a/src/kiswahili/VerbKis.gf b/src/kiswahili/VerbKis.gf new file mode 100644 index 000000000..b33f1b827 --- /dev/null +++ b/src/kiswahili/VerbKis.gf @@ -0,0 +1,2 @@ +concrete VerbKis of Verb = CatKis ** VerbBantu with + (ResBantu = ResKis);