From 355fcc2e6df11b1a9283e40aaf80842c04cad254 Mon Sep 17 00:00:00 2001 From: David Bamutura Date: Tue, 14 May 2019 09:23:09 +0200 Subject: [PATCH] Some corrections made and functions added --- src/rukiga/CatCgg.gf | 10 +++++++--- src/rukiga/ConjunctionCgg.gf | 14 +++++++++++-- src/rukiga/LexiconCgg.gf | 12 ++++++------ src/rukiga/NounCgg.gf | 24 +++++++++++++++++++---- src/rukiga/QuestionCgg.gf | 22 ++++++++++++++++++++- src/rukiga/ResCgg.gf | 38 ++++++++++++++++++++++++++++++++++++ src/rukiga/SentenceCgg.gf | 10 +++++++--- 7 files changed, 111 insertions(+), 19 deletions(-) diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index c6b94a090..9e402d776 100755 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -19,8 +19,9 @@ lincat -- You must change some of the lincats (e.g., for NP, Det and Pron) so that everything works S = SS ; -- declarative sentence e.g. "she lived here" - Cl, QCl = Res.Clause ; -- declarative clause, with all tenses e.g. "she looks at this" - + Cl = Res.Clause ; -- declarative clause, with all tenses e.g. "she looks at this" + QCl = Res.Clause ** {posibleSubAgr: Res.Agreement =>Str} ; + RS = {s : Str} ; -- relative e.g. "in which she lived" V = Res.Verb ; --change to {verb : Str ; comp = []} -- one-place verb e.g. "sleep" V2,V2Q, V2S = Res.Verb2; V2A,V3 = Res.Verb3; -- three-place verb e.g. "show" @@ -70,10 +71,13 @@ lincat IAdv = {s : Str ; requiresSubjPrefix: Bool}; IDet = {s : Str ; n : Res.Number; requiresSubjPrefix: Bool}; IQuant = {s : Res.Number =>Str ; requiresSubjPrefix: Bool}; + DAP = Res.Determiner ;; + --VV = linref - Cl, QCl =\cl -> cl.s ++ Res.mkSubjClitic cl.subjAgr ++ cl.root ++ BIND ++ cl.pres; + Cl =\cl -> cl.s ++ Res.mkSubjClitic cl.subjAgr ++ cl.root ++ BIND ++ cl.pres; + QCl =\qcl -> qcl.s ++ qcl.posibleSubAgr ! (Res.mkAgreement Res.MU_BA Res.P3 Res.Sg) ++ qcl.root ++ BIND ++ qcl.pres; VP =\vp -> vp.s ++ BIND ++ vp.pres; {- --1 Cat: the Category System diff --git a/src/rukiga/ConjunctionCgg.gf b/src/rukiga/ConjunctionCgg.gf index fb1ec20f4..230a68c4b 100755 --- a/src/rukiga/ConjunctionCgg.gf +++ b/src/rukiga/ConjunctionCgg.gf @@ -2,8 +2,18 @@ concrete ConjunctionCgg of Conjunction = CatCgg ** open ResCgg, Coordination, Prelude in { - - +{- +lincat + [S] = {s1,s2 : Str} ; + [Adv] = {s1,s2 : Str} ; + [AdV] = {s1,s2 : Str} ; + [IAdv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : NPCase => Str ; a : Agr} ; + [AP] = {s1,s2 : Agr => Str ; isPre : Bool}; + [RS] = {s1,s2 : Agr => Str ; c : NPCase}; + [CN] = {s1,s2 : Number => Case => Str}; + [DAP] = {s1,s2 : Str ; n : Number}; + -} {- --1 Conjunction: Coordination diff --git a/src/rukiga/LexiconCgg.gf b/src/rukiga/LexiconCgg.gf index 999b73b03..b95b8b5fc 100755 --- a/src/rukiga/LexiconCgg.gf +++ b/src/rukiga/LexiconCgg.gf @@ -84,16 +84,16 @@ lin green_A =mkAdjective "kijubwe" Post False True; --ditransitive verbs - --bite_V2 = mkV2 "rum"; + 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"; + close_V2 = mkV2 "king"; + count_V2 = mkV2 "ba" "ra" "zire"; + cut_V2 = mkV2 "sha" "ra" "zire"; + do_V2 = mkV2 "ko" "ra" "zire"; drink_V2 = mkV2 "nyw"; eat_V2 = mkV2 "ry"; - --fear_V2 = mkV2 "tiin"; + 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 ; diff --git a/src/rukiga/NounCgg.gf b/src/rukiga/NounCgg.gf index 68c88fac6..ecc034595 100755 --- a/src/rukiga/NounCgg.gf +++ b/src/rukiga/NounCgg.gf @@ -76,7 +76,7 @@ lin => {s = \\_ =>nomS ++ predet.s ; agr = a}; => {s = \\_ =>nomS ++ predet.s ++ predet.s2; agr = a} -- never seen this case }; - + --AdvNP : NP -> Adv -> NP ; -- Paris today AdvNP np adv = {s= \\c => np.s ! c ++ adv.s; agr = np.agr }; --PPartNP : NP -> V2 -> NP ; -- the man seen use the Passive form of the verb see. abantu abarebirwe @@ -86,7 +86,7 @@ lin {-What the hell does this mean?-} ExtAdvNP np adv = {s= \\c => np.s ! c ++ embedInCommas adv.s; agr = np.agr}; -- how do I do the adverbial clause? -- Determiner: Type = {s:Str; ntype:NounType; num:Number; pos:Position}; -- type for Determier necessary for catCgg.gf - + RelNP np rs ={s = \\c => np.s ! c ++ rs.s; agr =np.agr}; -- The determiner has a fine-grained structure, in which a 'nucleus' -- quantifier and an optional numeral can be discerned. --DetQuant : Quant -> Num -> Det ; -- these five @@ -95,8 +95,8 @@ lin --DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best --DetQuantOrd quant num ord = {}; - NumSg = {s=[]; n=Sg}; - NumPl = {s=[]; n=Pl}; + NumSg = {s=[]; n=Sg}; --Num + NumPl = {s=[]; n=Pl}; --Num -- NumCard card = {...}; --Quant = {s : Res.Pronoun; s2 :Res.Agreement => Str; doesAgree : Bool; isPron: Bool} ; IndefArt = {s={s=\\_=>[]; third = \\_,_=>[];agr = AgrNo }; s2 = \\_=>[]; doesAgree = False; isPron=False}; @@ -123,6 +123,22 @@ lin --PossPron : Pron -> Quant ; -- my (house) PossPron pron = {s =pron; s2 =\\_=> []; doesAgree = True; isPron = True}; + --3 Conjoinable determiners and ones with adjectives + + --AdjDAP : DAP -> AP -> DAP ; -- the large (one) + {- + AdjDAP dap ap ={ + s = dap.s ++ ap.s ; + s2: Res.Agreement; + ntype : NounState ; + num : Number ; + pos : Position; + doesAgree: Bool }; + -} + --DetDAP : Det -> DAP ; -- this (or that) + + + {- --1 Noun: Nouns, noun phrases, and determiners diff --git a/src/rukiga/QuestionCgg.gf b/src/rukiga/QuestionCgg.gf index 2c66e2f68..781cbf8b5 100755 --- a/src/rukiga/QuestionCgg.gf +++ b/src/rukiga/QuestionCgg.gf @@ -7,8 +7,28 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in { lin --QuestCl : Cl -> QCl ; -- does John walk - QuestCl cl = cl; + QuestCl cl = cl ** {posibleSubAgr = mkSubjCliticTable;}; --QuestVP : IP -> VP -> QCl ; -- who walks + + QuestVP ip vp = { + s = ip.s; + subjAgr = NONE; -- no option but to just pick one + posibleSubAgr = mkSubjCliticTable; + root = vp.s; + pres = vp.pres; + perf = vp.perf; + morphs = vp.morphs; + {- + inf : Str; + pres : Str; + past : Str; + presPart : Str; + pastPart : Str; -- subject + --root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep" + -} + compl = vp.comp -- after verb: complement, adverbs + } ; + --QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love --QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk --QuestIComp : IComp -> NP -> QCl ; -- where is John diff --git a/src/rukiga/ResCgg.gf b/src/rukiga/ResCgg.gf index d7a5d3532..f376d71e8 100755 --- a/src/rukiga/ResCgg.gf +++ b/src/rukiga/ResCgg.gf @@ -309,6 +309,44 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of { _ => mkClitic "SubjNotKnown" --for checking if there is some class unaccounted for }; + + mkSubjCliticTable : Agreement => Str = table { + 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 diff --git a/src/rukiga/SentenceCgg.gf b/src/rukiga/SentenceCgg.gf index caeb6fe4e..829581657 100755 --- a/src/rukiga/SentenceCgg.gf +++ b/src/rukiga/SentenceCgg.gf @@ -13,11 +13,11 @@ lin UseCl temp pol cl = let subj = cl.s; clitic = mkSubjClitic cl.subjAgr; - simul = cl.morphs ! VFPres; --this is not delivering the string + simul = cl.pres; --morphs ! VFPres; --this is not delivering the string ant = cl.morphs ! VFPastPart; --this is not delivering the string root = cl.root; presRestOfVerb = cl.morphs ! VFPres ! RestOfVerb; - pastRestOfVerb = cl.morphs ! VFPastPart ! RestOfVerb; + pastRestOfVerb = cl.perf; --morphs ! VFPastPart ! RestOfVerb; compl = cl.compl in @@ -34,7 +34,7 @@ lin }; --: 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 + QuestCl qcl = qcl; --: Cl -> QCl ; -- does John (not) walk PredVP np vp = case vp.isCompApStem of{ False => { @@ -93,6 +93,10 @@ lin } }; --: VP -> Imp ; -- walk / do not walk + -- A sentence can be modified by a relative clause referring to its contents. + + RelS : S -> RS -> S ; -- she sleeps, which is good + --2 Clauses missing object noun phrases -- This category is a variant of the 'slash category' $S/NP$ of