From 1dbd1b535fcb85b5de70aba562b2c5039c2f2d7d Mon Sep 17 00:00:00 2001 From: David Bamutura Date: Tue, 14 May 2019 02:04:32 +0200 Subject: [PATCH] Added Interrogative adverbs abd Pronouns. Not working Properly. --- src/rukiga/CatCgg.gf | 10 +++- src/rukiga/GrammarCgg.gf | 4 +- src/rukiga/LexiconCgg.gf | 2 +- src/rukiga/QuestionCgg.gf | 9 ++++ src/rukiga/ResCgg.gf | 43 +++++++++++++++ src/rukiga/SentenceCgg.gf | 104 ++++++++++++++++++++---------------- src/rukiga/StructuralCgg.gf | 12 +++-- 7 files changed, 129 insertions(+), 55 deletions(-) diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index bc61bcd9..8f30cae6 100755 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -1,7 +1,7 @@ --# -path=.:../prelude:../abstract:../common -concrete CatCgg of Cat = CommonX -[Adv]** - open (Res=ResCgg), Prelude, (Px=ParamX) in { +concrete CatCgg of Cat = CommonX -[Adv,IAdv]** + open (Res=ResCgg), Prelude, (Px=ParamX), Predef in { lincat @@ -66,7 +66,13 @@ lincat Digits = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number ; tail : Px.DTail} ; Ord = {s :Res.Agreement=>Str; position1:Res.Position1} ; Card = {s :Res.Agreement=>Str; n : Res.Number} ; + IP = {s :Str ; n : Res.Number; isVerbSuffix: Bool; requiresIPPrefix: Bool; aux:Str}; + IAdv = {s :Str ; requiresSubjPrefix: Bool}; --VV = + +linref + Cl, QCl =\cl -> cl.s ++ Res.mkSubjClitic cl.subjAgr ++ cl.root ++ BIND ++ cl.pres; + VP =\vp -> vp.s ++ BIND ++ vp.pres; {- --1 Cat: the Category System diff --git a/src/rukiga/GrammarCgg.gf b/src/rukiga/GrammarCgg.gf index 23556759..538458ba 100755 --- a/src/rukiga/GrammarCgg.gf +++ b/src/rukiga/GrammarCgg.gf @@ -11,10 +11,10 @@ concrete GrammarCgg of Grammar = RelativeCgg, ConjunctionCgg, PhraseCgg, - TextX -[Adv], + TextX -[Adv, IAdv], StructuralCgg, IdiomCgg, - TenseX -[Adv] + TenseX -[Adv,IAdv] ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/rukiga/LexiconCgg.gf b/src/rukiga/LexiconCgg.gf index 49e90b41..999b73b0 100755 --- a/src/rukiga/LexiconCgg.gf +++ b/src/rukiga/LexiconCgg.gf @@ -121,7 +121,7 @@ lin sleep_V = mkV "nyama" ; --: V ;--Kugwejegyera, kubyama swim_V = mkV "og"; --: V ; travel_V = mkV "gyend";--: V ; - walk_V = mkV "tabur"; --: V ; or kuribata + walk_V = mkV "ribá" "ta" "si"; --: V ; or kuribata Runynakore it is different --Verbs that have a noun Phrase complement and a verb phrase complement (V2V) --beg_V2V : V2V ; diff --git a/src/rukiga/QuestionCgg.gf b/src/rukiga/QuestionCgg.gf index 131d0b5f..0040202c 100755 --- a/src/rukiga/QuestionCgg.gf +++ b/src/rukiga/QuestionCgg.gf @@ -2,7 +2,16 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in { --1 Question: Questions and Interrogative Pronouns +-- A question can be formed from a clause ('yes-no question') or +-- with an interrogative. + lin + --QuestCl : Cl -> QCl ; -- does John walk + QuestCl cl = cl; + --QuestVP : IP -> VP -> QCl ; -- who walks + --QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love + --QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk + --QuestIComp : IComp -> NP -> QCl ; -- where is John {- --1 Question: Questions and Interrogative Pronouns diff --git a/src/rukiga/ResCgg.gf b/src/rukiga/ResCgg.gf index 0cff7e14..a8efc0f8 100755 --- a/src/rukiga/ResCgg.gf +++ b/src/rukiga/ResCgg.gf @@ -793,6 +793,39 @@ oper } }; + mkIPPref : Agreement =>Str = table{ + AgMUBAP1 Sg => mkClitic "o"; + AgMUBAP1 Pl => mkClitic "ba" ; + AgMUBAP2 Sg => mkClitic "o"; + AgMUBAP2 Pl => mkClitic "ba" ; + AgP3 Sg MU_BA => mkClitic "o"; + AgP3 Pl MU_BA => mkClitic "ba" ; + 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 "ga"; + AgP3 (Sg ) HA => mkClitic "ha" ; -- of place HA + AgP3 (Sg ) MU => mkClitic "ha" ; -- of place MU + AgP3 (Sg ) KU => mkClitic "e" ; -- 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 "gu" ; + 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 "e" ; + AgP3 Pl ZERO_MI =>mkClitic "e" ; + AgP3 Pl MU_MI => mkClitic "e"; + AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "zi" ; + AgP3 Sg GU_GA => mkClitic "gu" ; + AgP3 Pl GU_GA => mkClitic "ga" ; + _ => mkClitic "XXXThat" -- error checking for any case not catered for + + }; + + mkRObjV2 : Agreement=> Str =table { AgMUBAP1 Sg => mkClitic "ou"; AgMUBAP1 Pl => mkClitic "abi" ; --note: abu or abi is used. GF does not allow free variation. However, abu is more natural @@ -944,8 +977,16 @@ oper be_GVerb : GVerb = { s= table{True => "ri"; False =>"b" }; morphs = \\form, morphs =>[]; + + isAux = True}; + + + + + --be1_Verb: Verb = {s="b"; pres = "e"; perf="a"; morphs = mkVerbMorphs}; + --be2_Verb: Verb = {s="ri"; pres = "e"; perf="a"; morphs = mkVerbMorphs}; {- --copulative conjugations of ni and ri as used for adjectives @@ -1102,6 +1143,8 @@ oper s : Str ; --subject subjAgr : Agreement; root : Str; + pres: Str; + perf: Str; morphs : VFormMini => VerbMorphPos =>Str; {- inf : Str; diff --git a/src/rukiga/SentenceCgg.gf b/src/rukiga/SentenceCgg.gf index f49b6c98..caeb6fe4 100755 --- a/src/rukiga/SentenceCgg.gf +++ b/src/rukiga/SentenceCgg.gf @@ -33,56 +33,65 @@ lin 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 => { - s = 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 => { - s = 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 -{- + 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 => { + s = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk + subjAgr = np.agr; + pres = vp.pres; + perf = vp.perf; + 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 => { + s = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk + subjAgr = np.agr; + pres = vp.pres; + perf = vp.perf; + 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!VFInf!RestOfVerb ++ vp.comp; - False => case vp.isCompApStem of { -- How do I make the number dynamic use case? - True =>vp.morphs!VFPres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++ - vp.morphs!VFInf!RestOfVerb ++ (mkAdjPronNoIVClitic (AgMUBAP2 Sg)) ++ vp.comp; - False => vp.morphs!VFPres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++ - vp.morphs!VFInf!RestOfVerb ++ vp.comp - } - } - }; --: VP -> Imp ; -- walk / do not walk + + ImpVP vp = { + s =table{ + True=> vp.s ++ Predef.BIND ++ vp.morphs!VFInf!RestOfVerb ++ vp.comp; + False => case vp.isCompApStem of { -- How do I make the number dynamic use case? + True =>vp.morphs!VFPres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++ + vp.morphs!VFInf!RestOfVerb ++ (mkAdjPronNoIVClitic (AgMUBAP2 Sg)) ++ vp.comp; + False => vp.morphs!VFPres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++ + vp.morphs!VFInf!RestOfVerb ++ vp.comp + } + } + }; --: VP -> Imp ; -- walk / do not walk --2 Clauses missing object noun phrases @@ -102,6 +111,9 @@ PredVP np vp = case vp.isCompApStem of{ --SlashVS : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves + + + {- --1 Sentence: Sentences, Clauses, and Imperatives diff --git a/src/rukiga/StructuralCgg.gf b/src/rukiga/StructuralCgg.gf index c365b2fa..a1face56 100755 --- a/src/rukiga/StructuralCgg.gf +++ b/src/rukiga/StructuralCgg.gf @@ -156,11 +156,15 @@ lin {-End of verb-phrase-complement verb -} + {-Beggining of Interrogative Pronoun-} - - - - + whatPl_IP = { s= "ki"; n = Pl; isVerbSuffix = True; requiresIPPrefix = False; aux=[]} ; -- what (plural) + whatSg_IP = { s= "ki"; n = Sg; isVerbSuffix = True; requiresIPPrefix = False; aux=[]} ; --: IP ; -- what (singular) + whoPl_IP = { s= "ha"; n = Pl; isVerbSuffix = True; requiresIPPrefix = False; aux="ni"} ;--: IP ; -- who (plural) + whoSg_IP = { s= "ha"; n = Sg; isVerbSuffix = True; requiresIPPrefix = False; aux=[]} ; --: IP ; -- who (singular) + --You may need to use booleans to indicate that you need these tables rather than carrying them. + how_IAdv = {s ="ta"; requiresSubjPrefix = True}; --: IAdv ; + --how8much_IAdv = {s ="kwiga"; s2requireSubjPrefix = True};--: IAdv ; {- --1 Structural: Structural Words --