diff --git a/lib/doc/status.html b/lib/doc/status.html index da94dbc20..892dfe10c 100644 --- a/lib/doc/status.html +++ b/lib/doc/status.html @@ -7,7 +7,7 @@

The Status of the GF Resource Grammar Library

Aarne Ranta
-20101222 +20110112

@@ -346,6 +346,19 @@ are marked in the table *AR,IA,TS +Swa ++ +- +- +- +- +- +- +- +- +*WN, JM + + Swe + + @@ -463,6 +476,7 @@ JK Janna Khegai, JS Jordi Saludes, KA Krasimir Angelov, KP Kuchi Prasad, +JM Juliet Mutahi, LPj Laurette Pretorius Jr, LPs Laurette Pretorius Sr, MF Markus Forsberg, @@ -474,7 +488,8 @@ RE Ramona Enache, SC Server Cimen, SM Sofy Moradi, SV Shafqat Virk, -TH Therese Söderberg +TH Therese Söderberg, +WN Wanjiku Ng'ang'a

Rules

diff --git a/lib/doc/status.txt b/lib/doc/status.txt index 76022d1fa..d115bc075 100644 --- a/lib/doc/status.txt +++ b/lib/doc/status.txt @@ -38,6 +38,7 @@ are marked in the table | Ron | + | + | ++ | + | + | + | + | - | - | *RE | Rus | + | + | ++ | + | + | + | - | - | - | JK | Spa | + | + | ++ | + | + | + | + | + | - | *AR,IA,TS +| Swa | + | - | - | - | - | - | - | - | - | *WN, JM | Swe | + | + | ++ | + | + | + | + | + | + | *AR,MF | Tha | + | - | - | - | - | - | - | - | - | *AR | Tsn | - | - | - | - | - | - | - | - | - | *LPs,AB @@ -85,6 +86,7 @@ JK Janna Khegai, JS Jordi Saludes, KA Krasimir Angelov, KP Kuchi Prasad, +JM Juliet Mutahi, LPj Laurette Pretorius Jr, LPs Laurette Pretorius Sr, MF Markus Forsberg, @@ -96,8 +98,8 @@ RE Ramona Enache, SC Server Cimen, SM Sofy Moradi, SV Shafqat Virk, -TH Therese Söderberg - +TH Therese Söderberg, +WN Wanjiku Ng'ang'a diff --git a/lib/src/swahili/AdjectiveSwa.gf b/lib/src/swahili/AdjectiveSwa.gf new file mode 100644 index 000000000..4f770fc10 --- /dev/null +++ b/lib/src/swahili/AdjectiveSwa.gf @@ -0,0 +1,11 @@ +concrete AdjectiveSwa of Adjective = CatSwa ** open ResSwa, Prelude , ParamX in { + + lin + + PositA a = { + s = a.s ! Posit ; + } ; + + -- PositA a = a; + +} diff --git a/lib/src/swahili/AdverbSwa.gf b/lib/src/swahili/AdverbSwa.gf new file mode 100644 index 000000000..48439fcd5 --- /dev/null +++ b/lib/src/swahili/AdverbSwa.gf @@ -0,0 +1,12 @@ +concrete AdverbSwa of Adverb = CatSwa ** open ResSwa, Prelude in { + + lin + +-- PositAdvAdj : A -> Adv ; -- vizuri + + PositAdvAdj a = { + s = a.s ! Posit ! AA + } ; + + +} diff --git a/lib/src/swahili/BackwardSwa.gf b/lib/src/swahili/BackwardSwa.gf new file mode 100644 index 000000000..6f3f76854 --- /dev/null +++ b/lib/src/swahili/BackwardSwa.gf @@ -0,0 +1,4 @@ +concrete BackwardSwa of Backward = CatSwa ** open ResSwa in { + + +} diff --git a/lib/src/swahili/CatSwa.gf b/lib/src/swahili/CatSwa.gf new file mode 100644 index 000000000..175841227 --- /dev/null +++ b/lib/src/swahili/CatSwa.gf @@ -0,0 +1,45 @@ +--# -path=.:../abstract:../../prelude:../common +concrete CatSwa of Cat = CommonX ** open ResSwa, Prelude in { + + flags optimize=all_subs ; + + lincat + + CN = {s,s1,s2 : Number => Str; g : Gender ; anim : Animacy ; hasAdj : Bool } ; + N = {s : Number => Str; g : Gender ; anim : Animacy } ; + N2 = {s : Number => Str; g : Gender ; anim : Animacy } ** {c2 : Str} ; + N3 = {s : Number => Str; g : Gender ; anim : Animacy } ** {c2,c3 : Str} ; + Pron = {s :Number => Str ; p : Person}; + V,VA = Verb ; -- = {s : VForm => Str} ; + V2 = Verb ** {c2 : Str} ; + NP = {s : Case => Str ; a : Agr} ; + A = {s : Degree => AForm => Str} ; + AP = {s : AForm => Str} ; + Det = {s : Gender => Case => Animacy => Str ; n : Number } ; + Quant = {s : Number => Gender => Animacy => Case => Str} ; + Predet,Ord = {s : Str} ; + + + +-- Open lexical classes, e.g. Lexicon + +-- Verb + + VP = ResSwa.VP ; + +-- Numeral + Num = {s : Gender => Str ; n : Number} ; + +{-- + Num = {s : Gender => Animacy => Str ; n : Number} ; + Card = {s : Gender => Animacy => Str ; n : Number} ; + Digits = {s : Str ; n : Number} ; +--} +--Prepositions + Prep = {s : Str} ; + +-- Sentence + + Cl = Clause ; + +} diff --git a/lib/src/swahili/CompatibilitySwa.gf b/lib/src/swahili/CompatibilitySwa.gf new file mode 100644 index 000000000..143143e6e --- /dev/null +++ b/lib/src/swahili/CompatibilitySwa.gf @@ -0,0 +1,7 @@ +--# -path=.:../abstract:../common + +concrete CompatibilitySwa of Compatibility = CatSwa ** open Prelude, ResSwa in { + + + +} diff --git a/lib/src/swahili/ConjunctionSwa.gf b/lib/src/swahili/ConjunctionSwa.gf new file mode 100644 index 000000000..793faf1f2 --- /dev/null +++ b/lib/src/swahili/ConjunctionSwa.gf @@ -0,0 +1,6 @@ +concrete ConjunctionSwa of Conjunction = + CatSwa ** open ResSwa, Coordination, Prelude in { + + + + } diff --git a/lib/src/swahili/ExtraSwa.gf b/lib/src/swahili/ExtraSwa.gf new file mode 100644 index 000000000..531fa8255 --- /dev/null +++ b/lib/src/swahili/ExtraSwa.gf @@ -0,0 +1,6 @@ +concrete ExtraSwa of ExtraSwaAbs = CatSwa ** + open ResSwa, Coordination, Prelude, MorphoSwa in { + + lin that1_Quant = {s = \\n,nc,g => mkQuant SpHr n nc g P3} ; + +} diff --git a/lib/src/swahili/ExtraSwaAbs.gf b/lib/src/swahili/ExtraSwaAbs.gf new file mode 100644 index 000000000..c36f36f78 --- /dev/null +++ b/lib/src/swahili/ExtraSwaAbs.gf @@ -0,0 +1,4 @@ +abstract ExtraSwaAbs = Extra ** { + + +} diff --git a/lib/src/swahili/GrammarSwa.gf b/lib/src/swahili/GrammarSwa.gf new file mode 100644 index 000000000..74aa51160 --- /dev/null +++ b/lib/src/swahili/GrammarSwa.gf @@ -0,0 +1,9 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarSwa of Grammar =NounSwa , AdjectiveSwa , StructuralSwa ,VerbSwa , SentenceSwa , AdverbSwa + + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text ; + +} ; diff --git a/lib/src/swahili/IdiomSwa.gf b/lib/src/swahili/IdiomSwa.gf new file mode 100644 index 000000000..98246eb9b --- /dev/null +++ b/lib/src/swahili/IdiomSwa.gf @@ -0,0 +1,7 @@ +concrete IdiomSwa of Idiom = CatSwa ** open Prelude, ResSwa in { + + flags optimize=all_subs ; + + +} + diff --git a/lib/src/swahili/IrregSwa.gf b/lib/src/swahili/IrregSwa.gf new file mode 100644 index 000000000..23aca0f3c --- /dev/null +++ b/lib/src/swahili/IrregSwa.gf @@ -0,0 +1,8 @@ +--# -path=.:prelude:../abstract:../common + +concrete IrregSwa of IrregSwaAbs = CatSwa ** open ParadigmsSwa in { + +flags optimize=values ; + + +} diff --git a/lib/src/swahili/IrregSwaAbs.gf b/lib/src/swahili/IrregSwaAbs.gf new file mode 100644 index 000000000..ccdb4045a --- /dev/null +++ b/lib/src/swahili/IrregSwaAbs.gf @@ -0,0 +1,3 @@ +abstract IrregSwaAbs = Cat ** { + +} diff --git a/lib/src/swahili/LangSwa.gf b/lib/src/swahili/LangSwa.gf new file mode 100644 index 000000000..8972f40b8 --- /dev/null +++ b/lib/src/swahili/LangSwa.gf @@ -0,0 +1,10 @@ +--# -path=.:../abstract:../common:../prelude + +concrete LangSwa of Lang = + GrammarSwa, + LexiconSwa + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text ; + +} ; diff --git a/lib/src/swahili/LexiconSwa.gf b/lib/src/swahili/LexiconSwa.gf new file mode 100644 index 000000000..d87d0b698 --- /dev/null +++ b/lib/src/swahili/LexiconSwa.gf @@ -0,0 +1,99 @@ +--# -path=.:../abstract:../../prelude:../common +concrete LexiconSwa of Lexicon = CatSwa ** + open ParadigmsSwa, Prelude in { + +flags + optimize=values ; + +lin + + bird_N = regN "ndege" e_e animate; + country_N = regN "nchi" e_e inanimate ; + cousin_N = regN "binamu" e_ma animate; + cow_N = regN "ngombe" e_e animate; + doctor_N = regN "daktari" e_ma animate ; + dog_N = regN "mbwa" e_e animate ; + door_N = regN "mlango" m_mi inanimate; + enemy_N = regN "adui" e_ma animate; + father_N = regN "baba" e_e animate; + fish_N = regN "samaki" e_e animate; + friend_N = regN "rafiki" e_ma animate; + garden_N = regN "shamba" e_ma inanimate; + girl_N = regN "msichana" m_wa animate ; + lamp_N = regN "taa" e_e inanimate ; + man_N = regN "mwanaume" m_wa animate ; + tree_N = regN "mti" m_mi inanimate ; + water_N = regN "maji" ma_ma inanimate ; + woman_N = regN "mwanamke" m_wa animate ; + ear_N = regN "sikio" e_ma inanimate ; + eye_N = mkN "jicho" "macho" ji_ma inanimate ; + fingernail_N = regN "ukucha" u_e inanimate ; + nose_N = regN "pua" e_ma inanimate; + person_N = regN "mtu" m_wa animate ; + road_N = regN "barabara" e_e inanimate; + tooth_N = regN "jino" ji_ma inanimate ; + wife_N = regN "bibi" e_ma animate ; + river_N = regN "mto" m_mi inanimate ; + + 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"; + + beautiful_A = regA "rembo" ; + black_A = regA "eusi"; + blue_A = regA "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" ; + dull_A = regA "liofifia" ; + full_A = regA "tele" ; + good_A = regA "zuri" ; + green_A = regA "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" ; + ready_A = regA "tayari" ; + red_A = regA "ekundu" ; + rotten_A = regA "oza" ; + round_A = regA "viringo" ; + sharp_A = regA "kali" ; + short_A = regA "fupi" ; + small_A = regA "dogo" ; + smooth_A = regA "laini" ; + straight_A = regA "nyofu" ; + stupid_A = regA "jinga" ; + thick_A = regA "nene" ; + thin_A = regA "embamba" ; + ugly_A = regA "baya"; + certain_A = regA "hakika" ; + warm_A = regA "fufutende" ; + wet_A = regA "nyevu" ; + white_A = regA "eupe" ; + wide_A = regA "pana" ; + yellow_A = regA "njano" ; + young_A = regA "bichi" ; + + father_N2 = mkN2 (regN "baba" e_e animate) (mkPrep "ya") ; + mother_N2 = mkN2 (regN "mama" e_e animate) (mkPrep "ya"); + brother_N2 = mkN2 (regN "ndugu" e_e animate) (mkPrep "ya") ; + +} ; diff --git a/lib/src/swahili/MakeStructuralSwa.gf b/lib/src/swahili/MakeStructuralSwa.gf new file mode 100644 index 000000000..eb6487936 --- /dev/null +++ b/lib/src/swahili/MakeStructuralSwa.gf @@ -0,0 +1,6 @@ +--# -path=.:../common:../abstract + +resource MakeStructuralSwa = open CatSwa, ParadigmsSwa, ResSwa, MorphoSwa, Prelude in { + + +} diff --git a/lib/src/swahili/MorphoSwa.gf b/lib/src/swahili/MorphoSwa.gf new file mode 100644 index 000000000..c795c2711 --- /dev/null +++ b/lib/src/swahili/MorphoSwa.gf @@ -0,0 +1,229 @@ +--# -path=.:../abstract:../../prelude:../common + +--1 A Simple Swahili Resource Morphology +-- +-- This resource morphology contains definitions needed in the resource +-- syntax. To build a lexicon, it is better to use $ParadigmsSwa$, which +-- gives a higher-level access to this module. + +resource MorphoSwa = open Prelude, (Predef=Predef), ResSwa in { + + flags optimize=all ; +--$Nouns-- +oper + + CommonNoun : Type = {s : Number => Str; g : Gender ; anim : Animacy } ; + + numForms : Str -> Str -> Number => Str = \bon,bons -> + table {Sg => bon ; Pl => bons} ; + + mkNoun : (Number => Str) -> Gender -> Animacy -> CommonNoun = \mecmecs,gen,anim -> + {s = mecmecs ; g = gen ; anim = anim} ; + + mkNounIrreg : Str -> Str -> Gender -> Animacy -> CommonNoun = \mec,mecs,gen,anim -> + mkNoun (numForms mec mecs) gen anim ; + + mkNomReg : Str -> Gender -> Animacy -> CommonNoun = \mtu,gen,anim -> + let watu = case gen of { + g1_2 => case Predef.take 3 mtu of { + "mwa" => Predef.drop 1 mtu ; + "mwi" => "wa"+ Predef.drop 2 mtu ; + _ => "wa" + Predef.drop 1 mtu + }; -- mtu/watu + g3_4 => "mi" + Predef.drop 1 mtu ; -- mti/miti + g5_6 => "me" + Predef.drop 2 mtu ; -- jicho/macho + g5a_6 => "ma" + mtu ; -- somo/masomo + g7_8 => "vi" + Predef.drop 2 mtu ; -- kitabu/vitabu + g11_6 => "ma" + Predef.drop 1 mtu ; -- ugonjwa/magonjwa + g11_10 => Predef.drop 1 mtu ; -- ukuta/kuta + _ => mtu -- ma_ma (maji/maji); e_e (taa/taa); u_u (uhuru/uhuru) + }; + in mkNounIrreg mtu watu gen anim ; + + mkNn : Str -> Str -> Gender -> Animacy -> CommonNoun = \mec,mecs,gen,anim -> + mkNoun (numForms mec mecs) gen anim ; + +--Autonomous Personal Pronoun + mkPronoun :Number -> Person-> Str= \n,p -> + case of { + => "mimi" ; + => "wewe" ; + => "yeye" ; + => "sisi" ; + => "nyinyi" ; + => "wao" + + }; + + +--$Verbs + {-- + VerbprefixR : Agr -> Str = \a -> Verbprefix a.n a.g a.anim a.p ; + + + + Verbprefix : Number -> Gender -> Animacy -> Person -> Str = \n,g,anim,p -> + case of { + <_,Sg,_,P1> => "ni" ; + <_,Sg,_,P2> => "u" ; + <_,Pl,_,P1> => "tu" ; + <_,Pl,_,P2> => "m" ; + => "a" ; + => "wa" ; + <_,Sg,g1_2,_> => "a" ; + <_,Pl,g1_2,_> => "wa" ; + <_,Sg,g3_4,_> => "u" ; + <_,Pl,g3_4,_> => "i" ; + <_,Sg,g5_6,_> => "li" ; + <_,Pl,g5_6,_> => "ya" ; + <_,Sg,g5a_6,_> => "li" ; + <_,Pl,g5a_6,_> => "ya" ; + => "a" ; + => "wa" ; + <_,Sg,g6,_> => "ya" ; + <_,Pl,g6,_> => "ya" ; + <_,Sg,g7_8,_> => "ki" ; + <_,Pl,g7_8,_> => "vi" ; + <_,Sg,g9_10,_> => "i" ; + <_,Pl,g9_10,_> => "zi" ; + <_,_,g11,_> => "u" ; + <_,Sg,g11_6,_> => "u" ; + <_,Pl,g11_6,_> => "ya" ; + <_,Sg,g11_10,_> => "u" ; + <_,Pl,g11_10,_> => "zi" + } ; + + + Verbprefix : Number -> Gender -> Animacy -> Person -> Str = \n,g,anim,p -> + case of { + => "ni" ; + => "tu" ; + <_,_,_,_> => "" + + } ; + + + mkV : Str -> {s : VForm => Str} = + \cheza -> { + s = table { + --VInf => "ku"+cheza ; + VInf => case Predef.take 2 cheza of { + "ku" => cheza; + _ => "ku"+cheza + }; + VImper n p => case of { => init cheza + "eni";<_,_> => cheza}; + VPres n g anim p => Verbprefix n g anim p ++ "na" ++ cheza; + VPast n g anim p => Verbprefix n g anim p ++ "li" ++ cheza ; + VFut n g anim p => Verbprefix n g anim p ++ "ta" ++ cheza + } + } ; + + --} + +--2 Adjectives +-- To form the adjectival and the adverbial forms, two strings are needed +-- in the worst case. (First without degrees.) + + Adj = {s : AForm => Str} ; + + VowelAdjprefix : Number -> Gender -> Animacy -> Str = \n,g,anim -> + case of { + => "mw" ; + => "w" ; + <_,Sg,g1_2> => "mw" ; + <_,Pl,g1_2> => "w" ; + <_,Sg,g3_4> => "mw" ; + <_,Pl,g3_4> => "m" ; + <_,Sg,g5_6> => "nj" ; + <_,Pl,g5_6> => "m" ; + <_,Sg,g5a_6> => "mw" ; + <_,Pl,g5a_6> => "ny" ; + <_,Sg,g6> => "m" ; + <_,Pl,g6> => "m" ; + <_,Sg,g7_8> => "ki" ; + <_,Pl,g7_8> => "vi" ; + <_,Sg,g9_10> => "ny" ; + <_,Pl,g9_10> => "" ; + <_,_,g11> => "m" ; + <_,Sg,g11_6> => "m" ; + <_,Pl,g11_6> => "ma" ; + <_,Sg,g11_10> => "ny" ; + <_,Pl,g11_10> => "m" + } ; + + + ConsonantAdjprefix : Number -> Gender -> Animacy -> Str = \n,g,anim -> + case of { + => "m" ; + => "wa" ; + <_,Sg,g1_2> => "m" ; + <_,Pl,g1_2> => "wa" ; + <_,Sg,g3_4> => "" ; + <_,Pl,g3_4> => "" ; + <_,Sg,g5_6> => "" ; + <_,Pl,g5_6> => "ma" ; + <_,Sg,g5a_6> => "" ; + <_,Pl,g5a_6> => "ma" ; + <_,Sg,g6> => "ma" ; + <_,Pl,g6> => "ma" ; + <_,Sg,g7_8> => "ki" ; + <_,Pl,g7_8> => "vi" ; + <_,Sg,g9_10> => "i" ; + <_,Pl,g9_10> => "" ; + <_,_,g11> => "m" ; + <_,Sg,g11_6> => "m" ; + <_,Pl,g11_6> => "ma" ; + <_,Sg,g11_10> => "m" ; + <_,Pl,g11_10> => "n" + } ; + + +mkAdjective : Str -> Adj = \zuri -> + { + s = table { + AF n g anim => case Predef.take 1 zuri of { + "a"|"e"|"i"|"o"|"u" => VowelAdjprefix n g anim + zuri; + _ => ConsonantAdjprefix n g anim +zuri + }; + AA => zuri + } + } ; + + +mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s -> + {s = s ; n = n} ; + +mkQuant : Spatial -> Number -> Gender -> Animacy -> Case -> Person -> Str = \sp,n,g,anim,c,p -> + let + pfx = "foo" ; ---- Verbprefix n g anim p ; + in + case of { + => case of { + => "huyu" ; + => "huyo" ; + <_> => "yule" } ; + + <_,_,_> => case of { + => "h" + Predef.dp 1 (Verbprefix n g anim p) + Verbprefix n g anim p ; --sphrobj ; +-- => mkQuantEnd (Predef.tk 1 sphrobj) ; + => mkQuantEnd (Predef.tk 1 ("h" + Predef.dp 1 (Verbprefix n g anim p) + Verbprefix n g anim p)) ; + <_> => Verbprefix n g anim p + "le" } + } ; + +mkQuantEnd : Str -> Str = \stem -> + let + suffix = Predef.dp 1 stem ; + front = Predef.tk 1 stem + in + case of { + <"i"> => stem + "yo" ; + <"k"> => front + "cho" ; + <"v"> => front + "vyo" ; + <"w"> => front + "o" ; + <_> => stem + "o" + } ; + + + +} ; + diff --git a/lib/src/swahili/NounSwa.gf b/lib/src/swahili/NounSwa.gf new file mode 100644 index 000000000..b52471425 --- /dev/null +++ b/lib/src/swahili/NounSwa.gf @@ -0,0 +1,83 @@ + +concrete NounSwa of Noun = CatSwa ** open MorphoSwa, ResSwa, Prelude in { + + flags optimize=all_subs ; + +lin + + UseN noun = { + s = noun.s ; + s1 = noun.s ; + s2 = noun.s ; + g = noun.g ; + anim = noun.anim ; + hasAdj = False + } ; + + UseN2 noun = { + s = noun.s ; + s1 = noun.s ; + s2 = noun.s ; + g = noun.g ; + anim = noun.anim ; + hasAdj = False + } ; + + +-- Num + + NumSg = {s = \\_ => [] ; n = Sg} ; + NumPl = {s = \\_ => [] ; n = Pl} ; + + + DetQuant quant num = { + s = \\g,c,anim => quant.s ! num.n ! g ! anim ! c ++ num.s ! g; + n = num.n + }; + + AdjCN ap cn = + let + anim = cn.anim ; + g = cn.g; + mod = cn.hasAdj + in{ + s = \\n => cn.s ! n ++ ap.s ! (AF n g anim) ; + s1 = \\n => cn.s1 ! n; + s2=case of { + => \\n => ap.s ! (AF n g anim); + => \\n => cn.s2 ! n ++ ap.s ! (AF n g anim) + }; + g = g ; + anim = anim ; + hasAdj=True + + } ; + + + --DetCN : Det -> CN -> NP ; -- mtu huyo + + + DetCN det cn = + let + anim = cn.anim ; + g = cn.g ; + n = det.n ; + mod = cn.hasAdj + in case of { + => { + s = \\c => cn.s ! n ++ det.s ! g ! c ! anim ; + a = agr n g anim P3 + } ; + => { + s = \\c => cn.s1 ! n ++ det.s ! g ! c ! anim ++ cn.s2 ! n ; + a = agr n g anim P3 + } + }; + + + + + + + +} diff --git a/lib/src/swahili/NumeralSwa.gf b/lib/src/swahili/NumeralSwa.gf new file mode 100644 index 000000000..8d9d259d1 --- /dev/null +++ b/lib/src/swahili/NumeralSwa.gf @@ -0,0 +1,4 @@ +concrete NumeralSwa of Numeral = CatSwa ** open ResSwa in { + + +} diff --git a/lib/src/swahili/OverloadSwa.gf b/lib/src/swahili/OverloadSwa.gf new file mode 100644 index 000000000..eabd73995 --- /dev/null +++ b/lib/src/swahili/OverloadSwa.gf @@ -0,0 +1 @@ +resource OverloadSwa = Overload with (Grammar = GrammarSwa) ; diff --git a/lib/src/swahili/ParadigmsSwa.gf b/lib/src/swahili/ParadigmsSwa.gf new file mode 100644 index 000000000..faa3597f9 --- /dev/null +++ b/lib/src/swahili/ParadigmsSwa.gf @@ -0,0 +1,171 @@ +--# -path=.:../abstract:../../prelude:../common + +--1 Swahili Lexical Paradigms + + +resource ParadigmsSwa = open(Predef=Predef), Prelude, MorphoSwa,ResSwa,CatSwa in { + +flags optimize=all ; + +--2 Parameters +-- +-- To abstract over gender names, we define the following identifiers. + +oper + Animacy : Type ; + + animate : Animacy ; + inanimate : Animacy ; + +-- 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 ; + +-- To abstract over nounclass names, we define the following. + + Gender : Type ; + + m_wa :Gender ; + m_mi : Gender ; + ji_ma : Gender ; + e_ma : Gender ; + ma_ma : Gender ; + ki_vi : Gender ; + e_e : Gender ; + u_u : Gender ; + u_ma : Gender ; + u_e : Gender ; + + + +--2 Nouns + +-- Worst case: give all four forms and the semantic gender. + + mkN : (mtu,watu : Str) -> Gender -> Animacy -> N ; + +-- The regular function captures the variants for nouns depending on Gender and Number + + regN : Str -> Gender -> Animacy -> N ; + +-- In practice the worst case is just: give singular and plural nominative. + + + mk2N : (mtu , watu : Str) -> Gender -> Animacy -> N ; + mk2N x y g anim = mkNounIrreg x y g anim ** {lock_N = <>}; + + mkN2 : N -> Prep -> N2 ; + mkN2 : N -> Prep -> N2 = \n,p -> n ** {c2 = p.s ; lock_N2 = <>} ; + + mkPrep : Str -> Prep ; +-- mkPrep p = {s = p ; c = CPrep PNul ; isDir = False ; lock_Prep = <>} ; + mkPrep p = {s = p ; lock_Prep = <>} ; + + +--3 Relational nouns +-- +-- Relational nouns ("fille de x") need a case and a preposition. + +-- All nouns created by the previous functions are marked as +-- $nonhuman$. If you want a $human$ noun, wrap it with the following +-- function: + +-- genderN : Gender -> N -> N ; + +-- For regular adjectives, the adverbial form is derived. This holds +-- even for cases with the variation "happy - happily". + + regA : Str -> A ; + +-- If comparison is formed by "kuliko", as usual in Swahili, +-- the following pattern is used: + + compADeg : A -> A ; + +--2 Definitions of paradigms +-- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. +--. + + Animacy = ResSwa.Animacy ; + Number = ResSwa.Number ; + Case = ResSwa.Case ; + Gender = ResSwa.Gender ; + animate = AN ; + inanimate = IN ; + singular = Sg ; + plural = Pl ; + nominative = Nom ; + locative = Loc ; + m_wa = g1_2 ; + m_mi = g3_4 ; + ji_ma = g5_6 ; + e_ma = g5a_6 ; + ma_ma = g6 ; + ki_vi = g7_8 ; + e_e = g9_10 ; + u_u = g11 ; + u_ma = g11_6 ; + u_e = g11_10 ; + VForm = ResSwa.VForm ; + +-- regN x g anim = mkNomReg x g anim ** {lock_N = <>} ; + + regN = \x,g,anim -> + mkNomReg x g anim ** {lock_N = <>} ; + +-- mkN x y g anim = mkNounIrreg x y g anim ** {lock_N = <>} ; + mkN = \x,y,g,anim -> + mkNounIrreg x y g anim ** {lock_N = <>} ; + +-- Adjectives + + regA a = compADeg { + s = \\_ => (mkAdjective a).s ; + lock_A = <>} ; + + compADeg a = + { + s = table { + Posit => a.s ! Posit ; + _ => \\f => a.s ! Posit ! f ++ "kuliko" + } ; + lock_A = <>} ; + +-- Verbs + regV : Str -> V ; + regV = \enda -> mkV enda ** {s1 = [] ; lock_V = <>} ; + +{-- + mkV2 = overload { + mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; + mkV2 : V -> V2 = dirV2 ; + mkV2 : V -> Prep -> V2 = mmkV2 + } ; + + mmkV2 : V -> Prep -> V2 ; + mmkV2 v p = v ** {c2 = p ; lock_V2 = <>} ; + dirV2 : V -> V2 = \v -> mmkV2 v "na" ; +--} + +--2 Adverbs + +-- Adverbs are not inflected. Most lexical ones have position +-- after the verb. + + mkAdv : Str -> Adv ; + mkAdv x = ss x ** {lock_Adv = <>} ; + + +} ; diff --git a/lib/src/swahili/PhraseSwa.gf b/lib/src/swahili/PhraseSwa.gf new file mode 100644 index 000000000..4a92ef634 --- /dev/null +++ b/lib/src/swahili/PhraseSwa.gf @@ -0,0 +1,5 @@ +concrete PhraseSwa of Phrase = CatSwa ** open Prelude, ResSwa in { + + + +} diff --git a/lib/src/swahili/QuestionSwa.gf b/lib/src/swahili/QuestionSwa.gf new file mode 100644 index 000000000..000df64e4 --- /dev/null +++ b/lib/src/swahili/QuestionSwa.gf @@ -0,0 +1,3 @@ +concrete QuestionSwa of Question = CatSwa ** open ResSwa, Prelude in { + +} diff --git a/lib/src/swahili/RelativeSwa.gf b/lib/src/swahili/RelativeSwa.gf new file mode 100644 index 000000000..0c386ecab --- /dev/null +++ b/lib/src/swahili/RelativeSwa.gf @@ -0,0 +1,4 @@ +concrete RelativeSwa of Relative = CatSwa ** open ResSwa in { + + +} diff --git a/lib/src/swahili/ResSwa.gf b/lib/src/swahili/ResSwa.gf new file mode 100644 index 000000000..7dff0ae71 --- /dev/null +++ b/lib/src/swahili/ResSwa.gf @@ -0,0 +1,171 @@ +--# -path=.:../abstract:../common:../../prelude + +--1 Swahili auxiliary operations. + +-- This module contains operations that are needed to make the +-- resource syntax work. To define everything that is needed to +-- implement $Test$, it moreover contains regular lexical +-- patterns needed for $Lex$. + +resource ResSwa = ParamX ** open Prelude in { + + flags optimize=all ; + +--For $Noun$ + +-- This is the worst-case $Case$ needed for pronouns. + + param Case = Nom | Loc ; + + param Animacy = AN | IN ; + + param Gender = g1_2 | g3_4 | g5_6 | g5a_6 | g6 | g7_8 | g9_10 | g11 | g11_6 | g11_10 ; + +--2 For $Adjective$ + + AForm = AF Number Gender Animacy + | AA ; + +-- The order of sentence is needed already in $VP$. + + Order = ODir | OQuest ; + + --2 For $Verb$ + +-- Verbs will take one of the five forms + + param + VForm = VInf + | VImper Number Person + | VPres Number Gender Animacy Person + | VPast Number Gender Animacy Person + | VFut Number Gender Animacy Person; + + + oper + + Verb : Type = {s : VForm => Str} ; + + + VerbForms : Type = Tense => Anteriority => Polarity => Agr => Str ; + + VP : Type = { + s : VerbForms ; + s2 : Agr => Str + } ; + + + mkV : Str -> {s : VForm => Str} = + \cheza -> { + s = table { + VInf => case Predef.take 2 cheza of { + "ku" => cheza; + _ => "ku"+cheza + }; + VImper n p => case of{ + => init cheza + "eni"; + <_,_> => cheza}; + VPres n g anim p => Verbprefix n g anim p + "na" + cheza; + VPast n g anim p => Verbprefix n g anim p + "li" + cheza ; + VFut n g anim p => Verbprefix n g anim p + "ta" + cheza + } + } ; + + + predV : Verb -> VP = \verb -> { + s = \\t,ant,b,agr => + let + inf = verb.s ! VInf ; + imper = verb.s ! VImper agr.n agr.p; + pres = verb.s ! VPres agr.n agr.g agr.anim agr.p ; + past = verb.s ! VPast agr.n agr.g agr.anim agr.p ; + fut = verb.s ! VFut agr.n agr.g agr.anim agr.p ; + in + case of { + <_,Anter,Pos> => imper; + => pres ; + => past ; + => fut ; + <_,_,_> => inf + + } ; + s2 = \\_ => [] + } ; + + + Verbprefix : Number -> Gender -> Animacy -> Person -> Str = \n,g,anim,p -> + case of { + => "ni" ; + => "u" ; + => "tu" ; + => "m" ; + => "a" ; + => "wa" ; + <_,Sg,g1_2,_> => "a" ; + <_,Pl,g1_2,_> => "wa" ; + <_,Sg,g3_4,_> => "u" ; + <_,Pl,g3_4,_> => "i" ; + <_,Sg,g5_6,_> => "li" ; + <_,Pl,g5_6,_> => "ya" ; + <_,Sg,g5a_6,_> => "li" ; + <_,Pl,g5a_6,_> => "ya" ; + => "ya" ; + => "ki" ; + => "vi" ; + => "i" ; + => "zi" ; + => "u" ; + => "u" ; + => "ya" ; + => "u" ; + => "zi" + } ; + + + + + + + +-- Auxiliary verbs have special negative forms. +param + VVForm = + VVF VForm + | VVPresNeg + | VVPastNeg --# notpresent + ; + +--Adjectives + + oper Adj = {s : AForm => Str} ; + +--2 For $Quantifiers$ +-- A 3-dimensional system of quantifiers (demonstrative pronouns) based on position of object, hearer + speaker +-- need to find linguistic term to express this + + param Spatial = SpHrObj | SpHr | HrObj ; --w.r.t object + +-- Agreement of adjectives, verb phrases, and relative pronouns. + +oper + AGR = {n : Number ; g : Gender ; anim : Animacy ; p : Person} ; + Agr : Type = {n : Number ; g : Gender ; anim : Animacy ; p : Person} ; + agr : Number -> Gender -> Animacy -> Person -> Agr = \n,g,anim,p -> {n = n ; g = g ; anim = anim ; p = p} ; + +-- For $Sentence$. + + Clause : Type = { + s : Tense => Anteriority => Polarity => Str + } ; + + mkClause : Str -> Agr -> VP -> Clause = + \subj,agr,vp -> { + s = \\t,a,b => + let + verb = vp.s ! t ! a ! b ! agr + in + subj ++ verb + } ; + + +} diff --git a/lib/src/swahili/SentenceSwa.gf b/lib/src/swahili/SentenceSwa.gf new file mode 100644 index 000000000..ac2d85268 --- /dev/null +++ b/lib/src/swahili/SentenceSwa.gf @@ -0,0 +1,9 @@ +concrete SentenceSwa of Sentence = CatSwa ** open Prelude, ResSwa in { + + flags optimize=all_subs ; + + lin + PredVP np vp = mkClause (np.s ! Nom) np.a vp ; + +} + diff --git a/lib/src/swahili/StructuralSwa.gf b/lib/src/swahili/StructuralSwa.gf new file mode 100644 index 000000000..52e2aeb5e --- /dev/null +++ b/lib/src/swahili/StructuralSwa.gf @@ -0,0 +1,15 @@ +concrete StructuralSwa of Structural = CatSwa ** + open MorphoSwa, ResSwa, ParadigmsSwa, + (C = ConstructX), Prelude in { + + flags optimize=all ; +lin + + this_Quant = {s = \\n,g,anim,c => mkQuant SpHrObj n g anim Nom P3} ; + this_Quant1 = {s = \\n,g,anim,c => mkQuant HrObj n g anim Nom P3} ; + that_Quant = {s = \\n,g,anim,c => mkQuant SpHr n g anim Nom P3} ; + + + +} + diff --git a/lib/src/swahili/SymbolSwa.gf b/lib/src/swahili/SymbolSwa.gf new file mode 100644 index 000000000..b004d2158 --- /dev/null +++ b/lib/src/swahili/SymbolSwa.gf @@ -0,0 +1,7 @@ +--# -path=.:../abstract:../common + +concrete SymbolSwa of Symbol = CatSwa ** open Prelude, ResSwa in { + + + +} diff --git a/lib/src/swahili/VerbSwa.gf b/lib/src/swahili/VerbSwa.gf new file mode 100644 index 000000000..6f3652140 --- /dev/null +++ b/lib/src/swahili/VerbSwa.gf @@ -0,0 +1,8 @@ +concrete VerbSwa of Verb = CatSwa ** open ResSwa in { + +flags optimize=all_subs ; + +lin + UseV = predV ; + +} diff --git a/lib/src/swahili/noun0.gf b/lib/src/swahili/noun0.gf new file mode 100644 index 000000000..1b40a4afb --- /dev/null +++ b/lib/src/swahili/noun0.gf @@ -0,0 +1,122 @@ + +concrete NounSwa of Noun = CatSwa ** open MorphoSwa, ResSwa, Prelude in { + + flags optimize=all_subs ; + +lin + + UseN noun = { + s = noun.s ; + s1 = noun.s ; + s2 = noun.s ; + g = noun.g ; + anim = noun.anim ; + hasAdj = False + } ; + + UseN2 noun = { + s = noun.s ; + s1 = noun.s ; + s2 = noun.s ; + g = noun.g ; + anim = noun.anim ; + hasAdj = False + } ; + + +{-- Use2N3 noun = { + s = noun.s ; + s1 = noun.s ; + s2 = noun.s ; + g = noun.g ; + anim = noun.anim ; + hasAdj = False; + c2 = noun.c2 + } ; + + + --} + + + + + + {-- + AdjCN ap cn = + let + anim = cn.anim ; + g = cn.g + in { + s = \\n => cn.s ! n ++ ap.s ! (AF n g anim) ; + s1 = \\n => cn.s ! n ; + s2 = \\n => ap.s ! (AF n g anim) ; + g = g ; + anim = anim ; + hasAdj = True + } ; + + + AdjCN ap cn = + let + anim = cn.anim ; + g = cn.g; + mod = cn.hasAdj + in{ + s = \\n => cn.s ! n ++ ap.s ! (AF n g anim) ; + s1 = \\n => cn.s1 ! n; + --s2 = \\n => cn.s2 ++ ap.s ! (AF n g anim) ; + s2=case of { + => \\n => ap.s ! (AF n g anim); + => \\n => cn.s2 ! n ++ ap.s ! (AF n g anim) + }; + g = g ; + anim = anim ; + hasAdj=True + + } ; +--} + +-- Num + + NumSg = {s = \\_ => [] ; n = Sg} ; + NumPl = {s = \\_ => [] ; n = Pl} ; + + +-- DetQuant : Quant -> Num -> Det ; -- these five +-- Det = {s : Gender => Animacy => Case => Str ; n : Number} ; +-- Quant = {s : Number => Gender => Animacy => Case => Str} ; +-- Num = {s : Gender => Animacy => Str ; n : Number} ; + + + DetQuant quant num = { + s = \\g,anim,c => quant.s ! num.n ! g ! anim ! c ++ num.s ! g ; + n = num.n + }; + +--DetCN : Det -> CN -> NP ; -- mtu huyo + +{-- + DetCN det cn = + let + anim = cn.anim ; + g = cn.g ; + n = det.n ; + mod = cn.hasAdj + in case of { + => { + --s = \\c => n ++ det.s ! g ! c ++ cn.s ! n ++ det.s2 ; + s =\\c => c ++ cn.s ! n ++ det.s ! g ! anim ; + a = agr n g anim P3 + } ; + => { + s = cn.s1 ! n ++ det.s ! g ! anim ++ cn.s2 ! n ; + a = agr n g anim P3 + } + }; +--} + + + + + +}