From 66474465e3f155add9e62dcbadb69a993b0875eb Mon Sep 17 00:00:00 2001 From: David Bamutura Date: Fri, 3 May 2019 03:57:11 +0200 Subject: [PATCH] Covered PredetNP & PrepNP in NounCgg.gf & AdverbCgg.gf alongside Predet & Adv Lexicon in StructuralCgg.gf. Errors in SentenceCgg.gf because the verb system is still a mess. --- src/rukiga/AdverbCgg.gf | 11 +- src/rukiga/CatCgg.gf | 23 +- src/rukiga/LexiconCgg.gf | 476 +++--------- src/rukiga/NounCgg.gf | 73 +- src/rukiga/ParadigmsCgg.gf | 15 +- src/rukiga/PhraseCgg.gf | 12 +- src/rukiga/ResCgg.gf | 1445 ++++++++++++++++------------------- src/rukiga/ResCggOld.gf | 910 ++++++++++++++++++++++ src/rukiga/SentenceCgg.gf | 80 +- src/rukiga/StructuralCgg.gf | 113 ++- src/rukiga/VerbCgg.gf | 43 +- 11 files changed, 2001 insertions(+), 1200 deletions(-) create mode 100644 src/rukiga/ResCggOld.gf diff --git a/src/rukiga/AdverbCgg.gf b/src/rukiga/AdverbCgg.gf index 1b748a72a..09916f4b3 100755 --- a/src/rukiga/AdverbCgg.gf +++ b/src/rukiga/AdverbCgg.gf @@ -4,16 +4,21 @@ concrete AdverbCgg of Adverb = CatCgg ** open ResCgg, Prelude in { lin - --PrepNP : Prep -> NP -> Adv --adverb of place pg 118 part (c) + --PrepNP : Prep -> NP -> Adv -- Verb Phrase modifyingadverb such as everywhere + + --adverb of place pg 118 part (c) -- some prepositions can only operate with CN but not PN -- how can we distinguish NPs i.e if they are CN or PN? -- because aha is used for CN while aha-ri is used for PN Omubazi -- nigukora ahari John -- The nounPhrase must carry information about its derivation - PrepNP prep np = {s = \\ agr => prep.s ++ np . s}; -- aha meza + + {-Assumed that a PrepNP is always Acc-} + PrepNP prep np = {s = prep.s ++ np.s ! Acc; agr = AgrNo}; -- aha meza --PositAdvAdj : A -> Adv ; -- warmly - PositAdvAdj a = a; + --"Impossible to implement because each is lexically different word." + --PositAdvAdj a = a; {- abstract Adverb = Cat ** { diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index 4051711d0..a92a6d9f8 100755 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -4,7 +4,18 @@ concrete CatCgg of Cat = CommonX -[Adv]** open (Res=ResCgg), Prelude in { lincat - + + --Pol = {s : Str ; isTrue: Bool}; -- TRUE= Positive, FALSE=Negative, s filed is left empty for parsing + {- + Temp is a parameter for temporal features such as Simul and Anteriority: + TRUE = Simultainity + FALSE = Anteriority + -} + --Temp = {s : Str ; isPres : Bool} ; + --cat + Imp = {s : Bool => Str} ; + + QS = {s : Str} ; -- Note: SS is a shorthand for {s:Str}, defined in Prelude.gf -- You must change some of the lincats (e.g., for NP, Det and Pron) so that everything works @@ -21,12 +32,16 @@ lincat Det = Res.Determiner ; -- determiner phrase e.g. "those seven" Quant = SS ; -- quantifier ('nucleus' of Det) e.g. "this/these" Num = Res.Numer ; -- number determining element e.g. "seven" - AP = Res.AdjectivalPhrase; + AP = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool} ;--Res.AdjectivalPhrase; A = Res.Adjective; - Comp = Res.AdjectivalPhrase; -- complement of copula, such as AP e.g. "very warm" + Comp = Res.Comp; -- complement of copula, such as AP e.g. "very warm" V2 = Res.Verb2; - Adv = Res.Adv; + Adv = Res.Adverb; VPSlash = Res.VPSlash; + PN = Res.ProperNoun; -- ProperNoun : Type = {s: Str ; a:Agreement ; isPlace : Bool}; + Conj = Res.Conjunction; -- Conjunction: Type = {s : AgrConj =>Str ;s2 : Str ; n : Number} ; -- conjunction e.g. "and" + -- see Structural for explanation of this structure + Predet = {s : Str ; s2 : Str; isMWE : Bool; isInflected : Bool}; -- predeterminer (prefixed Quant) e.g. "all" {- --1 Cat: the Category System diff --git a/src/rukiga/LexiconCgg.gf b/src/rukiga/LexiconCgg.gf index c325ebc9b..e6784ac49 100755 --- a/src/rukiga/LexiconCgg.gf +++ b/src/rukiga/LexiconCgg.gf @@ -4,7 +4,127 @@ concrete LexiconCgg of Lexicon = CatCgg ** open ParadigmsCgg, ResCgg, Prelude in { lin + + --NOTE: Those commented out are not in the abstract + --burn_V = mkV "sya" ; + --die_V = mkV "fa" ; + --fly_V = mkV "guruka" ; + bird_N = mkN "ekinyonyi" KI_BI ; + boat_N = mkN "eryato" RI_MA ; + book_N = mkN "ekitabo" KI_BI ; + boy_N = mkN "omwojo" "abojo" MU_BA ; + bread_N = mkN "omugati" MU_MI; + car_N = mkN "emootoka" N_N ; + cat_N = mkN "enjangu" N_N ; + --chair_N = mkN "entebbe" N_N ; + child_N = mkN "omwana" MU_BA ; + city_N = mkN "ekibúga" KI_BI; --orurêmbo pl endêmbo + cloud_N = mkN "ekikyu" KI_BI ; + computer_N = mkN "kanyabwêngye" ZERO_ZERO ; --kanyabwêngye, embiikabwengye, kompyuta + cow_N = mkN "ente" N_N ; + dog_N = mkN "embwa" N_N ; + --person_N = mkN "omuntu" "abantu" MU_BA ; + fire_N = mkN "omuriro" MU_MI ; + fish_N = mkN "eky'ényanja" KI_BI ; + flower_N = mkN "ekimuri" KI_BI ; + friend_N = mkN "omunywâni" MU_MI ; -- omunywâni, omunyamukago, omugyenzi + girl_N = mkN "omwishiki" MU_BA ; + --shoe_N = mkN "ekaito" N_N ; + --table_N = mkN "emeza" N_N ; + --airplane_N = mkN "enyonyi" N_N ; -- mkN "endégye" N_N; + animal_N = mkN "enyamaishwa" N_N ; + apple_N = mkN "apple" ZERO_ZERO ; + baby_N = mkN "omwana" MU_BA ; + beer_N = mkN "amarwa" ZERO_MA ; + bike_N = mkN "egaari" N_N ; + bird_N = mkN "ekinyonyi" KI_BI ; + blood_N = mkN "eshágama" N_ZERO ; + grammar_N = mkN "enyómbeka y'órurími" "enyómbeka z'endími" ZERO_ZERO ; -- two words representing one word + horse_N = mkN "embaráàsi" N_N ; + house_N = mkN "enju" N_N ; + language_N = mkN "orurími" "endími" RU_N ; + man_N = mkN "omushaija" MU_BA ; + milk_N = mkN "amate" ZERO_MA ; + music_N = mkN "music" ZERO_ZERO ; -- I have not found the translation + river_N = mkN "omugyera" MU_MI ; --omurîndi, + sea_N = mkN "enyanja" N_N ; + ship_N = mkN "ekyombo" KI_BI ; -- eméèri [NC_n_n] + star_N = mkN "enyonyóòzi" N_N ; + train_N = mkN "egaari y'omwika" N_N ; -- plural would be egáàri z'omwika + tree_N = mkN "omuti" MU_MI ; + water_N = mkN "amáìzi" ZERO_MA ; + wine_N = mkN "víìnyo" ZERO_ZERO ; + woman_N = mkN "omwishiki" MU_BA ; + + --Proper Nouns + john_PN = mkPN "Yohana" (AgP3 Sg MU_BA) False; + paris_PN = mkPN "Paris" (AgP3 Sg N_N) True; --Noun class for places??? + + --Adjectives + bad_A = mkAdjective "bi" False False False; --False means the adjective is a stem and comes after the complete noun + --beautiful_A = mkAdjective "rungi" False; + big_A = mkAdjective "hango" False False False; + black_A = mkAdjective "kwirangura" False False False; + blue_A = mkAdjective "buuru" False True True ; + clean_A = mkAdjective "yonjo" False False False; --: A ; + cold_A = mkAdjective "rikufuka" False False False; --: A ; + good_A =mkAdjective "rungi" False False False; --: A ; + heavy_A = mkAdjective "rikuremeera" False False False; --: A ; --notice ri as a verb is + hot_A = mkAdjective "rikwotsya" False False False; -- rikutagata -- problematic words like hot we need a new set of clitics + new_A = mkAdjective "sya" False False False; --: A ; + old_A = mkAdjective "kúru" False False False; --: A ; + ready_A = mkAdjective "eteekateekire" False False False; --: A ; + red_A = mkAdjective "ríkutukura" False False False; --: A ; + small_A = mkAdjective "kye" False False False; + warm_A = mkAdjective "rikutagata" False False False;--: A ; + white_A = mkAdjective "rikwera" False False False;--: A ; + yellow_A = mkAdjective "kinekye" False True True;--: A ; or yero, or kyenju + young_A = mkAdjective "to" False False False;--: A ; + green_A =mkAdjective "kijubwe" False False True; + + --ditransitive verbs + --bite_V2 = mkV2 "rum"; + break_V2 = mkV2 "hend"; --: V2 ; + buy_V2 = mkV2 "gur" ; --: V2 ; + --close_V2 = mkV2 "king"; + --count_V2 = mkV2 "bar"; + --cut_V2 = mkV2 "shar"; + --do_V2 = mkV2 "kor"; + drink_V2 = mkV2 "nyw"; + eat_V2 = mkV2 "ry"; + --fear_V2 = mkV2 "tiin"; + find_V2 = mkV2 "bon" ; --: V2 ; -- many words; kureeba, kubóna,kushanga, kumamya,kujumbura + kill_V2 = mkV2 "it"; --: V2 ; + love_V2 = mkV2 "kûnd"; --: V2 ; + read_V2 = mkV2 "shoma";--: V2 ; + see_V2 = mkV2 "reeb"; --: V2 ; + teach_V2 = mkV2 "shomes" ; --: V2 ; or kwegyesa + understand_V2 = mkV2 "étegyerez"; --: V2 ; + wait_V2 = mkV2 "tegyerez"; --: V2 ; + + + +-- Intransitive verbs + come_V = mkV "ij"; + go_V = mkV "gyend"; --: V ; -- Many words: kuza, kuraba,kutoora, kugyenda=go away, kushuma=go down + jump_V = mkV "guruk" ; + play_V = mkV "zaan"; --: V ; + live_V = mkV "tuur" ; --manyF: kutuura i.e. live somewhere, stay = kuráàra + run_V = mkV "íruk"; -- : V ; + sleep_V = mkV "nyama" ; --: V ;--Kugwejegyera, kubyama + swim_V = mkV "og"; --: V ; + travel_V = mkV "gyend";--: V ; + walk_V = mkV "tabur"; --: V ; or kuribata + + --Adverbs + now_Adv = mkAdv "hati" AgrNo; + --far_Adv = mkAdv "hare"; + + --today_Adv = mkAdv "erizooba" AgrNo; + + {- + --Old LexiconCgg.gf burn_V = mkV "sya" ; die_V = mkV "fa" ; fly_V = mkV "guruka" ; @@ -41,362 +161,6 @@ lin -------------------------Differences Rukiga only-------------------- airplane_N : mkN "endegye" N_N; -{- - -abstract Lexicon = Cat ** { -fun - here_Adv; --aha - here1_Adv; -- hanu - here2_Adv; -- hanuuya --exactly here or here with emphasis - add_V3 : V3 ; - airplane_N : N ; - alas_Interj : Interj ; - already_Adv : Adv ; - animal_N : N ; - answer_V2S : V2S ; - apartment_N : N ; - apple_N : N ; - art_N : N ; - ashes_N : N ; - ask_V2Q : V2Q ; - baby_N : N ; - back_N : N ; - bad_A : A ; - bank_N : N ; - bark_N : N ; - beautiful_A : A ; - become_VA : VA ; - beer_N : N ; - beg_V2V : V2V ; - belly_N : N ; - big_A : A ; - bike_N : N ; - bird_N : N ; - bite_V2 : V2 ; - black_A : A ; - blood_N : N ; - blow_V : V ; - blue_A : A ; - boat_N : N ; - bone_N : N ; - book_N : N ; - boot_N : N ; - boss_N : N ; - boy_N : N ; - bread_N : N ; - break_V2 : V2 ; - breast_N : N ; - breathe_V : V ; - broad_A : A ; - brother_N2 : N2 ; - brown_A : A ; - burn_V : V ; - butter_N : N ; - buy_V2 : V2 ; - camera_N : N ; - cap_N : N ; - car_N : N ; - carpet_N : N ; - cat_N : N ; - ceiling_N : N ; - chair_N : N ; - cheese_N : N ; - child_N : N ; - church_N : N ; - city_N : N ; - clean_A : A ; - clever_A : A ; - close_V2 : V2 ; - cloud_N : N ; - coat_N : N ; - cold_A : A ; - come_V : V ; - computer_N : N ; - correct_A : A ; - country_N : N ; - count_V2 : V2 ; - cousin_N : N ; - cow_N : N ; - cut_V2 : V2 ; - day_N : N ; - die_V : V ; - dig_V : V ; - dirty_A : A ; - distance_N3 : N3 ; - doctor_N : N ; - dog_N : N ; - door_N : N ; - do_V2 : V2 ; - drink_V2 : V2 ; - dry_A : A ; - dull_A : A ; - dust_N : N ; - ear_N : N ; - earth_N : N ; - easy_A2V : A2 ; - eat_V2 : V2 ; - egg_N : N ; - empty_A : A ; - enemy_N : N ; - eye_N : N ; - factory_N : N ; - fall_V : V ; - far_Adv : Adv ; - father_N2 : N2 ; - fat_N : N ; - fear_VS : VS ; - fear_V2 : V2 ; - feather_N : N ; - fight_V2 : V2 ; - find_V2 : V2 ; - fingernail_N : N ; - fire_N : N ; - fish_N : N ; - float_V : V ; - floor_N : N ; - flower_N : N ; - flow_V : V ; - fly_V : V ; - fog_N : N ; - foot_N : N ; - forest_N : N ; - forget_V2 : V2 ; - freeze_V : V ; - fridge_N : N ; - friend_N : N ; - fruit_N : N ; - full_A : A ; - fun_AV : A ; - garden_N : N ; - girl_N : N ; - give_V3 : V3 ; - glove_N : N ; - gold_N : N ; - good_A : A ; - go_V : V ; - grammar_N : N ; - grass_N : N ; - green_A : A ; - guts_N : N ; - hair_N : N ; - hand_N : N ; - harbour_N : N ; - hate_V2 : V2 ; - hat_N : N ; - head_N : N ; - heart_N : N ; - hear_V2 : V2 ; - heavy_A : A ; - hill_N : N ; - hit_V2 : V2 ; - hold_V2 : V2 ; - hope_VS : VS ; - horn_N : N ; - horse_N : N ; - hot_A : A ; - house_N : N ; - hunt_V2 : V2 ; - husband_N : N ; - ice_N : N ; - important_A : A ; - industry_N : N ; - iron_N : N ; - john_PN : PN ; - jump_V : V ; - kill_V2 : V2 ; - king_N : N ; - knee_N : N ; - know_V2 : V2 ; - know_VQ : VQ ; - know_VS : VS ; - lake_N : N ; - lamp_N : N ; - language_N : N ; - laugh_V : V ; - leaf_N : N ; - learn_V2 : V2 ; - leather_N : N ; - leave_V2 : V2 ; - left_Ord : Ord ; - leg_N : N ; - lie_V : V ; - like_V2 : V2 ; - listen_V2 : V2 ; - liver_N : N ; - live_V : V ; - long_A : A ; - lose_V2 : V2 ; - louse_N : N ; - love_N : N ; - love_V2 : V2 ; - man_N : N ; - married_A2 : A2 ; - meat_N : N ; - milk_N : N ; - moon_N : N ; - mother_N2 : N2 ; - mountain_N : N ; - mouth_N : N ; - music_N : N ; - name_N : N ; - narrow_A : A ; - near_A : A ; - neck_N : N ; - new_A : A ; - newspaper_N : N ; - night_N : N ; - nose_N : N ; - now_Adv : Adv ; - number_N : N ; - oil_N : N ; - old_A : A ; - open_V2 : V2 ; - paint_V2A : V2A ; - paper_N : N ; - paris_PN : PN ; - peace_N : N ; - pen_N : N ; - person_N : N ; - planet_N : N ; - plastic_N : N ; - play_V2 : V2 ; - play_V : V ; - policeman_N : N ; - priest_N : N ; - probable_AS : A ; - pull_V2 : V2 ; - push_V2 : V2 ; - put_V2 : V2 ; - queen_N : N ; - question_N : N ; - radio_N : N ; - rain_N : N ; - rain_V0 : V ; - read_V2 : V2 ; - ready_A : A ; - reason_N : N ; - red_A : A ; - religion_N : N ; - restaurant_N : N ; - right_Ord : Ord ; - river_N : N ; - road_N : N ; - rock_N : N ; - roof_N : N ; - root_N : N ; - rope_N : N ; - rotten_A : A ; - round_A : A ; - rubber_N : N ; - rub_V2 : V2 ; - rule_N : N ; - run_V : V ; - salt_N : N ; - sand_N : N ; - say_VS : VS ; - school_N : N ; - science_N : N ; - scratch_V2 : V2 ; - sea_N : N ; - seed_N : N ; - seek_V2 : V2 ; - see_V2 : V2 ; - sell_V3 : V3 ; - send_V3 : V3 ; - sew_V : V ; - sharp_A : A ; - sheep_N : N ; - ship_N : N ; - shirt_N : N ; - shoe_N : N ; - shop_N : N ; - short_A : A ; - silver_N : N ; - sing_V : V ; - sister_N : N ; - sit_V : V ; - skin_N : N ; - sky_N : N ; - sleep_V : V ; - small_A : A ; - smell_V : V ; - smoke_N : N ; - smooth_A : A ; - snake_N : N ; - snow_N : N ; - sock_N : N ; - song_N : N ; - speak_V2 : V2 ; - spit_V : V ; - split_V2 : V2 ; - squeeze_V2 : V2 ; - stab_V2 : V2 ; - stand_V : V ; - star_N : N ; - steel_N : N ; - stick_N : N ; - stone_N : N ; - stop_V : V ; - stove_N : N ; - straight_A : A ; - student_N : N ; - stupid_A : A ; - suck_V2 : V2 ; - sun_N : N ; - swell_V : V ; - swim_V : V ; - switch8off_V2 : V2 ; - switch8on_V2 : V2 ; - table_N : N ; - tail_N : N ; - talk_V3 : V3 ; - teacher_N : N ; - teach_V2 : V2 ; - television_N : N ; - thick_A : A ; - thin_A : A ; - think_V : V ; - throw_V2 : V2 ; - tie_V2 : V2 ; - today_Adv : Adv ; - tongue_N : N ; - tooth_N : N ; - train_N : N ; - travel_V : V ; - tree_N : N ; - turn_V : V ; - ugly_A : A ; - uncertain_A : A ; - understand_V2 : V2 ; - university_N : N ; - village_N : N ; - vomit_V : V ; - wait_V2 : V2 ; - walk_V : V ; - warm_A : A ; - war_N : N ; - wash_V2 : V2 ; - watch_V2 : V2 ; - water_N : N ; - wet_A : A ; - white_A : A ; - wide_A : A ; - wife_N : N ; - wind_N : N ; - window_N : N ; - wine_N : N ; - wing_N : N ; - win_V2 : V2 ; - wipe_V2 : V2 ; - woman_N : N ; - wonder_VQ : VQ ; - wood_N : N ; - worm_N : N ; - write_V2 : V2 ; - year_N : N ; - yellow_A : A ; - young_A : A ; - -} } diff --git a/src/rukiga/NounCgg.gf b/src/rukiga/NounCgg.gf index 8fb88ec3d..7c97199d7 100755 --- a/src/rukiga/NounCgg.gf +++ b/src/rukiga/NounCgg.gf @@ -4,10 +4,16 @@ concrete NounCgg of Noun = CatCgg ** open ResCgg, Prelude in { lin - - UsePron pron = pron; -- the result of use pron is a NounPhrase - - DetCN det cn = mkDeterminer det cn; --Should be nemed mkDetCN + + --UsePN : PN -> NP ; -- John + UsePN pn = {s = \\ _ => pn.s; agr = pn.a}; -- John + + UsePron pron = { s = pron.s; agr = pron.agr}; --: Pron -> NP ; -- he + --UsePron pron = pron; -- the result of use pron is a NounPhrase + --MassNP : CN -> NP ; -- (beer) + MassNP cn = {s = \\_ =>cn.s ! Complete ! Pl; agr = AgP3 Pl cn.gender}; --: CN -> NP ; -- milk + --DetCN det cn = mkDeterminer det cn; --Should be nemed mkDetCN + DetCN det cn = mkDetCN det cn; -- the man {- case det.pos of{ PreDeterminer =>{s = det.s ++ cn.s!det.ntype!det.num} ; @@ -17,7 +23,54 @@ lin UseN noun = noun ; --Noun = {s : NounType=>Number => Str ; nc : NClass} ; - AdjCN ap cn = {s=\\ntype, num=>cn.s!ntype!num ++ ap.s!AgP3 num cn.nc; nc=cn.nc}; + --AdjCN ap cn = {s=\\ntype, num=>cn.s!ntype!num ++ ap.s!AgP3 num cn.nc; nc=cn.nc}; + AdjCN ap cn = + case of { + => { + s = \\ ns, num =>ap.s ++ cn.s ! ns ! num ; + gender = cn.gender + }; + => case ap.isPrep of { + False => { + s = \\ ns, num => cn.s ! ns ! num ++ mkAdjPronIVClitic (AgP3 num cn.gender) + ++ ap.post ; + gender = cn.gender + }; + True => { + s = \\ ns, num => (cn.s ! ns ! num) ++ + mkGenPrepNoIVClitic (AgP3 num cn.gender) ++ ap.post ; + gender = cn.gender + } + }; + => { + s = \\ ns, num => mkAdjPronIVClitic (AgP3 num cn.gender) + ++ ap.s ++ (cn.s ! ns ! num) ; + gender = cn.gender + }; + => { + s = \\ ns, num => (cn.s ! ns ! num) ++ ap.post ; + gender = cn.gender + } + + }; -- big house + + + {- + A predeterminer is any word that modifies a noun Phrase. + These Predeterminers are found in Structural + -} + --PredetNP : Predet -> NP -> NP ; -- only the man + PredetNP predet np = let a = np.agr; + nomS = np.s ! Nom; --It does not matter which. Just pick out one. + accS = np.s ! Acc; + in + case of { + => {s = \\_ =>nomS ++ mkPredetPref a ++ Predef.BIND ++ predet.s ; agr = a}; + => {s = \\_ =>nomS ++ mkPredetPref a ++ Predef.BIND ++ predet.s ++ + mkPredetPref a ++ Predef.BIND ++ predet.s2; agr = a}; + => {s = \\_ =>nomS ++ predet.s ; agr = a}; + => {s = \\_ =>nomS ++ predet.s ++ predet.s2; agr = a} -- never seen this case + }; -- Determiner: Type = {s:Str; ntype:NounType; num:Number; pos:Position}; -- type for Determier necessary for catCgg.gf {- @@ -25,15 +78,15 @@ lin -} --DetQuant quant num = {s = quant.s ++ num.s ; ntype = Complete ; num = num.n ; pos = PostDeterminer } ; - NumSg = {s=[]; n=Sg}; - NumPl = {s=[]; n=Pl}; + --NumSg = {s=[]; n=Sg}; + --NumPl = {s=[]; n=Pl}; -- NumCard card = {...}; - IndefArt = {s=[]}; - DefArt = {s=[]} ; + --IndefArt = {s=[]}; + --DefArt = {s=[]} ; -- AdvCN : CN -> Adv -> CN ; -- house on the hill - AdvCN cn adv ={s=\\ntype,num =>cn.s!ntype!num ++ adv.s!(AgP3 num cn.nc); nc=cn.nc}; + --AdvCN cn adv ={s=\\ntype,num =>cn.s!ntype!num ++ adv.s!(AgP3 num cn.nc); nc=cn.nc}; {- --1 Noun: Nouns, noun phrases, and determiners diff --git a/src/rukiga/ParadigmsCgg.gf b/src/rukiga/ParadigmsCgg.gf index 47456de2c..0cb3df39e 100755 --- a/src/rukiga/ParadigmsCgg.gf +++ b/src/rukiga/ParadigmsCgg.gf @@ -16,16 +16,19 @@ oper mkN = overload { - mkN : (fish : Str) -> NClass -> N + mkN : (fish : Str) -> Gender -> N = \fish,nclass -> lin N (mkNoun fish fish nclass) ; - mkN : (man,men : Str) -> NClass -> N + mkN : (man,men : Str) -> Gender -> N = \man,men,nclass -> lin N (mkNoun man men nclass) ; } ; - mkV = overload { - mkV : (cry : Str) -> V - = \cry -> lin V (mkVerb cry) ; - }; + + mkV : Str -> Verb = \root ->{s =root; morphs= mkVerbMorphs}; + mkV2 : Str -> Verb2 = \root ->mkV root ** {comp =[]}; + --mkV = overload { + --mkV : (cry : Str) -> V + --= \cry -> lin V (mkVerb cry) ; -- what does it mean to create a lin on the fly + --}; {- Note: The following is copied from the file swahili/ParadigmsSwa.gf diff --git a/src/rukiga/PhraseCgg.gf b/src/rukiga/PhraseCgg.gf index 337b67077..0f494fe72 100755 --- a/src/rukiga/PhraseCgg.gf +++ b/src/rukiga/PhraseCgg.gf @@ -5,13 +5,21 @@ concrete PhraseCgg of Phrase = CatCgg ** open Prelude, ResCgg in { lin UttS sent = sent ; - + UttQS qs = qs ; --: QS -> Utt ;-- does John walk PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; NoPConj = {s = ""} ; NoVoc = {s = ""} ; - + -- Utterances are formed from sentences, questions, and imperatives. + UttNP np = {s= np.s!Acc}; --: NP -> Utt ; + UttAdv adv = {s = adv.s}; --: Adv -> Utt ; -- in the house + UttImpSg pol imp = {s = + case pol.isTrue of { + True => imp.s!True; + False => (mkSubjClitic (AgMUBAP2 Sg)) ++ imp.s!False + } + };--: Pol -> Imp -> Utt ; -- (do not) walk ----s {- --1 Phrase: Phrases and Utterances diff --git a/src/rukiga/ResCgg.gf b/src/rukiga/ResCgg.gf index f39a38b75..31c38a6f3 100755 --- a/src/rukiga/ResCgg.gf +++ b/src/rukiga/ResCgg.gf @@ -14,46 +14,18 @@ resource ResCgg = ParamX ** -- open Prelude, (Predef=Predef) in { -param - NounType = Complete | Incomplete ; - Position = PostDeterminer | PreDeterminer ; - Case = Nom | Acc | Gen ; - Agr = AgP3 Number NClass | AgMUBAP1 Number |AgMUBAP2 Number ; - - NClass = MU_BA | -- for human beings and deity e.g. omuntu/abantu - KI_BI | -- eki-tookye/ebi-tookye - N_N | -- nouns that do not vary their spelling with singular and plural (normally begin with "e") - KU_MA | -- okuguru / amaguru, (leave out the non plurals)okugyenda (Deverbative) / Amagyenda (Deverbative outward journey) - BU_MA | - RU_BU | -- oruro / oburo - GU_GA | -- ogushaija / agashaija --dimunitive - ZERO_ZERO | -- nouns without initial vowel nor class syllables e.g barugu, muha, sho - MU_MI | -- - RI_MA | - I_MA | - KA_BU | - KA_TU | --dimunitive version of KA_BU belong to same noun class - RU_N | -- orurimi / endimi - RU_MA | - --those of place or location - HA | - MU | - KU | - --aditions - ZERO_BU | - ZERO_BI | - ZERO_MA | -- amate takes the concords of plural particle "ma" - ZERO_MI | - ZERO_TU | - ZERO_N | - I_ZERO | - RI_ZERO | - KU_ZERO | - MU_ZERO | - RU_ZERO | - ZERO_BAA | -- human relationships - KA_ZERO ; --akabi (ZERO to the right means the concords of that noun are always those of the singular as used in noun-classes KA) see KA_BU, KA_TU - +param + --Number = Sg | Pl; + --Person = Per1 | Per2 | Per3; + --Use Noun Class (NClass) as suggested in J&M chapter 3 pg 86. + Gender = MU_BA | KI_BI | N_N | KU_MA | BU_MA | + RU_BU | GU_GA | ZERO_ZERO | MU_MI | RI_MA | + I_MA | KA_BU | KA_TU | RU_N | RU_MA | HA | + MU | KU | ZERO_BU | ZERO_BI | ZERO_MA | + ZERO_MI | ZERO_TU | ZERO_N | I_ZERO | + RI_ZERO | KU_ZERO | MU_ZERO | RU_ZERO | + KA_ZERO |ZERO_BAA | N_ZERO; + Case = Acc | Nom ; -- we need to include Gen because we shall need it with Gen Pronouns PersonalPronounType = SubjM | Obj | RelSubj | RelObj | AdjPron2 | -- aAdjectival Prefixes with initial vowel with the semantics of "the" e.g. -- omuntu o-mu-rungi @@ -63,12 +35,63 @@ param GenPrep2 | GenAdj | SStandPron ; --Self-standing pronouns + {- + --there are several and i.e. + -- na (two nouns, 2 Noun Phrases, 2 Pronouns, 2 relative subject clauses, ) + --kandi (clauses having a commonality of subjects, object or tense) + --the best structure is a table + -} + ConjArg = Nn_Nn | Nps_Nps | Pns_Pns | RelSubjCls | Other; + AgrConj = AConj ConjArg; + Agreement = AgP3 Number Gender | AgMUBAP1 Number |AgMUBAP2 Number ; + AgrExist = AgrNo | AgrYes Agreement; + Position = PostDeterminer | PreDeterminer ; + + --Functional forms of the regular verb + Mood = Infinitive | Imperative | Subjunctive | Perfective; + VerbCat = Simple | Prepositional | Causative; + Voice = Active | Passive; + -- all forms of normal Eng verbs, although not yet used in MiniGrammar + VForm = VF Voice Mood VerbCat ; + -- may not need it + NounCat = ComNoun | PropNoun; --prepositions agree with nouns to form adverbial Phrases + PrepForm = Form1 | Form2; -- omu and omuri, aha, ahari +{- + Complete = Nouns with IV, + Incomplete = Nouns without IV: important for use with pre-determiners + like buri i.e every + +-} +NounState = Complete | Incomplete ; + oper + -- the is for Common Nouns only + Noun : Type = {s : NounState => Number => Str ; gender : Gender} ; + + ivs : pattern Str = #("a" | "e" | "o"); --pattern for initial vowels - Noun : Type ; - Noun = {s : NounType=>Number => Str ; nc : NClass } ; + human_relations: pattern Str = --expand this list + #("Taata" | "Maama" | "Shwento" | "Shwenkuru" | "Nyinento" | "Nyinenkuru"); + + mkNoun : Str -> Str ->Gender ->Noun = \sg,pl, g -> { + s = table { + Complete => table { Sg => sg ; Pl => pl}; + Incomplete => table { + Sg => case sg of { + (#ivs + _) => Predef.drop 1 sg; + _ => sg }; + Pl => case pl of { + (#ivs + _) => Predef.drop 1 pl; + _ => pl } + } + }; + gender = g + } ; - smartNoun : Str -> NClass -> Noun + {- Smart paradigm + This operation needs thorough testing with all nouns from a file + -} + smartNoun : Str -> Gender -> Noun = \omuntu, g -> case of { -- Handling the Tone System is also another problem. @@ -76,73 +99,43 @@ oper < "o" + "mu" + stem, MU_BA > => mkNoun omuntu ("aba" + stem) g ; --special cases like omwana, omwishiki, omwojo - < "o" + "mw" + stem, MU_BA > => mkNoun omuntu (combine_morphemes "aba" stem) g ; --same as mu_ba but the "u" + "a" of the stem to form mwa + < "o" + "mw" + stem, MU_BA > => mkNoun omuntu (combine_morphemes "aba" stem) g ; --same as mu_ba but the "u" + "a" of the stem to form mwa < "o" + "mu" + stem, MU_MI > => mkNoun omuntu (combine_morphemes "emi" stem) g ; - < "o" + "ru" + stem, RU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; - < "o" + "ru" + stem, RU_N > => mkNoun omuntu (combine_morphemes "en" stem) g ; --desist from providing a singlar only but give both + < "o" + "ru" + stem, RU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "o" + "ru" + stem, RU_N > => mkNoun omuntu (combine_morphemes "en" stem) g ; --desist from providing a singlar only but give both < "o" + "bu" + stem, BU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; - < "o" + "gu" + stem, GU_GA > => mkNoun omuntu (combine_morphemes "aga" stem) g ; - < "o" + ("ku" | "kw") + stem, KU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; - < "o" + "kw" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; - < "o" + "ku" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "o" + "ru" + stem, RU_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ; - < "o" + "ru" + stem, RU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "gu" + stem, GU_GA > => mkNoun omuntu (combine_morphemes "aga" stem) g ; + < "o" + ("ku" | "kw") + stem, KU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "o" + "kw" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; + < "o" + "ku" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "ru" + stem, RU_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ; + < "o" + "ru" + stem, RU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "a" + "ha" + stem, HA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "a" + "ka" + stem, KA_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ; + < "a" + "ha" + stem, HA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "a" + "ka" + stem, KA_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ; < "a" + "ka" + stem, KA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "e" + "ki" + stem, KI_BI > => mkNoun omuntu (combine_morphemes "ebi" stem) g ; - < "e" + "ki" + stem, KI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "e" + "i" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" "") g ; - < "e" + "i" + stem, I_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "e" + "ri" + stem, RI_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "e" + "ki" + stem, KI_BI > => mkNoun omuntu (combine_morphemes "ebi" stem) g ; + < "e" + "ki" + stem, KI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "e" + "i" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" "") g ; + < "e" + "i" + stem, I_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "e" + "ri" + stem, RI_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; < "e" + "ri" + stem, RI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural - < "e" + "ry" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "e" + "ry" + stem, I_MA | RI_MA> => mkNoun omuntu (combine_morphemes "ama" stem) g ; -- --special cases shall be added with due course as errors are identified - <"e" + "ky" + stem, KI_BI> => mkNoun omuntu (combine_morphemes "ebi" stem) g ; - < _ ,N_N | ZERO_MA > => mkNoun omuntu omuntu g ; + <"e" + "ky" + stem, KI_BI> => mkNoun omuntu (combine_morphemes "ebi" stem) g ; + < _ ,N_N | ZERO_MA | ZERO_ZERO > => mkNoun omuntu omuntu g ; --< _ ,ZERO_MA > => mkNoun omuntu ("ama" + stem) g (Predef.drop 1 omuntu); --< _ ,> => mkNoun omuntu omuntu g (Predef.drop 1 omuntu); - <_ , ZERO_BAA> => mkNoun omuntu ("baa" + omuntu) g; - < _ ,ZERO_ZERO > => mkNoun omuntu omuntu g; - < _ ,_ > => mkNoun omuntu omuntu g -- improve as we go on. + <_ , ZERO_BAA> => mkNoun omuntu ("baa" + omuntu) g ; + < _ ,_ > => mkNoun omuntu omuntu g-- improve as we go on. }; - {- Should be taken to Ajective concrete Syntanx-} - mkNoun : Str -> Str -> NClass -> Noun ; - mkNoun child children nc - = { s = table {Complete => table { - Sg => child ; Pl => children } ; - Incomplete => table { - Sg => Predef.drop 1 child ; Pl => Predef.drop 1 children } }; --removal of the initial vowel - nc = nc - } ; - mkN = overload { - mkN : Str -> NClass -> Noun = smartNoun ; - mkN : Str -> Str -> NClass -> Noun = mkNoun; - } ; - - - -- combine_morphemes need the function last to get - -- the last letter in a morphme. - -- uses Predef.length and Predef.take - -- Please use let so that you compute Predef.length once and use if then else - -- if possible - {- - last : Str -> Str ; - last = \ w -> - case (Predef.length w) of { - 0 => []; - _ => Predef.drop ((Predef.length w)-1) w - } ; - - -} - {- +{- This function tries to handle phonological-conditioning. Usage: Use it whenever you are trying to combine morphemes especially in: @@ -159,7 +152,7 @@ oper 1. personal experience 2. Morris and Kirwan Runynakore Grammar 3. but we shall add more as we meet them during debugging - -} + -} combine_morphemes : Str -> Str -> Str ; combine_morphemes = \ f, s -> case <(Predef.dp 1 f), (Predef.take 1 s)> of { @@ -172,739 +165,615 @@ oper <"i", "i"> => f + Predef.drop 1 s ; <_ , _ > => f + s } ; - Determiner : Type = {s : Str ; ntype : NounType ; num : Number ; pos : Position } ; -- type for Determier necessary for catCgg.gf - Pronoun : Type ={s : Str ; agr : Agr} ; - - VerbPhrase : Type = { s : Agr => Polarity => Tense => Anteriority => Str}; - - VPSlash : Type = VerbPhrase ** { c : Str } ; - - Numer : Type = { s: Str ; n : Number}; - - Clause : Type = {s : Polarity => Tense => Anteriority => Str}; - - Adv : Type = {s : Agr => Str } ; -- check pages 116-131 of grammar book - mkAdv : Str -> Adv = \ s -> { s= \\ agr => s }; - - ParticleForms : Type = PersonalPronounType => Agr => Str; - mkNCParticles : ParticleForms = table { - SubjM => table { - AgMUBAP1 Sg => "n" ; - AgMUBAP1 Pl => "tu" ; - AgMUBAP2 Sg => "wa" ; - AgMUBAP2 Pl => "mu" ; - AgP3 Sg MU_BA => "a" ; - AgP3 Pl MU_BA => "ba" ; - AgP3 Sg KI_BI => "ki" ; - AgP3 Pl (KI_BI | ZERO_BI) => "bi" ; - AgP3 Sg (RU_N | RU_MA | RU_ZERO | RU_BU) => "ru" ; - AgP3 Pl RU_N => "zi"; --| "i"; - AgP3 Sg N_N => "e"; - AgP3 Pl N_N => "zi"; --| "i"; - AgP3 Sg (MU_MI | MU_ZERO) => "gu" ; - AgP3 Pl MU_MI => "e" ; - AgP3 Sg (RI_MA | RI_ZERO | I_ZERO) => "ri"; - AgP3 Pl (RI_MA | BU_MA | KU_MA | ZERO_MA | I_MA |RU_MA) => "ga" ; - AgP3 Sg (KA_BU | KA_ZERO | KA_TU) => "ka" ; - AgP3 Pl (KA_BU | RU_BU) => "bu" ; - AgP3 Sg ZERO_BU => "bu" ; - AgP3 Pl ZERO_BU => "bu" ; - AgP3 Sg ZERO_BI => "bi" ; - AgP3 Sg ZERO_MA => "ga" ; - AgP3 Pl RI_ZERO => "ga" ; - AgP3 Sg KU_ZERO => "ku" ; - AgP3 Pl KU_ZERO => "ku" ; - AgP3 Pl MU_ZERO => "gu" ; - AgP3 Pl RU_ZERO => "ru" ; - AgP3 Sg ZERO_TU => "tu" ; - AgP3 Pl ZERO_TU => "tu" ; - AgP3 Sg (ZERO_MI | ZERO_ZERO) => "" ; - AgP3 Pl ZERO_MI => "e" ; - AgP3 Pl KA_ZERO => "" ; - _ => "XX" --for checking if there is some class unaccounted for - }; - {-Object particle may be used as + + {- + combine_morphemes = \ f, s -> + case <(f), (s)> of { + => f ++ "d" ++ g; + => a ++ Predef.BIND ++ "nz" ++ Predef.BIND ++ s; + => a ++ Predef.BIND ++ "w" ++ Predef.BIND ++ s ; + => a ++ Predef.BIND ++ "y" ++ Predef.BIND ++ s ; + => a ++ Predef.BIND ++ "m" ++ Predef.BIND ++ s ; + => a ++ Predef.BIND ++ s ; -- However, note that for pronouns, the n changes to m + => a ++ Predef.BIND ++ "mp" ++ Predef.BIND ++ g ; + => f ++ Predef.BIND ++ g ; + <_ , _ > => f ++ s + } ; + -} + + --separate + {- + dealing with ProperNouns + They do not have plurals but when a proper noun + refers to a place then it is important to keep + that label because is helps us disambiguate which + preposition to use for in, on and at i.e LOCATIVES omuri, ahari, etc + -} + ProperNoun : Type = {s: Str ; a:Agreement ; isPlace : Bool}; + mkPN : Str -> Agreement -> Bool -> ProperNoun = \ pn, a, b-> + { + s = pn ; + a = a; + isPlace = b; + } ; + + -- concatenates the string left to right + mkClitic : Str -> Str = \c -> c ++ Predef.BIND ; + + -- concatenates the string right to left + mkSuffix : Str -> Str = \c -> Predef.BIND ++ c ; + + -- creating clitics depending on number + mkClitics : Str -> Str -> Number -> Str = \sg,pl,n -> + case n of { + Sg => mkClitic sg ; + Pl => mkClitic pl + } ; + + mkSubjClitic : Agreement -> Str = \a -> + case a of { + AgMUBAP1 n => mkClitics "n" "tu" n; + --AgMUBAP1 Pl => "tu" ; + AgMUBAP2 n => mkClitics "o" "mu" n; + --AgMUBAP2 Pl => "mu" ; + AgP3 n MU_BA => mkClitics "a" "ba" n; + --AgP3 Pl MU_BA => "ba" ; + AgP3 Sg KI_BI => mkClitic "ki" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "bi" ; + AgP3 Sg (RU_N | RU_MA | RU_ZERO | RU_BU) => mkClitic "ru" ; + AgP3 Pl RU_N => mkClitic "zi"; --| "i"; + AgP3 Sg N_N => mkClitic "e"; + AgP3 Pl N_N => mkClitic "zi"; --| "i"; + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "gu" ; + AgP3 Pl MU_MI => "e" ; + AgP3 Sg (RI_MA | RI_ZERO | I_ZERO) =>mkClitic "ri"; + AgP3 Pl (RI_MA | BU_MA | KU_MA | ZERO_MA | I_MA |RU_MA) => mkClitic "ga" ; + AgP3 Sg (KA_BU | KA_ZERO | KA_TU) => mkClitic "ka" ; + AgP3 Pl (KA_BU | RU_BU) => mkClitic "bu" ; + AgP3 Sg ZERO_BU => mkClitic "bu" ; + AgP3 Pl ZERO_BU => mkClitic "bu" ; + AgP3 Sg ZERO_BI => mkClitic "bi" ; + AgP3 Sg ZERO_MA => mkClitic "ga" ; + AgP3 Pl RI_ZERO => mkClitic "ga" ; + AgP3 Sg KU_ZERO => mkClitic "ku" ; + AgP3 Pl KU_ZERO => mkClitic "ku" ; + AgP3 Pl MU_ZERO => mkClitic "gu" ; + AgP3 Pl RU_ZERO => mkClitic "ru" ; + AgP3 Sg ZERO_TU => mkClitic "tu" ; + AgP3 Pl ZERO_TU => mkClitic "tu" ; + AgP3 Sg (ZERO_MI | ZERO_ZERO) => mkClitic "" ; + AgP3 Pl ZERO_MI => mkClitic "e" ; + AgP3 Pl KA_ZERO => mkClitic "" ; + _ => mkClitic "SubjNotKnown" --for checking if there is some class unaccounted for + }; + + {-Object particle may be used as 1. a prefix: e.g mu-kwate = catch him, 2. an infix: o-mu-kwate = you catch him -} - Obj => table { - AgMUBAP1 Sg => "n" ; - AgMUBAP1 Pl => "tu" ; - AgMUBAP2 Sg => "ku" ; - AgMUBAP2 Pl => "ba" ; - AgP3 Sg MU_BA => "mu" ; - AgP3 Pl MU_BA => "ba"; - AgP3 Pl (ZERO_BU | KA_BU | KA_TU | RU_BU) => "bu" ; - AgP3 Sg BU_MA => "bu" ; - AgP3 Sg KI_BI => "ki" ; - AgP3 Pl (KI_BI | ZERO_BI) => "bi"; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ga" ; - AgP3 (Sg | Pl) HA => "ha"; - AgP3 Sg (I_ZERO | I_MA | RI_MA) => "ri" ; - AgP3 Sg (KA_ZERO | KA_BU | KA_TU) => "ka" ; - AgP3 Sg (KU_ZERO | KU_MA) => "ku" ; - {- - #comment for the following two lines - the follwing partciles are all used by Noun Classes of Place i.e. HA, KU and MU - We take the particle to be "ha" for all of them although noun class KU can use - another particle "gi" -- see Table of Concords in Appendix of Dictionary by Mpairwe and Kahangi + mkObjClitic : Agreement -> Str = \a ->case a of { + + AgMUBAP1 n => mkClitics "n" "tu" n; + --AgMUBAP1 Pl => "tu" ; + AgMUBAP2 n => mkClitics "ku" "ba" n; + --AgMUBAP2 Pl => "ba" ; + AgP3 Sg MU_BA => mkClitic "mu" ; + AgP3 Pl MU_BA => mkClitic "ba"; + AgP3 Pl (ZERO_BU | KA_BU | KA_TU | RU_BU) => mkClitic "bu" ; + AgP3 Sg BU_MA => mkClitic "bu" ; + AgP3 Sg KI_BI => mkClitic "ki" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "bi"; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "ga" ; + AgP3 (Sg | Pl) HA => mkClitic "ha"; + AgP3 Sg (I_ZERO | I_MA | RI_MA) => mkClitic "ri" ; + AgP3 Sg (KA_ZERO | KA_BU | KA_TU) => mkClitic "ka" ; + AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "ku" ; + {- + #comment for the following two lines + the follwing partciles are all used by Noun Classes of Place i.e. HA, KU and MU + We take the particle to be "ha" for all of them although noun class KU can use + another particle "gi" -- see Table of Concords in Appendix of Dictionary by Mpairwe and Kahangi - Note: The particles do not change with respect to gender + Note: The particles do not change with respect to gender - TODO: obtain clear examples of usage - -} - AgP3 (Sg | Pl) (HA | MU) => "ha" ; - AgP3 (Sg | Pl) KU => "ha" ; -- gi is also possible -- see comment above + TODO: obtain clear examples of usage + -} + AgP3 (Sg | Pl) (HA | MU) => mkClitic "ha" ; + AgP3 (Sg | Pl) KU => mkClitic "ha" ; -- gi is also possible -- see comment above - AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => "ru" ; - AgP3 Pl (KA_TU | ZERO_TU) => "tu" ; + AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => mkClitic "ru" ; + AgP3 Pl (KA_TU | ZERO_TU) => mkClitic "tu" ; + + AgP3 Sg (N_N | ZERO_ZERO) => mkClitic "gi" ; + + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "gu" ; + AgP3 Pl GU_GA => "ga" ; + AgP3 Pl (MU_MI | ZERO_MI) => mkClitic "gi" ; + {- + According to Mpaiwe & Kahangi in their table of concords, the particle for the plural + of noun classes N_N , ZERO_ZERO , ZERO_N & RU_N can be either "i" or "zi" depending + on object they refer to. - AgP3 Sg (N_N | ZERO_ZERO) => "gi" ; - - AgP3 Sg (MU_MI | MU_ZERO) => "gu" ; - AgP3 Pl GU_GA => "ga" ; - AgP3 Pl (MU_MI | ZERO_MI) => "gi" ; - {- - According to Mpaiwe & Kahangi in their table of concords, the particle for the plural - of noun classes N_N , ZERO_ZERO , ZERO_N & RU_N can be either "i" or "zi" depending - on object they refer to. - - Problem: - However, we cannot use the | operator in strings as GF will - fail to compile to comletion. - Implication: - Some of our output strings will have the wrong object particle attached. - Even if the operator | worked, we would generate two versions of the linearized - string of which one would be right and the other wrong - What is the solution to this? - -} - AgP3 Pl (N_N | ZERO_ZERO | ZERO_N | RU_N) => "zi" ; --some cases require use of particle "i" - - _ => "-" -- Hopefully exhausted all forms - }; - -- who, which - RelSubj => table { - AgMUBAP1 Sg => "o" ; - AgMUBAP1 Pl => "aba" ; - AgMUBAP2 Sg => "o" ; - AgMUBAP2 Pl => "aba" ; - AgP3 Sg MU_BA => "o" ; - AgP3 Pl MU_BA => "aba" ; - AgP3 Sg BU_MA => "obu" ; - AgP3 Pl (ZERO_BU | KA_BU | RU_BU) =>"obu" ; - AgP3 Sg KI_BI => "eki" ; - AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "aga" ; - AgP3 (Sg | Pl) (HA | MU) => "ha" ; -- better AgP3 _ (HA | MU) => "ha"; - AgP3 (Sg | Pl) KU => "e" ; - AgP3 Sg (I_ZERO | I_MA | RI_ZERO | RI_MA) => "eri" ; - AgP3 Sg (KA_ZERO | KA_BU) => "aka" ; - AgP3 Sg (KU_ZERO | KU_MA) => "oku" ; - AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => "oru" ; - AgP3 Pl (ZERO_TU | KA_TU) => "otu" ; - AgP3 Pl RU_N => "ezi" ; - AgP3 Sg N_N => "ei" ; - AgP3 Pl (ZERO_ZERO | ZERO_N | RU_N | N_N) => "ezi" ; - AgP3 Sg (MU_MI | MU_ZERO | GU_GA) => "ogu" ; - AgP3 Sg (ZERO_ZERO | N_N ) => "e" ; - AgP3 Pl (MU_MI | ZERO_MI) => "e" ; - AgP3 Pl GU_GA => "aga" ; - _ => "=" -- means something forgoten i.e. debugging purposes - }; + Problem: + However, we cannot use the | operator in strings as GF will + fail to compile to comletion. + Implication: + Some of our output strings will have the wrong object particle attached. + Even if the operator | worked, we would generate two versions of the linearized + string of which one would be right and the other wrong + What is the solution to this? + -} + AgP3 Pl (N_N | ZERO_ZERO | ZERO_N | RU_N) => mkClitic "zi" ; --some cases require use of particle "i" + + _ => mkClitic "-" -- Hopefully exhausted all forms + }; + Adverb = {s :Str; agr : AgrExist} ; + mkAdv: Str -> AgrExist -> Adverb =\str, agr ->{s=str; agr=agr}; + --dealing with the adjective + {- + The Adjective can be before the noun for TRUE or + it can be after the noun (FLASE) + Most Adjectives are stems which are meaningless + without adjectival prefixes. These prefixes are concords that agree + with the noun before the them. + + However some adjectives are self-standing. - --Relative Object paticle such as whom/which found in row 13 of Table of concords in Mpairwe & Kahangi - RelObj => table { - AgMUBAP1 Sg => "ou" ; - AgMUBAP1 Pl => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator - AgMUBAP2 Sg => "ou" ; - AgMUBAP2 Pl => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator - AgP3 Sg MU_BA => "ou" ; - AgP3 Pl MU_BA => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator - AgP3 Sg BU_MA => "obu" ; - AgP3 Pl (ZERO_BU | KA_BU |RU_BU) => "obu" ; - AgP3 Sg KI_BI => "eki" ; - AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ; - {- - The noun classes ZERO_MA,KU_MA,RI_MA,I_MA & BU_MA can use of Relative object particles - "agi" or "agu" (depending on noun class of clause -sure? (depending on what?)) but we - choose one "agi" because of compiler issues with | operator - - Qn: Any Solutions - -} - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "agi" ; - - -- of place HA & MU - --both ahi and "ahu" are valid particles for noun classes HA and MU but "ahu" omitted - --because of compiler issues with | operator - AgP3 (Sg | Pl) (HA | MU) => "ahi" ; -- better AgP3 _ (HA | MU) => "ha"; + You can introduce a more meaningful name or using + Inari's method of avoiding tables + i.e. Adjective: Type = { pre : Str ; post : Str; isPre: Bool; isProper : Bool} + pre -- the adjective or adjective stem that comes before noun + post --the adjective or adjective stem that comes after noun + isPre --whether the adjective comes before (TRUE) or after (FALSE) the noun + isProper -- True for a full adjective anf False for an adjectival stem + isPrep -- does the adjective need a preposition especially those that come after the noun. + improve that further by avoiding carrying a table of strings + using arne's technique + -} + --AdjectivalPhrase : Type {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool} ; + AdjectivalPhrase : Type = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool}; + Adjective : Type = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool}; + mkAdjective: Str -> Bool -> Bool -> Bool -> Adjective = \ a , isPre, isProper, isPrep -> case isPre of { + True => { s = a ; post = [] ; isPre = True; isProper = isProper; isPrep = isPrep}; + --this is supposed to be a concatenation use bind and I will do so later + False => { s = [] ; post = a; isPre = False; isProper = isProper; isPrep = isPrep} -- requires agreement later + }; + {- + TO DO: + --Subject prefixes / particles of clitics using bind + -} + -- Adjectival Prefixes with initial vowel with the semantics of "the" + mkAdjPronIVClitic : Agreement -> Str = \a -> case a of { + AgMUBAP1 n => mkClitics "omu" "aba" n; + --AgMUBAP1 Pl => "aba" ; + AgMUBAP2 n => mkClitics "omu" "aba" n; --probably an error check your grammar book + --AgMUBAP2 Pl => "aba" ; + AgP3 n MU_BA => mkClitics "omu" "aba" n; + --AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => mkClitic "obu" ; + AgP3 Sg BU_MA => mkClitic "obu" ; + AgP3 Pl (KA_BU | RU_BU) => mkClitic "obu" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "ebi" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "ama"; + AgP3 (Sg | Pl) (HA | MU) => mkClitic "aha" ; -- of place HA & MU + AgP3 (Sg | Pl) KU => mkClitic "en" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>mkClitic "eri" ; + AgP3 Sg (KA_ZERO | KA_BU) =>mkClitic "aka" ; + AgP3 Sg KI_BI => mkClitic "eki" ; + AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "oku" ; + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "omu" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => mkClitic "oru" ; + AgP3 Pl (ZERO_TU | KA_TU) =>mkClitic "otu" ; + AgP3 Sg (ZERO_ZERO | N_N) =>mkClitic "en" ; + AgP3 Pl ZERO_MI =>mkClitic "en" ; + AgP3 Pl MU_MI => mkClitic "emi"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "en" ; + AgP3 Sg GU_GA => mkClitic "ogu" ; + AgP3 Pl GU_GA => mkClitic "aga" ; + _ => mkClitic "XXX" -- error checking for any case not catered for - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"eri" ; - -- of place KU - AgP3 (Sg | Pl) KU => "ei" ; + }; - --both aki and "aku" are valid particles for noun classes KA_ZERO & KA_BU but "aku" omitted - --because of compiler issues with | operator - AgP3 Sg (KA_ZERO | KA_BU) =>"aki" ; + mkSStand :Agreement -> Str = \a -> case a of { + AgMUBAP1 n => mkClitics "nyowe" "itwe" n; + --AgMUBAP1 Pl => "aba" ; + AgMUBAP2 n => mkClitics "iwe" "imwe" n; --probably an error check your grammar book + --AgMUBAP2 Pl => "aba" ; + AgP3 n MU_BA => mkClitics "uwe" "bo" n; + --AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => mkClitic "bwo" ; + AgP3 Sg BU_MA => mkClitic "bwo" ; + AgP3 Pl (KA_BU | RU_BU) => mkClitic "bwo" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "byo" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "go"; + AgP3 (Sg | Pl) HA => mkClitic "ho" ; -- of place HA + AgP3 (Sg | Pl) MU => mkClitic "mwo" ; -- of place MU + AgP3 (Sg | Pl) KU => mkClitic "yo" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>mkClitic "ryo" ; + AgP3 Sg (KA_ZERO | KA_BU) =>mkClitic "ko" ; + AgP3 Sg KI_BI => mkClitic "kyo" ; + AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "kwo" ; + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "gwo" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => mkClitic "rwo" ; + AgP3 Pl (ZERO_TU | KA_TU) =>mkClitic "two" ; + AgP3 Sg (ZERO_ZERO | N_N) =>mkClitic "yo" ; + AgP3 Pl ZERO_MI =>mkClitic "yo" ; + AgP3 Pl MU_MI => mkClitic "yo"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "zo" ; + AgP3 Sg GU_GA => mkClitic "gwo" ; + AgP3 Pl GU_GA => mkClitic "go" ; + _ => mkClitic "XXX" -- error checking for any case not catered for - AgP3 Sg (KU_ZERO | KU_MA) => "oku" ; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "oru" ; - AgP3 Pl (ZERO_TU | KA_TU) =>"otu" ; + }; + -- This involved only change of the personal pronouns as for selfstanding pronouns. + -- How can it be done without code repeation? + mkPredetPref :Agreement -> Str = \a -> case a of { + AgMUBAP1 n => mkClitics "ny" "twe" n; + --AgMUBAP1 Pl => "aba" ; + AgMUBAP2 n => mkClitics "we" "mwe" n; --probably an error check your grammar book + --AgMUBAP2 Pl => "aba" ; + AgP3 n MU_BA => mkClitics "we" "bo" n; + --AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => mkClitic "bwo" ; + AgP3 Sg BU_MA => mkClitic "bwo" ; + AgP3 Pl (KA_BU | RU_BU) => mkClitic "bwo" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "byo" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "go"; + AgP3 (Sg | Pl) HA => mkClitic "ho" ; -- of place HA + AgP3 (Sg | Pl) MU => mkClitic "mwo" ; -- of place MU + AgP3 (Sg | Pl) KU => mkClitic "yo" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>mkClitic "ryo" ; + AgP3 Sg (KA_ZERO | KA_BU) =>mkClitic "ko" ; + AgP3 Sg KI_BI => mkClitic "kyo" ; + AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "kwo" ; + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "gwo" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => mkClitic "rwo" ; + AgP3 Pl (ZERO_TU | KA_TU) =>mkClitic "two" ; + AgP3 Sg (ZERO_ZERO | N_N) =>mkClitic "yo" ; + AgP3 Pl ZERO_MI =>mkClitic "yo" ; + AgP3 Pl MU_MI => mkClitic "yo"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "zo" ; + AgP3 Sg GU_GA => mkClitic "gwo" ; + AgP3 Pl GU_GA => mkClitic "go" ; + _ => mkClitic "XXXPredPref" -- error checking for any case not catered for - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "ezi" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"ei" ; - AgP3 Sg (MU_MI | MU_ZERO | GU_GA) => "ogu" ; - AgP3 Pl (MU_MI | ZERO_MI) => "ei" ; - - --both agi and "agu" are valid particles for noun classes GU_GA in plural but "agu" omitted - --because of compiler issues with | operator - AgP3 Pl GU_GA => "agi" ; - _ => "=" -- means something forgoten i.e. debugging purposes - }; + }; - -- Adjectival Prefixes with initial vowel with the semantics of the - AdjPron2 => table { - AgMUBAP1 Sg => "omu" ; - AgMUBAP1 Pl => "aba" ; - AgMUBAP2 Sg => "omu" ; - AgMUBAP2 Pl => "aba" ; - AgP3 Sg MU_BA => "omu" ; - AgP3 Pl MU_BA => "aba" ; - AgP3 Pl ZERO_BU => "obu" ; - AgP3 Sg BU_MA => "obu" ; - AgP3 Pl (KA_BU | RU_BU) =>"obu" ; - AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ama"; - AgP3 (Sg | Pl) (HA | MU) => "aha" ; -- of place HA & MU - AgP3 (Sg | Pl) KU => "en" ; -- of place KU - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"eri" ; - AgP3 Sg (KA_ZERO | KA_BU) =>"aka" ; - AgP3 Sg KI_BI => "eki" ; - AgP3 Sg (KU_ZERO | KU_MA) => "oku" ; - AgP3 Sg (MU_MI | MU_ZERO) => "omu" ; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "oru" ; - AgP3 Pl (ZERO_TU | KA_TU) =>"otu" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"en" ; - AgP3 Pl ZERO_MI => "en" ; - AgP3 Pl MU_MI => "emi"; - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "en" ; - AgP3 Sg GU_GA => "ogu" ; - AgP3 Pl GU_GA => "aga" ; - _ => "XXX" -- error checking for any case not catered for - }; + -- Adjectival Prefixes without initial vowel with the semantics for adjectives used in Imperative negative form + mkAdjPronNoIVClitic : Agreement -> Str = \a -> case a of { + AgMUBAP1 n => mkClitics "mu" "ba" n; + --AgMUBAP1 Pl => "aba" ; + AgMUBAP2 n => mkClitics "mu" "ba" n; --probably an error check your grammar book + --AgMUBAP2 Pl => "aba" ; + AgP3 n MU_BA => mkClitics "mu" "ba" n; + --AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => mkClitic "bu" ; + AgP3 Sg BU_MA => mkClitic "bu" ; + AgP3 Pl (KA_BU | RU_BU) => mkClitic "bu" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "bi" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "ma"; + AgP3 (Sg | Pl) (HA | MU) => mkClitic "ha" ; -- of place HA & MU + AgP3 (Sg | Pl) KU => mkClitic "n" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>mkClitic "ri" ; + AgP3 Sg (KA_ZERO | KA_BU) =>mkClitic "ka" ; + AgP3 Sg KI_BI => mkClitic "ki" ; + AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "ku" ; + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "mu" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => mkClitic "ru" ; + AgP3 Pl (ZERO_TU | KA_TU) =>mkClitic "tu" ; + AgP3 Sg (ZERO_ZERO | N_N) =>mkClitic "n" ; + AgP3 Pl ZERO_MI =>mkClitic "n" ; + AgP3 Pl MU_MI => mkClitic "mi"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "n" ; + AgP3 Sg GU_GA => mkClitic "gu" ; + AgP3 Pl GU_GA => mkClitic "ga" ; + _ => mkClitic "XX" -- error checking for any case not catered for - -- Adjectival Prefixes without initial vowel - AdjPron => table { - AgMUBAP1 Sg => "mu" ; - AgMUBAP1 Pl => "ba" ; - AgMUBAP2 Sg => "mu" ; - AgMUBAP2 Pl => "ba" ; - AgP3 Sg MU_BA => "mu" ; - AgP3 Pl MU_BA => "ba" ; - AgP3 Pl ZERO_BU => "bu"; - AgP3 Sg BU_MA => "bu" ; + }; + -- Genetive Preposition: simple "of" without Initila vowel + mkGenPrepNoIVClitic : Agreement -> Str = \a -> case a of { + AgMUBAP1 n => mkClitics "wa" "ba" n; + --AgMUBAP1 Pl => "aba" ; + AgMUBAP2 n => mkClitics "wa" "ba" n; --probably an error check your grammar book + --AgMUBAP2 Pl => "aba" ; + AgP3 n MU_BA => mkClitics "wa" "ba" n; + --AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => mkClitic "bwa" ; + AgP3 Sg BU_MA => mkClitic "bwa" ; + AgP3 Pl (KA_BU | RU_BU) => mkClitic "bwa" ; + AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "bya" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "ga"; + AgP3 (Sg | Pl) HA => mkClitic "ha" ; -- of place HA + AgP3 (Sg | Pl) MU => mkClitic "mwa" ; -- of place MU + AgP3 (Sg | Pl) KU => mkClitic "ya" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>mkClitic "rya" ; + AgP3 Sg (KA_ZERO | KA_BU) =>mkClitic "ka" ; + AgP3 Sg KI_BI => mkClitic "kya" ; + AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "kwa" ; + AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "gwa" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => mkClitic "rwa" ; + AgP3 Pl (ZERO_TU | KA_TU) =>mkClitic "twa" ; + AgP3 Sg (ZERO_ZERO | N_N) =>mkClitic "ya" ; + AgP3 Pl ZERO_MI =>mkClitic "ya" ; + AgP3 Pl MU_MI => mkClitic "emi"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "za" ; + AgP3 Sg GU_GA => mkClitic "gwa" ; + AgP3 Pl GU_GA => mkClitic "ga" ; + _ => mkClitic "Error mkGenPrepNoIVClitic" -- error checking for any case not catered for - AgP3 Pl (KA_BU | RU_BU) =>"bu" ; - AgP3 Pl (KI_BI | ZERO_BI) => "bi" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ma" ; + }; - - AgP3 (Sg | Pl) (HA | MU) => "ha" ; -- of place HA & MU - AgP3 (Sg | Pl) KU => "n" ; -- of place KU - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ri" ; - AgP3 Sg (KA_ZERO | KA_BU) =>"ka" ; - AgP3 Sg KI_BI => "ki" ; - AgP3 Sg (KU_ZERO | KU_MA) => "ku" ; - AgP3 Sg (MU_MI | MU_ZERO) => "omu"; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "ru" ; - AgP3 Pl (ZERO_TU | KA_TU) =>"tu" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"n" ; - AgP3 Pl ZERO_MI => "n" ; - AgP3 Pl MU_MI => "emi" ; - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "n" ; - AgP3 Sg GU_GA => "ogu" ; - AgP3 Pl GU_GA => "aga" ; - _ => "XXX" -- for debugging purposes - } ; - --Genetive Preposition: exclusively of (with initial vowel) - GenPrep1 => table { - AgMUBAP1 Sg => "owa" ; - AgMUBAP1 Pl => "aba" ; - AgMUBAP2 Sg => "owa" ; - AgMUBAP2 Pl => "aba" ; - AgP3 Sg MU_BA => "owa" ; - AgP3 Pl MU_BA => "aba" ; - AgP3 Pl ZERO_BU => "obwa" ; - AgP3 Sg BU_MA => "obwa" ; + -- type for Determier necessary for catCgg.gf + Determiner : Type = {s : Str ; ntype : NounState ; num : Number ; pos : Position }; + mkDet : Str -> NounState -> Number -> Position -> Determiner + = \ det, ns, num,pos -> + { + s = det; + ntype = ns; + num = num; + pos = pos; + }; - AgP3 Pl (KA_BU | RU_BU) =>"obwa" ; - AgP3 Pl (KI_BI | ZERO_BI) => "ebya" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "aga" ; + -- Pronouns must have agreement because they are used + -- depending on gender, Number and person + -- all noun classes have pronouns in the third person + --This is a big problem, probably we create our own abstract syntax + {- + TO-DO: DONE but not tested yet. Here I will simply use one + class KI_BI + -} + Pronoun : Type ={s : Case => Str ; agr : Agreement} ; + mkPron : Str -> Str -> Agreement->Pronoun =\nom,acc, a -> + { + s = table {Nom => nom; Acc => acc}; + agr = a; + }; - - AgP3 (Sg | Pl) HA => "aha" ; -- of place HA - AgP3 (Sg | Pl) MU => "omwa" ; -- of place MU - AgP3 (Sg | Pl) KU => "eya" ; -- of place KU - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"erya" ; - AgP3 Sg (KA_ZERO | KA_BU) =>"aka" ; - AgP3 Sg KI_BI => "ekya" ; - AgP3 Sg (KU_ZERO | KU_MA) => "okwa" ; - AgP3 Sg (MU_MI | MU_ZERO) => "ogwa" ; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "orwa" ; - AgP3 Pl (ZERO_TU | KA_TU) =>"otwa" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"eya" ; - AgP3 Pl ZERO_MI => "eya" ; - AgP3 Pl MU_MI => "eya" ; - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "eza" ; - AgP3 Sg GU_GA => "ogwa" ; - AgP3 Pl GU_GA => "aga" ; - _ => "XYY" -- for debugging purposes - }; - --Genetive Preposition: simply of without initial vowel - GenPrep2 => table { - AgMUBAP1 Sg => "wa" ; - AgMUBAP1 Pl => "ba" ; - AgMUBAP2 Sg => "wa" ; - AgMUBAP2 Pl => "ba" ; - AgP3 Sg MU_BA => "wa" ; - AgP3 Pl MU_BA => "ba" ; - AgP3 Pl ZERO_BU => "bwa" ; - AgP3 Sg BU_MA => "bwa" ; + - AgP3 Pl (KA_BU | RU_BU) =>"bwa" ; - AgP3 Pl (KI_BI | ZERO_BI) => "bya" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ga" ; - - - AgP3 (Sg | Pl) HA => "ha" ; -- of place HA - AgP3 (Sg | Pl) MU => "mwa" ; -- of place MU - AgP3 (Sg | Pl) KU => "ya" ; -- of place KU - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"rya" ; - AgP3 Sg (KA_ZERO | KA_BU) =>"ka" ; - AgP3 Sg KI_BI => "kya" ; - AgP3 Sg (KU_ZERO | KU_MA) => "kwa" ; - AgP3 Sg (MU_MI | MU_ZERO) => "gwa" ; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwa"; - AgP3 Pl (ZERO_TU | KA_TU) =>"twa" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"ya" ; - AgP3 Pl ZERO_MI => "ya" ; - AgP3 Pl MU_MI => "ya" ; - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "za" ; - AgP3 Sg GU_GA => "gwa" ; - AgP3 Pl GU_GA => "ga" ; - _ => "XYY" -- for debugging purposes - }; - -- Genetive Adjective suffixes used to form genetive adjectives when conjugated to - -- the genetive prepositions particles - -- examples: ekya-{ngye}= my own or mine, ekya-{itu}= our own or ours, - -- ekya-{we}-your own or yours - GenAdj => table { - AgMUBAP1 Sg => "ngye" ; - AgMUBAP1 Pl => "itu" ; - AgMUBAP2 Sg => "we" ; - AgMUBAP2 Pl => "nyu" ; - AgP3 Sg MU_BA => "e" ; - AgP3 Pl MU_BA => "bo" ; - AgP3 Pl ZERO_BU => "bwo" ; - AgP3 Sg BU_MA => "bwo" ; - - AgP3 Pl (KA_BU | RU_BU) =>"bwo" ; - AgP3 Pl (KI_BI | ZERO_BI) => "byo" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "go" ; - - - AgP3 (Sg | Pl) HA => "ho" ; -- of place HA - AgP3 (Sg | Pl) MU => "mwo" ; -- of place MU - AgP3 (Sg | Pl) KU => "yo" ; -- of place KU - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ryo" ; - AgP3 Sg (KA_ZERO | KA_BU) =>"ko" ; - AgP3 Sg KI_BI => "kyo" ; - AgP3 Sg (KU_ZERO | KU_MA) => "kwo" ; - AgP3 Sg (MU_MI | MU_ZERO) => "gwo" ; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwo" ; - AgP3 Pl (ZERO_TU | KA_TU) =>"two" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"two" ; - AgP3 Pl ZERO_MI => "yo" ; - AgP3 Pl MU_MI => "yo" ; - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "zo" ; - AgP3 Sg GU_GA => "gwo" ; - AgP3 Pl GU_GA => "go" ; - _ => "XXYY" -- for debugging purposes - } ; - SStandPron => table { - AgMUBAP1 Sg =>"nyowe" ; - AgMUBAP1 Pl =>"itwe" ; - AgMUBAP2 Sg =>"iwe" ; - AgMUBAP2 Pl =>"imwe" ; - AgP3 Sg MU_BA => "uwe" ; - AgP3 Pl MU_BA => "bo" ; - AgP3 Pl ZERO_BU => "bwo" ; - AgP3 Sg BU_MA => "bwo" ; - - AgP3 Pl (KA_BU | RU_BU) =>"bwo" ; - AgP3 Pl (KI_BI | ZERO_BI) => "byo" ; - AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "go" ; - - - AgP3 (Sg | Pl) HA => "ho" ; -- of place HA - AgP3 (Sg | Pl) MU => "mwo" ; -- of place MU - AgP3 (Sg | Pl) KU => "yo" ; -- of place KU - AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ryo" ; - AgP3 Sg (KA_ZERO | KA_BU) =>"ko" ; - AgP3 Sg KI_BI => "kyo"; - AgP3 Sg (KU_ZERO | KU_MA) => "kwo" ; - AgP3 Sg (MU_MI | MU_ZERO) => "gwo"; - AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwo" ; - AgP3 Pl (ZERO_TU | KA_TU) =>"two" ; - AgP3 Sg (ZERO_ZERO | N_N) =>"two" ; - AgP3 Pl ZERO_MI => "yo" ; - AgP3 Pl MU_MI => "yo" ; - AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "zo" ; - AgP3 Sg GU_GA => "gwo" ; - AgP3 Pl GU_GA => "go" ; - _ => "XXYY" -- for debugging purposes - } - } ; - - {- + PolTemp = {s : Agreement => Str * Str ; end : Str} ; -- a tupple of two strings + + -- Structural + Preposition = {s,other : Str}; -- prepositions sometimes have two kinds + mkPrep : Str -> Str -> Preposition = \ first, other -> { + s = first ; + other = other + }; + NounPhrase : Type = {s :Case => Str; agr : Agreement}; + {- Operation to create Noun Phrases from a Determiner and Nouns. In Runyankore and Rukiga, depending on the particular Determiner, it can appear before (we call PreDeterminer) or after (PostDeterminer) the noun. Examples: - A. PreDeterminers + A. Determiners before the Noun: This is wrong. there is a class of Predeterminers 1. Definite aricles: Usually using the initial vowel sufficient 2. Demonstratives: ogu muntu (This person) 3. Every: every man = "buri muntu" - B. PostDeterminers - 1. Definite aricles: Usually using the initial vowel sufficient + B. Determiners fater the noun + 1. Definite aricles: Usually using the initial vowel is sufficient 2. Demonstratives: omuntu ogu (person this) 3. few: omuntu mu-kye + Note: Problem stil exists because we cannot know when the determiner string is empty + There is a mistake here. If the determiner is empty, we end up with a + meaningless subject particle standing alone. we can test if det.s is a + string or empty. -} - NounPhrase = { s : Str ; agr : Agr } ; - {-This function should be renamed to mkDetCN-} - mkDeterminer: Determiner -> Noun -> NounPhrase = \ det, cn -> - case det.pos of { - PreDeterminer => { s = det.s ++ cn.s ! det.ntype ! det.num; agr = AgP3 det.num cn.nc} ; - PostDeterminer => { s = cn.s!det.ntype!det.num ++ mkNCParticles!SubjM!AgP3 det.num cn.nc ++ det.s; agr = AgP3 det.num cn.nc} -- There is a mistake here. If the determiner is empty, we end up with a meaningless subject particle standing alone. we can test if det.s is a string or empty. - - - }; - - {- - Operation to create scenarios in which the PRIMARY NEGATIVE MARKER - for the verb is used. The presence of this marker negates the semantics of the verb. - It is used in the PAST, Simultaneous and all other tenses. - NOTE: The Primary and Secondary markers are in complementary distribution - - TO DO: Improve this!!! - -} - mkPol1Marker : Polarity => Tense => Anteriority => Str = table { - Neg => table { - Past => table { - Anter => "" ; - Simul => "ti" - } ; - _ => table { - _ => "ti" - } - } ; - Pos => \\_ => \\_ => "" - }; - - - {- - Operation to create scenarios in which the SECONDARY NEGATIVE MARKER - for the verb is used. The presence of this marker negates the semantics of the verb. - It is used in the PAST, Anterior only. - NOTE: The Primary and Secondary markers are in complementary distribution - -} - mkPol2Marker : Polarity => Tense => Anteriority => Str = table{ - Neg => table { - Past => table { - Anter => "ta"; - Simul => "" - }; - _ => table{ - _ => "" - } - }; - Pos => \\_=>\\_=> "" - } ; - - - {- - TO DO: stop here - -} - mkTenseMarker1 : Tense => Anteriority => Str = table{ - Past => table{ - Anter =>"baire"; - Simul =>"" - }; - Pres => table{ - _ =>"" - }; - Fut => table{ - Anter => "ijakubá";-- | "zakubá"; - Simul =>"ijaku"-- | "kuzaku" | "raa" - }; - Cond => table{ - _ => "kaa" - } - }; - - mkTenseMarker2:Tense=>Anteriority=>Str = table{ - Past => table{ - Anter =>"ire"; - Simul =>"ire" - }; - Pres => table{ - Anter =>"ire"; - Simul =>"" - }; - Fut => table{ - Anter => "ire"; - Simul =>"" - }; - Cond => table{ - Anter => "ire"; - Simul =>"" - } - }; - - mkAuxTenseMarker: Tense =>Anteriority=>Str =table { - Past => table { - Anter =>"kaba" ; - Simul =>"baire" - }; - Pres => table { - Anter =>"baire" ; - Simul =>[] - }; - Fut => table { - Anter => "ryaba" ; - Simul =>"ryaba" - }; - Cond => table { - Anter => "XX" ; - Simul =>"XX" - } - }; - - - Verb : Type ; - Verb = { s : Agr => Polarity => Tense => Anteriority => Str } ; - - AdjectivalPhrase : Type = { s : Agr => Str } ; - mkAdjective: Str-> Bool -> { s : Agr=> Str } = \ a , b -> case b of { - True => { s = \\ agr => a } ; - False => { s = \\ agr => let agrM = mkNCParticles ! AdjPron ! agr in - agrM + a --this is supposed to be a concatenation - } - }; - - - Verb2 : Type = Verb **{ c : Str } ; - mkV2 : Str -> Verb2 = \s -> (mkVerb s) ** { c = [] } ; - Adjective : Type = { s : Agr => Str } ; - mkComp : AdjectivalPhrase -> VerbPhrase ; --comp means compula - mkComp comp = { - s = \\ agr , pol , tense, anter => - let aux = mkAuxTenseMarker ! tense ! anter; - p2 = mkPol2Marker ! pol ! tense ! anter; - s = mkNCParticles ! SubjM ! agr - in aux ++ p2 + s ++ "ri" ++ comp.s!agr --why does the plus fail? - }; - - - mkVerb : Str -> Verb ; -- write an operation for the object marker - mkVerb run = { s = \\ subjM , pol , tense , anter => - let p1 = mkPol1Marker ! pol! tense ! anter ; - p2 = mkPol2Marker ! pol! tense ! anter ; - t1 = mkTenseMarker1 ! tense ! anter ; - t2 = mkTenseMarker2 ! tense ! anter ; - s = mkNCParticles ! SubjM !subjM - in - case < tense , anter > of { - => p1 + s + t1 ++ s + p2 + run + t2; - => p1 + s + t1 ++ p2 + run + t2; - _ => (p1 + s + p2 + t1 + run + t2) - } - }; - - -{- - - Note: The following is copied from the file swahili/ResSwa.gf -} - ---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 { - ---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" - } ; - - - - - + mkDetCN : Determiner -> Noun -> NounPhrase = \ det, cn -> + case of { + => {s = \\_=> + let + subjClitic = mkSubjClitic (AgP3 det.num cn.gender) + in cn.s!det.ntype!det.num ++ subjClitic ++ det.s; agr = AgP3 det.num cn.gender}; + => { s =\\_ => det.s ++ cn.s ! det.ntype ! det.num; agr = AgP3 det.num cn.gender} --; + -- => {s = \\_=> cn.s!det.ntype!det.num; agr = AgP3 det.num cn.gender } + }; --- Auxiliary verbs have special negative forms. -param - VVForm = - VVF VForm - | VVPresNeg - | VVPastNeg --# notpresent - ; - ---Adjectives + + + --Verb + param + VFormMini = VFInf | VFPres | VFPast | VFPastAnt | VFPresAnt | VFPresProg | VFPresPart |VFPastPart; + oper + --Verb : Type = {s : VFormMini => Str}; + Verb : Type = {s : Str; morphs: VFormMini => VerbMorphPos=> Str}; + + GVerb : Type = {s : Bool =>Str ; morphs: VFormMini => VerbMorphPos =>Str; isAux : Bool}; + {- + The V2 sometimes uses preopsitions for formation + of direct object. Unlike in English where the verb + and the preposition are disjunctive such as "send to", + In runyakore and rukiga, the verb and preposition are + conjunctive such as sindik-ira. - oper Adj = {s : AForm => Str} ; + Because of the fusion, I have deffered including this in + the compPrep. Actually, it is going to be empty in the next version + -} + Verb2 : Type = Verb ** {comp:Str}; + {- + Given a root, can you form the different verbforms? + -} + param + VerbMorphPos = PreVerb | PriNegM | --ObjRel | SubjMarker | + SecNegM | TAMarker | PersistiveMarker| --DObjM | IDobjM | + RestOfVerb; + oper + VMorphs : Type = VFormMini => VerbMorphPos => Str; + VerbPhrase: Type = {s:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist}; + -- in VP formation, all verbs are lifted to GVerb, but morphology doesn't need to know this + verb2gverb : Verb ->Str -> GVerb = \v, ba -> { + s = table{ + True => v.s; + False => ba --the special verb to be + }; + morphs = v.morphs; + isAux = False + }; + {- + In Runynakore & Rukiga the verb to be in english has two + Infinitives i.e. + a) ri --used when it is the only main and therefore licenses a subject + b) ba --used usually as commands, such as Imperatives or when another + verb is acting as the main verb. It also acts as the infitive form + -} + be_GVerb : GVerb = { + s= table{True => "ri"; False =>"b" }; + morphs = \\form, morphs =>[]; + isAux = True}; ---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 + {- + --copulative conjugations of ni and ri as used for adjectives + + copRiNi :Verb ={ + s= table { + True => table{ + VPres (Agr (NC_mu_ba) Sg Per1) => "ndi" ; + VPres (Agr (NC_mu_ba) Pl Per1) => "turi"; + VPres (Agr (NC_mu_ba) Sg Per2) => "ori" ; + VPres (Agr (NC_mu_ba) Pl Per2) => "muri"; + VPres (Agr (NC_mu_ba) Sg Per3) => "ari" ; + VPres (Agr (NC_mu_ba) Pl Per3) => "bari"; + VPres (Agr (_) _ _)=> "" + }; + -} + {- + This function packages the different morphemes of the each tense of verb + that are commonly used and have not more than two possibilities i.e. + 1. infintive marker at begining of verb + 2. ni - continuous marker at begining of the present participle / present continuous + 3. ti - Primary Negative marker + 4. ta - Secondary Negative Marker + 5. Tense and aspect markers + 6. Persistive Marker + 7. Rest of Verb. + These can be increased further. Note: Only those tenses clossest to the english equivalent + have been chosen. The full resource shall require even more. + -} + mkVerbMorphs: VMorphs = table{ + VFInf => table{ + PreVerb => "ku"; + PriNegM => []; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => "ta"; + TAMarker => []; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"a" + }; + VFPres => table{ + PreVerb => []; + PriNegM => "ti"; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => "ta"; + TAMarker => []; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"a" + }; + VFPresAnt => table{ + PreVerb => []; + PriNegM => "ti"; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => []; + TAMarker => []; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"ire" + }; + VFPresPart => table{ + PreVerb => []; + PriNegM => "ti"; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => []; + TAMarker => "riku"; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"a" + }; + VFPastPart => table{ + PreVerb => []; + PriNegM => []; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => "ta"; + TAMarker => "ku"; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"a" + }; - param Spatial = SpHrObj | SpHr | HrObj ; --w.r.t object + --mkVerbPast:Str -> Str =\root -> Predef.BIND ++"ti" ++ Predef.BIND ++ "PriNegM" ++ Predef.BIND ++ "TM1" ++ Predef.BIND ++ "Empy" ++ Predef.BIND ++ "TM2" ++ Predef.BIND ++ "Empty" ++ Predef.BIND ++ "stem" ++ Predef.BIND ++ root ++ Predef.BIND ++ "ire"; + VFPast => table{ + PreVerb => []; + PriNegM => "ti"; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => []; + TAMarker => []; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"ire" + }; + --"ni" ++ Predef.BIND ++ "ContM" ++ Predef.BIND ++ "ti" ++ Predef.BIND ++ "PriNegM" ++ Predef.BIND ++ "TM1" ++ Predef.BIND ++ "Empy" ++ Predef.BIND ++ "TM2" ++ Predef.BIND ++ "Empty" ++ Predef.BIND ++ "stem" ++ Predef.BIND ++ root ++ Predef.BIND ++"a"; + VFPresProg => table{ + PreVerb => "ni"; + PriNegM => []; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => "ta"; + TAMarker => []; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"a" + }; + VFPastAnt => table{ --always requires auxiliary with + PreVerb => []; + PriNegM => []; + --ObjRel => []; + --SubjMarker =[]; + SecNegM => "ta"; + TAMarker => "aa"; + PersistiveMarker => []; + --DObjM => []; + --IDobjM => []; + RestOfVerb =>"ire" + } --- 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} ; + --oper + --Concatenates two strings at runtime without spaces --- For $Sentence$. + glue: Str -> Str ->Str =\ x, y -> x ++ BIND ++ y; + + --Number determining element + Numer : Type = { s: Str ; n : Number}; - Clause : Type = { + --VPSlash : Type = VerbPhrase ** { c : Str }; + VPSlash : Type = {s:Str; morphs: VMorphs; comp: Str}; + + + Clause : Type = { s : Tense => Anteriority => Polarity => Str } ; + Comp : Type = {s:Str}; - mkClause : Str -> Agr -> VP -> Clause = - \subj,agr,vp -> { - s = \\t,a,b => - let - verb = vp.s ! t ! a ! b ! agr - in - subj ++ verb - } ; --} - -} + --Conjunctions + Conjunction : Type = {s : AgrConj =>Str ;s2 : Str ; n : Number} ; +} \ No newline at end of file diff --git a/src/rukiga/ResCggOld.gf b/src/rukiga/ResCggOld.gf new file mode 100644 index 000000000..ac1cae477 --- /dev/null +++ b/src/rukiga/ResCggOld.gf @@ -0,0 +1,910 @@ +--# -path=.:../prelude:../abstract:../common + +-- structure of module types i.e header which defines the type of module and +-- tells what other modules it inherits also known as extension(means that a module can inherit the contents +-- of one or more modules to which new judgements are added. You can optionally inherit parts of it using +-- [comma separeted functions]) followed by ** and optionally an open statement(if the module type is concrete +-- or resource i.e open [namespace identifiers]) and then followed by a mandatory body {} +-- opening a resource means you can use its contents without inheriting them (how I do not know) +-- module types include: +-- 1.abstract modules +-- 2.concrete modules +-- 3.resource modules: these define parameter types and operations usable in several concrete syntaxes as general functions in lincat definitions +-- general structure: [of ] = [] [**][open in]{body} +resource ResCgg = ParamX ** -- + open Prelude, (Predef=Predef) in { + +param + NounType = Complete | Incomplete ; + Position = PostDeterminer | PreDeterminer ; + Case = Nom | Acc | Gen ; + Agr = AgP3 Number NClass | AgMUBAP1 Number |AgMUBAP2 Number ; + + NClass = MU_BA | -- for human beings and deity e.g. omuntu/abantu + KI_BI | -- eki-tookye/ebi-tookye + N_N | -- nouns that do not vary their spelling with singular and plural (normally begin with "e") + KU_MA | -- okuguru / amaguru, (leave out the non plurals)okugyenda (Deverbative) / Amagyenda (Deverbative outward journey) + BU_MA | + RU_BU | -- oruro / oburo + GU_GA | -- ogushaija / agashaija --dimunitive + ZERO_ZERO | -- nouns without initial vowel nor class syllables e.g barugu, muha, sho + MU_MI | -- + RI_MA | + I_MA | + KA_BU | + KA_TU | --dimunitive version of KA_BU belong to same noun class + RU_N | -- orurimi / endimi + RU_MA | + --those of place or location + HA | + MU | + KU | + --aditions + ZERO_BU | + ZERO_BI | + ZERO_MA | -- amate takes the concords of plural particle "ma" + ZERO_MI | + ZERO_TU | + ZERO_N | + I_ZERO | + RI_ZERO | + KU_ZERO | + MU_ZERO | + RU_ZERO | + ZERO_BAA | -- human relationships + KA_ZERO ; --akabi (ZERO to the right means the concords of that noun are always those of the singular as used in noun-classes KA) see KA_BU, KA_TU + + + PersonalPronounType = SubjM | Obj | RelSubj | RelObj | + AdjPron2 | -- aAdjectival Prefixes with initial vowel with the semantics of "the" e.g. -- omuntu o-mu-rungi + AdjPron | -- without initial vowel i.e. -- omuntu mu-rungi + --GenPron | -- different types of pronouns + GenPrep1 | + GenPrep2 | + GenAdj | + SStandPron ; --Self-standing pronouns +oper + + Noun : Type ; + Noun = {s : NounType=>Number => Str ; nc : NClass } ; + + smartNoun : Str -> NClass -> Noun + = \omuntu, g -> + case of { + -- Handling the Tone System is also another problem. + + < "o" + "mu" + stem, MU_BA > => mkNoun omuntu ("aba" + stem) g ; + --special cases like omwana, omwishiki, omwojo + + < "o" + "mw" + stem, MU_BA > => mkNoun omuntu (combine_morphemes "aba" stem) g ; --same as mu_ba but the "u" + "a" of the stem to form mwa + < "o" + "mu" + stem, MU_MI > => mkNoun omuntu (combine_morphemes "emi" stem) g ; + < "o" + "ru" + stem, RU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "o" + "ru" + stem, RU_N > => mkNoun omuntu (combine_morphemes "en" stem) g ; --desist from providing a singlar only but give both + < "o" + "bu" + stem, BU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "o" + "gu" + stem, GU_GA > => mkNoun omuntu (combine_morphemes "aga" stem) g ; + < "o" + ("ku" | "kw") + stem, KU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "o" + "kw" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; + < "o" + "ku" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "o" + "ru" + stem, RU_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ; + < "o" + "ru" + stem, RU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + + < "a" + "ha" + stem, HA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "a" + "ka" + stem, KA_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ; + < "a" + "ka" + stem, KA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + + < "e" + "ki" + stem, KI_BI > => mkNoun omuntu (combine_morphemes "ebi" stem) g ; + < "e" + "ki" + stem, KI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "e" + "i" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" "") g ; + < "e" + "i" + stem, I_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "e" + "ri" + stem, RI_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + < "e" + "ri" + stem, RI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural + < "e" + "ry" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ; + -- --special cases shall be added with due course as errors are identified + <"e" + "ky" + stem, KI_BI> => mkNoun omuntu (combine_morphemes "ebi" stem) g ; + < _ ,N_N | ZERO_MA > => mkNoun omuntu omuntu g ; + --< _ ,ZERO_MA > => mkNoun omuntu ("ama" + stem) g (Predef.drop 1 omuntu); + --< _ ,> => mkNoun omuntu omuntu g (Predef.drop 1 omuntu); + <_ , ZERO_BAA> => mkNoun omuntu ("baa" + omuntu) g; + < _ ,ZERO_ZERO > => mkNoun omuntu omuntu g; + < _ ,_ > => mkNoun omuntu omuntu g -- improve as we go on. + }; + + {- Should be taken to Ajective concrete Syntanx-} + mkNoun : Str -> Str -> NClass -> Noun ; + mkNoun child children nc + = { s = table {Complete => table { + Sg => child ; Pl => children } ; + Incomplete => table { + Sg => Predef.drop 1 child ; Pl => Predef.drop 1 children } }; --removal of the initial vowel + nc = nc + } ; + mkN = overload { + mkN : Str -> NClass -> Noun = smartNoun ; + mkN : Str -> Str -> NClass -> Noun = mkNoun; + } ; + + + + + -- combine_morphemes need the function last to get + -- the last letter in a morphme. + -- uses Predef.length and Predef.take + -- Please use let so that you compute Predef.length once and use if then else + -- if possible + {- + last : Str -> Str ; + last = \ w -> + case (Predef.length w) of { + 0 => []; + _ => Predef.drop ((Predef.length w)-1) w + } ; + + -} + {- + This function tries to handle phonological-conditioning. + + Usage: Use it whenever you are trying to combine morphemes especially in: + 1. Pronouns + 2. Verbs and verb Phrases. + 3. Noun Phrases + 3. Adjectival Phrases e.t.c + + Given two morphemes A and B to combine, + 1. compare the last letter of the first morpheme A with the first letter of the second morpheme B + 2. Use parttern matching to obtain the right letters for the comnined word + + Source of rules: + 1. personal experience + 2. Morris and Kirwan Runynakore Grammar + 3. but we shall add more as we meet them during debugging + -} + combine_morphemes : Str -> Str -> Str ; + combine_morphemes = \ f, s -> + case <(Predef.dp 1 f), (Predef.take 1 s)> of { + <"n" , "r"> => f + "d" + (Predef.drop 1 s) ; + <"u" , "a" | "e" | "o" | "i"> => Predef.tk 1 f + "w" + s ; + <"i" , "a" | "e" | "o"> => Predef.tk 1 f + "y" + s ; + <"n" , "b" | "p"> => Predef.tk 1 f + "m" + s ; + <"n" , "m"> => Predef.tk 1 f + s ; -- However, note that for pronouns, the n changes to m + <"n" , "h"> => Predef.tk 1 f + "mp" + Predef.drop 1 s ; + <"i", "i"> => f + Predef.drop 1 s ; + <_ , _ > => f + s + } ; + Determiner : Type = {s : Str ; ntype : NounType ; num : Number ; pos : Position } ; -- type for Determier necessary for catCgg.gf + + Pronoun : Type ={s : Str ; agr : Agr} ; + + VerbPhrase : Type = { s : Agr => Polarity => Tense => Anteriority => Str}; + + VPSlash : Type = VerbPhrase ** { c : Str } ; + + Numer : Type = { s: Str ; n : Number}; + + Clause : Type = {s : Polarity => Tense => Anteriority => Str}; + + Adv : Type = {s : Agr => Str } ; -- check pages 116-131 of grammar book + mkAdv : Str -> Adv = \ s -> { s= \\ agr => s }; + + ParticleForms : Type = PersonalPronounType => Agr => Str; + mkNCParticles : ParticleForms = table { + SubjM => table { + AgMUBAP1 Sg => "n" ; + AgMUBAP1 Pl => "tu" ; + AgMUBAP2 Sg => "wa" ; + AgMUBAP2 Pl => "mu" ; + AgP3 Sg MU_BA => "a" ; + AgP3 Pl MU_BA => "ba" ; + AgP3 Sg KI_BI => "ki" ; + AgP3 Pl (KI_BI | ZERO_BI) => "bi" ; + AgP3 Sg (RU_N | RU_MA | RU_ZERO | RU_BU) => "ru" ; + AgP3 Pl RU_N => "zi"; --| "i"; + AgP3 Sg N_N => "e"; + AgP3 Pl N_N => "zi"; --| "i"; + AgP3 Sg (MU_MI | MU_ZERO) => "gu" ; + AgP3 Pl MU_MI => "e" ; + AgP3 Sg (RI_MA | RI_ZERO | I_ZERO) => "ri"; + AgP3 Pl (RI_MA | BU_MA | KU_MA | ZERO_MA | I_MA |RU_MA) => "ga" ; + AgP3 Sg (KA_BU | KA_ZERO | KA_TU) => "ka" ; + AgP3 Pl (KA_BU | RU_BU) => "bu" ; + AgP3 Sg ZERO_BU => "bu" ; + AgP3 Pl ZERO_BU => "bu" ; + AgP3 Sg ZERO_BI => "bi" ; + AgP3 Sg ZERO_MA => "ga" ; + AgP3 Pl RI_ZERO => "ga" ; + AgP3 Sg KU_ZERO => "ku" ; + AgP3 Pl KU_ZERO => "ku" ; + AgP3 Pl MU_ZERO => "gu" ; + AgP3 Pl RU_ZERO => "ru" ; + AgP3 Sg ZERO_TU => "tu" ; + AgP3 Pl ZERO_TU => "tu" ; + AgP3 Sg (ZERO_MI | ZERO_ZERO) => "" ; + AgP3 Pl ZERO_MI => "e" ; + AgP3 Pl KA_ZERO => "" ; + _ => "XX" --for checking if there is some class unaccounted for + }; + {-Object particle may be used as + 1. a prefix: e.g mu-kwate = catch him, + 2. an infix: o-mu-kwate = you catch him + + -} + Obj => table { + AgMUBAP1 Sg => "n" ; + AgMUBAP1 Pl => "tu" ; + AgMUBAP2 Sg => "ku" ; + AgMUBAP2 Pl => "ba" ; + AgP3 Sg MU_BA => "mu" ; + AgP3 Pl MU_BA => "ba"; + AgP3 Pl (ZERO_BU | KA_BU | KA_TU | RU_BU) => "bu" ; + AgP3 Sg BU_MA => "bu" ; + AgP3 Sg KI_BI => "ki" ; + AgP3 Pl (KI_BI | ZERO_BI) => "bi"; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ga" ; + AgP3 (Sg | Pl) HA => "ha"; + AgP3 Sg (I_ZERO | I_MA | RI_MA) => "ri" ; + AgP3 Sg (KA_ZERO | KA_BU | KA_TU) => "ka" ; + AgP3 Sg (KU_ZERO | KU_MA) => "ku" ; + {- + #comment for the following two lines + the follwing partciles are all used by Noun Classes of Place i.e. HA, KU and MU + We take the particle to be "ha" for all of them although noun class KU can use + another particle "gi" -- see Table of Concords in Appendix of Dictionary by Mpairwe and Kahangi + + Note: The particles do not change with respect to gender + + TODO: obtain clear examples of usage + -} + AgP3 (Sg | Pl) (HA | MU) => "ha" ; + AgP3 (Sg | Pl) KU => "ha" ; -- gi is also possible -- see comment above + + AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => "ru" ; + AgP3 Pl (KA_TU | ZERO_TU) => "tu" ; + + AgP3 Sg (N_N | ZERO_ZERO) => "gi" ; + + AgP3 Sg (MU_MI | MU_ZERO) => "gu" ; + AgP3 Pl GU_GA => "ga" ; + AgP3 Pl (MU_MI | ZERO_MI) => "gi" ; + {- + According to Mpaiwe & Kahangi in their table of concords, the particle for the plural + of noun classes N_N , ZERO_ZERO , ZERO_N & RU_N can be either "i" or "zi" depending + on object they refer to. + + Problem: + However, we cannot use the | operator in strings as GF will + fail to compile to comletion. + Implication: + Some of our output strings will have the wrong object particle attached. + Even if the operator | worked, we would generate two versions of the linearized + string of which one would be right and the other wrong + What is the solution to this? + -} + AgP3 Pl (N_N | ZERO_ZERO | ZERO_N | RU_N) => "zi" ; --some cases require use of particle "i" + + _ => "-" -- Hopefully exhausted all forms + }; + -- who, which + RelSubj => table { + AgMUBAP1 Sg => "o" ; + AgMUBAP1 Pl => "aba" ; + AgMUBAP2 Sg => "o" ; + AgMUBAP2 Pl => "aba" ; + AgP3 Sg MU_BA => "o" ; + AgP3 Pl MU_BA => "aba" ; + AgP3 Sg BU_MA => "obu" ; + AgP3 Pl (ZERO_BU | KA_BU | RU_BU) =>"obu" ; + AgP3 Sg KI_BI => "eki" ; + AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "aga" ; + AgP3 (Sg | Pl) (HA | MU) => "ha" ; -- better AgP3 _ (HA | MU) => "ha"; + AgP3 (Sg | Pl) KU => "e" ; + AgP3 Sg (I_ZERO | I_MA | RI_ZERO | RI_MA) => "eri" ; + AgP3 Sg (KA_ZERO | KA_BU) => "aka" ; + AgP3 Sg (KU_ZERO | KU_MA) => "oku" ; + AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => "oru" ; + AgP3 Pl (ZERO_TU | KA_TU) => "otu" ; + AgP3 Pl RU_N => "ezi" ; + AgP3 Sg N_N => "ei" ; + AgP3 Pl (ZERO_ZERO | ZERO_N | RU_N | N_N) => "ezi" ; + AgP3 Sg (MU_MI | MU_ZERO | GU_GA) => "ogu" ; + AgP3 Sg (ZERO_ZERO | N_N ) => "e" ; + AgP3 Pl (MU_MI | ZERO_MI) => "e" ; + AgP3 Pl GU_GA => "aga" ; + _ => "=" -- means something forgoten i.e. debugging purposes + }; + + --Relative Object paticle such as whom/which found in row 13 of Table of concords in Mpairwe & Kahangi + RelObj => table { + AgMUBAP1 Sg => "ou" ; + AgMUBAP1 Pl => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator + AgMUBAP2 Sg => "ou" ; + AgMUBAP2 Pl => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator + AgP3 Sg MU_BA => "ou" ; + AgP3 Pl MU_BA => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator + AgP3 Sg BU_MA => "obu" ; + AgP3 Pl (ZERO_BU | KA_BU |RU_BU) => "obu" ; + AgP3 Sg KI_BI => "eki" ; + AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ; + + {- + The noun classes ZERO_MA,KU_MA,RI_MA,I_MA & BU_MA can use of Relative object particles + "agi" or "agu" (depending on noun class of clause -sure? (depending on what?)) but we + choose one "agi" because of compiler issues with | operator + + Qn: Any Solutions + -} + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "agi" ; + + -- of place HA & MU + --both ahi and "ahu" are valid particles for noun classes HA and MU but "ahu" omitted + --because of compiler issues with | operator + AgP3 (Sg | Pl) (HA | MU) => "ahi" ; -- better AgP3 _ (HA | MU) => "ha"; + + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"eri" ; + -- of place KU + AgP3 (Sg | Pl) KU => "ei" ; + + --both aki and "aku" are valid particles for noun classes KA_ZERO & KA_BU but "aku" omitted + --because of compiler issues with | operator + AgP3 Sg (KA_ZERO | KA_BU) =>"aki" ; + + AgP3 Sg (KU_ZERO | KU_MA) => "oku" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "oru" ; + AgP3 Pl (ZERO_TU | KA_TU) =>"otu" ; + + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "ezi" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"ei" ; + AgP3 Sg (MU_MI | MU_ZERO | GU_GA) => "ogu" ; + AgP3 Pl (MU_MI | ZERO_MI) => "ei" ; + + --both agi and "agu" are valid particles for noun classes GU_GA in plural but "agu" omitted + --because of compiler issues with | operator + AgP3 Pl GU_GA => "agi" ; + _ => "=" -- means something forgoten i.e. debugging purposes + }; + + -- Adjectival Prefixes with initial vowel with the semantics of the + AdjPron2 => table { + AgMUBAP1 Sg => "omu" ; + AgMUBAP1 Pl => "aba" ; + AgMUBAP2 Sg => "omu" ; + AgMUBAP2 Pl => "aba" ; + AgP3 Sg MU_BA => "omu" ; + AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => "obu" ; + AgP3 Sg BU_MA => "obu" ; + AgP3 Pl (KA_BU | RU_BU) =>"obu" ; + AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ama"; + AgP3 (Sg | Pl) (HA | MU) => "aha" ; -- of place HA & MU + AgP3 (Sg | Pl) KU => "en" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"eri" ; + AgP3 Sg (KA_ZERO | KA_BU) =>"aka" ; + AgP3 Sg KI_BI => "eki" ; + AgP3 Sg (KU_ZERO | KU_MA) => "oku" ; + AgP3 Sg (MU_MI | MU_ZERO) => "omu" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "oru" ; + AgP3 Pl (ZERO_TU | KA_TU) =>"otu" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"en" ; + AgP3 Pl ZERO_MI => "en" ; + AgP3 Pl MU_MI => "emi"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "en" ; + AgP3 Sg GU_GA => "ogu" ; + AgP3 Pl GU_GA => "aga" ; + _ => "XXX" -- error checking for any case not catered for + }; + + -- Adjectival Prefixes without initial vowel + AdjPron => table { + AgMUBAP1 Sg => "mu" ; + AgMUBAP1 Pl => "ba" ; + AgMUBAP2 Sg => "mu" ; + AgMUBAP2 Pl => "ba" ; + AgP3 Sg MU_BA => "mu" ; + AgP3 Pl MU_BA => "ba" ; + AgP3 Pl ZERO_BU => "bu"; + AgP3 Sg BU_MA => "bu" ; + + AgP3 Pl (KA_BU | RU_BU) =>"bu" ; + AgP3 Pl (KI_BI | ZERO_BI) => "bi" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ma" ; + + + AgP3 (Sg | Pl) (HA | MU) => "ha" ; -- of place HA & MU + AgP3 (Sg | Pl) KU => "n" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ri" ; + AgP3 Sg (KA_ZERO | KA_BU) =>"ka" ; + AgP3 Sg KI_BI => "ki" ; + AgP3 Sg (KU_ZERO | KU_MA) => "ku" ; + AgP3 Sg (MU_MI | MU_ZERO) => "omu"; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "ru" ; + AgP3 Pl (ZERO_TU | KA_TU) =>"tu" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"n" ; + AgP3 Pl ZERO_MI => "n" ; + AgP3 Pl MU_MI => "emi" ; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "n" ; + AgP3 Sg GU_GA => "ogu" ; + AgP3 Pl GU_GA => "aga" ; + _ => "XXX" -- for debugging purposes + } ; + --Genetive Preposition: exclusively of (with initial vowel) + GenPrep1 => table { + AgMUBAP1 Sg => "owa" ; + AgMUBAP1 Pl => "aba" ; + AgMUBAP2 Sg => "owa" ; + AgMUBAP2 Pl => "aba" ; + AgP3 Sg MU_BA => "owa" ; + AgP3 Pl MU_BA => "aba" ; + AgP3 Pl ZERO_BU => "obwa" ; + AgP3 Sg BU_MA => "obwa" ; + + AgP3 Pl (KA_BU | RU_BU) =>"obwa" ; + AgP3 Pl (KI_BI | ZERO_BI) => "ebya" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "aga" ; + + + AgP3 (Sg | Pl) HA => "aha" ; -- of place HA + AgP3 (Sg | Pl) MU => "omwa" ; -- of place MU + AgP3 (Sg | Pl) KU => "eya" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"erya" ; + AgP3 Sg (KA_ZERO | KA_BU) =>"aka" ; + AgP3 Sg KI_BI => "ekya" ; + AgP3 Sg (KU_ZERO | KU_MA) => "okwa" ; + AgP3 Sg (MU_MI | MU_ZERO) => "ogwa" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "orwa" ; + AgP3 Pl (ZERO_TU | KA_TU) =>"otwa" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"eya" ; + AgP3 Pl ZERO_MI => "eya" ; + AgP3 Pl MU_MI => "eya" ; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "eza" ; + AgP3 Sg GU_GA => "ogwa" ; + AgP3 Pl GU_GA => "aga" ; + _ => "XYY" -- for debugging purposes + }; + --Genetive Preposition: simply of without initial vowel + GenPrep2 => table { + AgMUBAP1 Sg => "wa" ; + AgMUBAP1 Pl => "ba" ; + AgMUBAP2 Sg => "wa" ; + AgMUBAP2 Pl => "ba" ; + AgP3 Sg MU_BA => "wa" ; + AgP3 Pl MU_BA => "ba" ; + AgP3 Pl ZERO_BU => "bwa" ; + AgP3 Sg BU_MA => "bwa" ; + + AgP3 Pl (KA_BU | RU_BU) =>"bwa" ; + AgP3 Pl (KI_BI | ZERO_BI) => "bya" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ga" ; + + + AgP3 (Sg | Pl) HA => "ha" ; -- of place HA + AgP3 (Sg | Pl) MU => "mwa" ; -- of place MU + AgP3 (Sg | Pl) KU => "ya" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"rya" ; + AgP3 Sg (KA_ZERO | KA_BU) =>"ka" ; + AgP3 Sg KI_BI => "kya" ; + AgP3 Sg (KU_ZERO | KU_MA) => "kwa" ; + AgP3 Sg (MU_MI | MU_ZERO) => "gwa" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwa"; + AgP3 Pl (ZERO_TU | KA_TU) =>"twa" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"ya" ; + AgP3 Pl ZERO_MI => "ya" ; + AgP3 Pl MU_MI => "ya" ; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "za" ; + AgP3 Sg GU_GA => "gwa" ; + AgP3 Pl GU_GA => "ga" ; + _ => "XYY" -- for debugging purposes + }; + -- Genetive Adjective suffixes used to form genetive adjectives when conjugated to + -- the genetive prepositions particles + -- examples: ekya-{ngye}= my own or mine, ekya-{itu}= our own or ours, + -- ekya-{we}-your own or yours + GenAdj => table { + AgMUBAP1 Sg => "ngye" ; + AgMUBAP1 Pl => "itu" ; + AgMUBAP2 Sg => "we" ; + AgMUBAP2 Pl => "nyu" ; + AgP3 Sg MU_BA => "e" ; + AgP3 Pl MU_BA => "bo" ; + AgP3 Pl ZERO_BU => "bwo" ; + AgP3 Sg BU_MA => "bwo" ; + + AgP3 Pl (KA_BU | RU_BU) =>"bwo" ; + AgP3 Pl (KI_BI | ZERO_BI) => "byo" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "go" ; + + + AgP3 (Sg | Pl) HA => "ho" ; -- of place HA + AgP3 (Sg | Pl) MU => "mwo" ; -- of place MU + AgP3 (Sg | Pl) KU => "yo" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ryo" ; + AgP3 Sg (KA_ZERO | KA_BU) =>"ko" ; + AgP3 Sg KI_BI => "kyo" ; + AgP3 Sg (KU_ZERO | KU_MA) => "kwo" ; + AgP3 Sg (MU_MI | MU_ZERO) => "gwo" ; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwo" ; + AgP3 Pl (ZERO_TU | KA_TU) =>"two" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"two" ; + AgP3 Pl ZERO_MI => "yo" ; + AgP3 Pl MU_MI => "yo" ; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "zo" ; + AgP3 Sg GU_GA => "gwo" ; + AgP3 Pl GU_GA => "go" ; + _ => "XXYY" -- for debugging purposes + } ; + SStandPron => table { + AgMUBAP1 Sg =>"nyowe" ; + AgMUBAP1 Pl =>"itwe" ; + AgMUBAP2 Sg =>"iwe" ; + AgMUBAP2 Pl =>"imwe" ; + AgP3 Sg MU_BA => "uwe" ; + AgP3 Pl MU_BA => "bo" ; + AgP3 Pl ZERO_BU => "bwo" ; + AgP3 Sg BU_MA => "bwo" ; + + AgP3 Pl (KA_BU | RU_BU) =>"bwo" ; + AgP3 Pl (KI_BI | ZERO_BI) => "byo" ; + AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "go" ; + + + AgP3 (Sg | Pl) HA => "ho" ; -- of place HA + AgP3 (Sg | Pl) MU => "mwo" ; -- of place MU + AgP3 (Sg | Pl) KU => "yo" ; -- of place KU + AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ryo" ; + AgP3 Sg (KA_ZERO | KA_BU) =>"ko" ; + AgP3 Sg KI_BI => "kyo"; + AgP3 Sg (KU_ZERO | KU_MA) => "kwo" ; + AgP3 Sg (MU_MI | MU_ZERO) => "gwo"; + AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwo" ; + AgP3 Pl (ZERO_TU | KA_TU) =>"two" ; + AgP3 Sg (ZERO_ZERO | N_N) =>"two" ; + AgP3 Pl ZERO_MI => "yo" ; + AgP3 Pl MU_MI => "yo" ; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "zo" ; + AgP3 Sg GU_GA => "gwo" ; + AgP3 Pl GU_GA => "go" ; + _ => "XXYY" -- for debugging purposes + } + } ; + + {- + Operation to create Noun Phrases from a Determiner and Nouns. + In Runyankore and Rukiga, depending on the particular Determiner, + it can appear before (we call PreDeterminer) or after (PostDeterminer) the noun. + Examples: + A. PreDeterminers + 1. Definite aricles: Usually using the initial vowel sufficient + 2. Demonstratives: ogu muntu (This person) + 3. Every: every man = "buri muntu" + B. PostDeterminers + 1. Definite aricles: Usually using the initial vowel sufficient + 2. Demonstratives: omuntu ogu (person this) + 3. few: omuntu mu-kye + + -} + NounPhrase = { s : Str ; agr : Agr } ; + {-This function should be renamed to mkDetCN-} + mkDeterminer: Determiner -> Noun -> NounPhrase = \ det, cn -> + case det.pos of { + PreDeterminer => { s = det.s ++ cn.s ! det.ntype ! det.num; agr = AgP3 det.num cn.nc} ; + PostDeterminer => { s = cn.s!det.ntype!det.num ++ mkNCParticles!SubjM!AgP3 det.num cn.nc ++ det.s; agr = AgP3 det.num cn.nc} -- There is a mistake here. If the determiner is empty, we end up with a meaningless subject particle standing alone. we can test if det.s is a string or empty. + + + }; + + {- + Operation to create scenarios in which the PRIMARY NEGATIVE MARKER + for the verb is used. The presence of this marker negates the semantics of the verb. + It is used in the PAST, Simultaneous and all other tenses. + NOTE: The Primary and Secondary markers are in complementary distribution + + TO DO: Improve this!!! + -} + mkPol1Marker : Polarity => Tense => Anteriority => Str = table { + Neg => table { + Past => table { + Anter => "" ; + Simul => "ti" + } ; + _ => table { + _ => "ti" + } + } ; + Pos => \\_ => \\_ => "" + }; + + + {- + Operation to create scenarios in which the SECONDARY NEGATIVE MARKER + for the verb is used. The presence of this marker negates the semantics of the verb. + It is used in the PAST, Anterior only. + NOTE: The Primary and Secondary markers are in complementary distribution + -} + mkPol2Marker : Polarity => Tense => Anteriority => Str = table{ + Neg => table { + Past => table { + Anter => "ta"; + Simul => "" + }; + _ => table{ + _ => "" + } + }; + Pos => \\_=>\\_=> "" + } ; + + + {- + TO DO: stop here + -} + mkTenseMarker1 : Tense => Anteriority => Str = table{ + Past => table{ + Anter =>"baire"; + Simul =>"" + }; + Pres => table{ + _ =>"" + }; + Fut => table{ + Anter => "ijakubá";-- | "zakubá"; + Simul =>"ijaku"-- | "kuzaku" | "raa" + }; + Cond => table{ + _ => "kaa" + } + }; + + mkTenseMarker2:Tense=>Anteriority=>Str = table{ + Past => table{ + Anter =>"ire"; + Simul =>"ire" + }; + Pres => table{ + Anter =>"ire"; + Simul =>"" + }; + Fut => table{ + Anter => "ire"; + Simul =>"" + }; + Cond => table{ + Anter => "ire"; + Simul =>"" + } + }; + + mkAuxTenseMarker: Tense =>Anteriority=>Str =table { + Past => table { + Anter =>"kaba" ; + Simul =>"baire" + }; + Pres => table { + Anter =>"baire" ; + Simul =>[] + }; + Fut => table { + Anter => "ryaba" ; + Simul =>"ryaba" + }; + Cond => table { + Anter => "XX" ; + Simul =>"XX" + } + }; + + + Verb : Type ; + Verb = { s : Agr => Polarity => Tense => Anteriority => Str } ; + + AdjectivalPhrase : Type = { s : Agr => Str } ; + mkAdjective: Str-> Bool -> { s : Agr=> Str } = \ a , b -> case b of { + True => { s = \\ agr => a } ; + False => { s = \\ agr => let agrM = mkNCParticles ! AdjPron ! agr in + agrM + a --this is supposed to be a concatenation + } + }; + + + Verb2 : Type = Verb **{ c : Str } ; + mkV2 : Str -> Verb2 = \s -> (mkVerb s) ** { c = [] } ; + Adjective : Type = { s : Agr => Str } ; + mkComp : AdjectivalPhrase -> VerbPhrase ; --comp means compula + mkComp comp = { + s = \\ agr , pol , tense, anter => + let aux = mkAuxTenseMarker ! tense ! anter; + p2 = mkPol2Marker ! pol ! tense ! anter; + s = mkNCParticles ! SubjM ! agr + in aux ++ p2 + s ++ "ri" ++ comp.s!agr --why does the plus fail? + }; + + + mkVerb : Str -> Verb ; -- write an operation for the object marker + mkVerb run = { s = \\ subjM , pol , tense , anter => + let p1 = mkPol1Marker ! pol! tense ! anter ; + p2 = mkPol2Marker ! pol! tense ! anter ; + t1 = mkTenseMarker1 ! tense ! anter ; + t2 = mkTenseMarker2 ! tense ! anter ; + s = mkNCParticles ! SubjM !subjM + in + case < tense , anter > of { + => p1 + s + t1 ++ s + p2 + run + t2; + => p1 + s + t1 ++ p2 + run + t2; + _ => (p1 + s + p2 + t1 + run + t2) + } + }; + + +{- + + Note: The following is copied from the file swahili/ResSwa.gf +-} + +--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 { + +--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/src/rukiga/SentenceCgg.gf b/src/rukiga/SentenceCgg.gf index e85761038..1492146a3 100755 --- a/src/rukiga/SentenceCgg.gf +++ b/src/rukiga/SentenceCgg.gf @@ -4,13 +4,85 @@ concrete SentenceCgg of Sentence = CatCgg ** open Prelude, ResCgg in { lin - PredVP np vp = {s=\\pol,tense,anter => np.s ++ vp.s!np.agr!pol!tense!anter};--formation of a clause. Error for always picking third person. change to general case {-creating a sentence-} - UseCl temp pol cl = { - s = temp.s ++ pol.s ++ cl.s !pol.p ! temp.t ! temp.a - } ; + --UseCl temp pol cl = { + -- s = temp.s ++ pol.s ++ cl.s !pol.p ! temp.t ! temp.a + -- } ; +--2 Sentences + --UseCl : Temp -> Pol -> Cl -> S ; -- she had not slept + UseCl temp pol cl = let + subj = cl.subj; + clitic = mkSubjClitic cl.subjAgr; + simul = cl.morphs ! Pres; --this is not delivering the string + ant = cl.morphs ! PastPart; --this is not delivering the string + root = cl.root; + presRestOfVerb = cl.morphs ! Pres ! RestOfVerb; + pastRestOfVerb = cl.morphs ! PastPart ! RestOfVerb; + compl = cl.compl + in + case of { + => {s = subj ++ clitic ++ --Predef.BIND ++ + root ++ Predef.BIND ++ presRestOfVerb ++ compl}; + {-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-} + => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++ + root ++ presRestOfVerb ++ compl}; + => {s = subj ++ clitic ++ --Predef.BIND ++ + ant!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl}; + =>{s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++ + ant!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl} + }; --: Temp -> Pol -> QCl -> QS ; -- has John walked +UseQCl = UseCl; -- : Temp -> Pol -> Cl -> S ; -- John has not walked +QuestCl cl = cl; --: Cl -> QCl ; -- does John (not) walk +PredVP np vp = case vp.isCompApStem of{ + False => { + subj = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk + subjAgr = np.agr; + root = vp.s; + morphs = vp.morphs; + {- + inf = mkVerbInrf vp.root; + pres = mkVerbPres vp.root; + past = mkVerbPast vp.root; + presPart = mkVerbPresPart vp.root; + pastPart = mkVerbPastPart vp.root; -- subject + -} + --root = vp.root ; + compl = vp.comp + }; + True => { + subj = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk + subjAgr = np.agr; + root = vp.s; + morphs = vp.morphs; + {- + inf = mkVerbInrf vp.root; + pres = mkVerbPres vp.root; + past = mkVerbPast vp.root; + presPart = mkVerbPresPart vp.root; + pastPart = mkVerbPastPart vp.root; -- subject + -} + --root = vp.root ; + compl = mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp --mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp + } + };--: NP -> VP -> Cl ; -- John walks / John does not walk +{- + Note: It seems mkSubjClitic comes with a Predef.BIND already + prepared for the next token to bind. + Reason: When I add a BIND command, I get two bind tokens in the linearizations + -} + ImpVP vp = { + s =table{ + True=> vp.s ++ Predef.BIND ++ vp.morphs!Inf!RestOfVerb ++ vp.comp; + False => case vp.isCompApStem of { -- How do I make the number dynamic use case? + True =>vp.morphs!Pres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++ + vp.morphs!Inf!RestOfVerb ++ (mkAdjPronNoIVClitic (AgMUBAP2 Sg)) ++ vp.comp; + False => vp.morphs!Pres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++ + vp.morphs!Inf!RestOfVerb ++ vp.comp + } + } + }; --: VP -> Imp ; -- walk / do not walk {- --1 Sentence: Sentences, Clauses, and Imperatives diff --git a/src/rukiga/StructuralCgg.gf b/src/rukiga/StructuralCgg.gf index 1ef72d6f4..27f3d7134 100755 --- a/src/rukiga/StructuralCgg.gf +++ b/src/rukiga/StructuralCgg.gf @@ -4,29 +4,120 @@ concrete StructuralCgg of Structural = CatCgg ** open ResCgg, ParadigmsCgg, (C = ConstructX), Prelude in { lin - + + a_Det = {s =[] ; ntype = Complete; num = Sg; pos = PreDeterminer}; --: Det ; indefinite singular ---s + aPl_Det = {s =[]; ntype = Complete; num = Pl; pos = PreDeterminer}; -- : Det ;indefinite plural ---s + the_Det = {s =[]; ntype = Complete; num = Sg; pos = PreDeterminer}; --: Det ; -- definite singular ---s thePl_Det = {s =[]; ntype = Complete; num = Pl; pos = PreDeterminer}; --: Det ;definite plural ---s + every_Det = {s = "buri"; ntype=Incomplete; num=Sg; pos=PreDeterminer} ; few_Det = {s="kye"; ntype =Complete; num=Pl; pos=PostDeterminer} ; many_Det ={s="ingi"; ntype =Complete; num=Pl; pos=PostDeterminer} ; - i_Pron = {s = table {Nom = "nyowe"; Acc = "nyowe"}; agr = AgMUBAP1 Sg}; - youSg_Pron {s = table {Nom = "iwe"; Acc = "we"}; agr=AgMUBAP2 Sg }; - she_Pron = {s = table {Nom = "uwe"; Acc = "uwe"}; agr=AgP3 Sg MU_BA}; - he_Pron = {s= table {Nom = "uwe"; Acc = "uwe"}; agr=AgP3 Sg MU_BA}; - it_Pron = {s = table {Nom = "kyo"; Acc = "kyo"}; agr=AgP3 Sg KI_BI}; -- should form an it_Pron_NClass in extra module - we_Pron = {s = table {Nom = "itwe"; Acc = "itwe"}; agr = AgMUBAP1 Pl}; - youPl_Pron ={s = table {Nom = "imwe"; Acc = "imwe"}; agr = AgMUBAP2 Pl}; - they_Pron = {s= table {Nom = "bo"; Acc = "bo"}; agr=AgP3 Pl MU_BA};--But there are lots of other representations from other noun classes in extra module + i_Pron = mkPron "nyowe" "nyowe" (AgMUBAP1 Sg); + youSg_Pron = mkPron "iwe" "we" (AgMUBAP2 Sg); + he_Pron, she_Pron = mkPron "uwe" "uwe" (AgP3 Sg MU_BA); + we_Pron = mkPron "itwe" "itwe" (AgMUBAP1 Pl); + youPl_Pron = mkPron "imwe" "imwe" (AgMUBAP2 Pl); + they_Pron = mkPron "bo" "bo" (AgP3 Pl MU_BA); + it_Pron = mkPron "kyo" "kyo" (AgP3 Sg KI_BI); -- should form an it_Pron_NClass in extra module + behind_Prep ={s="enyuma ya"}; between_Prep = {s="hagati ya"}; to_Prep ={s="aha"}; - in_Prep ={s="omu"}; - on_Prep ={s="aha"}; + -- several words depending on use omuri?? + in_Prep = mkPrep "omu" "omuri"; + --aha-ri Kamukuzi??? works for places + on_Prep = mkPrep "aha" "ahari"; + +--na --please this string varies with vowels use combine_morphemes or +--combine_words when using it. +with_Prep = mkPrep "na" []; + from_Prep ={s="kuruga"}; under_Prep = {s="hansi ya"}; + + ---Structural + {- + --there are several and i.e. + -- na (two nouns, 2 Noun Phrases, 2 Pronouns, 2 relative subject clauses, ) + --kandi (clauses having a commonality of subjects, object or tense) + --the best structure is a table + --mkConjunction "na" "kandi" and_Conj ; + -} + and_Conj = { + s = table { + AConj Other => "kandi"; + _ => "na" + }; + + s2 =[]; + n = Pl + }; + + {- + + TODO: Look at the grammar books by Mpairwe & Kahangi Pg 155 + and investigate or to find out its arguments but for now + I will assume nari works on all types of + ConjArg (Conjunction Arguments) + + nari is the general or + + These are candidates for Extra module if they are not specific + to the type of argument. + nînga for Runynakore and + + nainga for rukiga + -} + + + or_Conj = { + s = \\ _ => "nari"; + s2 =[]; + n = Sg + }; + + have_V2 ={s= "ine"; morphs = mkVerbMorphs; comp = []}; --: V2 ; +{- + All Predeterminers are given here. + Initial analysis shows that + a) They appear after the noun phrase but some may be multi-word expressions for a single word in eblish. + b) They appear to agree with the noun class particle. But nothing in the literature states about + their morphological structure. The stems can be guessed by removing the two letter + suffix at the begining of the word. However, there are exceptions such as "not" which is not + inflected according to noun class + c) A table of concords must be built to accomodate every instance and this can only be done + using an analysis of some of the words in the dictionary(Mapirwe and Kahagi). + I am incluned to say use of the table of self-standing pronouns is sufficient. + d) An investigation of the tone systems would also be worthwhile. + + + Example sentences: + 1. All these chickens + 2. once a day + 3. only the man +-} +all_Predet = {s = "òna"; s2 = []; isMWE = False; isInflected =True}; +only_Predet = {s = "nka"; s2 = []; isMWE = False; isInflected =True}; +{- +-- how do we deal with superlatives. There seems to be no distinction between countable +-- and uncountable when it comes to superlatioves +-} +most_Predet = {s = "rikukíra"; s2 = "îngi"; isMWE = True; isInflected =True}; +not_Predet = {s = "ti"; s2 = []; isMWE = False; isInflected =False}; + + + + +{-Section for Adverbs-} +always_AdV = {s = "obutóòsha"; agr = AgrNo}; +everywhere_Adv = {s = "hóòna"; agr = AgrNo}; -- adverb of place. +here_Adv = {s = "hanu"; agr = AgrNo}; +{-End of Adverbs Adverbs-} + {-variants NOTE: Please add them to the abstract syntax, ask aarne or creat you own abstract Lexicon which inherits from the diff --git a/src/rukiga/VerbCgg.gf b/src/rukiga/VerbCgg.gf index 917d71c7a..1ea24af7c 100755 --- a/src/rukiga/VerbCgg.gf +++ b/src/rukiga/VerbCgg.gf @@ -1,37 +1,48 @@ --# -path=.:../prelude:../abstract:../common -concrete VerbCgg of Verb = CatCgg ** open ResCgg in { +concrete VerbCgg of Verb = CatCgg ** open ResCgg, Prelude in { lin - UseV verb = verb ; + UseV v = {s = v.s ; morphs = v.morphs; comp =[]; isCompApStem = False; agr = AgrNo}; --: V -> VP; -- sleep --ignoring object agreement --- UseComp : Comp -> VP ; -- be warm +-- UseComp : Comp -> VP ; -- be warm means complement of a copula especially adjectival Phrase --VerbPhrase: Type ={s:Agr=>Polarity=>Tense=>Anteriority=>Str}; -UseComp comp = mkComp comp ; --its not generating any sentence + --AdjectivalPhrase : Type = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool}; + UseComp comp = { + s = comp.s; --Assuming there is no AP which is prepositional + morphs=\\form,morphs=>[] ; + comp = [] ; + isCompApStem = False; + agr = AgrNo}; --its not generating any sentence --- CompAP : AP -> Comp ; -- (be) small - CompAP ap = ap; +-- CompAP : AP -> Comp; -- (be) small + CompAP ap = {s=ap.s}; -- CompNP : NP -> Comp ; -- (be) the man - CompNP np = {s =\\agr=> - case np.agr of{ - agr => np.s; - _ => [] - } - }; + CompNP np = {s= np.s ! Acc}; --{s =[] ; post =np.s; isPre = False; isProper = Bool; isPrep: Bool}; -- CompAdv : Adv -> Comp ; -- (be) here CompAdv adv =adv; -- SlashV2a : V2 -> VPSlash ; -- love (it) - SlashV2a v2 = {s=v2.s; c=v2.c}; + SlashV2a v2 ={ + s =v2.s; + morphs = v2.morphs; + comp = [] + }; -- ComplSlash : VPSlash -> NP -> VP ; -- love it - + ComplSlash vpslash np ={ + s =vpslash.s; + morphs = vpslash.morphs; + comp = vpslash.comp ++ np.s ! Acc; + isCompApStem = False; + agr = AgrYes np.agr + }; -- AdvVP : VP -> Adv -> VP ; -- sleep here --- VerbPhrase: Type ={s:Agr=>Polarity=>Tense=>Anteriority=>Str}; - AdvVP vp adv ={s=\\agr,pol,tense,anter=>vp.s!agr!pol!tense!anter ++ adv.s!agr}; +-- VerbPhrase: Type = {s:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist}; + AdvVP vp adv ={s=vp.s; morphs = vp.morphs; comp = adv.s; isCompApStem = False; agr = AgrNo}; {- --1 The construction of verb phrases