From aad7b002aad23f5052be59c34c0a947b7378d655 Mon Sep 17 00:00:00 2001 From: David Bamutura Date: Mon, 26 Oct 2020 16:00:34 +0300 Subject: [PATCH] =made changes to Verb Phrase and VPSlash that check if the complements actually exists --- src/rukiga/ParadigmsCgg.gf | 8 +-- src/rukiga/ResCgg.gf | 8 ++- src/rukiga/SentenceCgg.gf | 62 ++++++++++++++---- src/rukiga/VerbCgg.gf | 127 ++++++++++++++++++++++++++++++------- 4 files changed, 164 insertions(+), 41 deletions(-) diff --git a/src/rukiga/ParadigmsCgg.gf b/src/rukiga/ParadigmsCgg.gf index a44f0aaf0..5eed44d30 100755 --- a/src/rukiga/ParadigmsCgg.gf +++ b/src/rukiga/ParadigmsCgg.gf @@ -108,7 +108,7 @@ oper mkV2S : V -> Prep -> V2S ; -- e.g. tell (NP) (that S) mkV2S v p = lin V2S (prepV2 v p) ; --mkPrep : Str -> Str ->Bool -> Preposition ; -- e.g. "in front of" - mkPrep : Str -> Str ->Bool -> Preposition; + mkPrep : Str -> Str ->Bool -> Prep; mkPrep first other bool = lin Prep { s = first ; other = other; @@ -213,11 +213,11 @@ mkInterj : Str -> Interj A2V : Type = A2 ; mkV0 : V -> V; mkV0 v = v ; - mkA2 : Str -> Position -> Bool -> Bool ->Bool-> A2 = \a2, pos, isProper, isPrep,isNeg -> - lin A2 ((mkAdjective a2 pos isProper isPrep isNeg) ** {c2 = ""; isPre = True}); + mkA2 : Str -> Position -> Bool -> Bool ->Bool-> A2V = \a2, pos, isProper, isPrep,isNeg -> + lin A2V ((mkAdjective a2 pos isProper isPrep isNeg) ** {c2 = ""; isPre = True}); --mkA2V : A -> A2V; --mkA2V a = lin A2V (a * {c2 = ""; isPre = True}); - mkA2V : Str -> Position -> Bool -> Bool ->Bool-> A2V =\a2, pos, isProper, isPrep,isNeg -> lin A2V ((mkAdjective a2 pos isProper isPrep isNeg) ** {c2 = ""; isPre = True}); + mkA2V : Str -> Position -> Bool -> Bool ->Bool-> A2 =\a2, pos, isProper, isPrep,isNeg -> lin A2 ((mkAdjective a2 pos isProper isPrep isNeg) ** {c2 = ""; isPre = True}); -- Adverbs modifying numerals diff --git a/src/rukiga/ResCgg.gf b/src/rukiga/ResCgg.gf index a6405a024..551f7bec6 100755 --- a/src/rukiga/ResCgg.gf +++ b/src/rukiga/ResCgg.gf @@ -1379,7 +1379,9 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of { adv:Str; containsAdv: Bool; adV:Str; - containsAdV:Bool + containsAdV:Bool; + containsComp : Bool; + containsComp2 : Bool }; -- in VP formation, all verbs are lifted to GVerb, but morphology doesn't need to know this verb2gverb : Verb ->Str -> GVerb = \v, ba -> { @@ -1587,7 +1589,9 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of { adv:Str; containsAdv:Bool; adV:Str; - containsAdV:Bool + containsAdV:Bool; + containsComp : Bool; + containsComp2 : Bool }; --comp is empty diff --git a/src/rukiga/SentenceCgg.gf b/src/rukiga/SentenceCgg.gf index 3d6f5e5d7..4365fed7e 100755 --- a/src/rukiga/SentenceCgg.gf +++ b/src/rukiga/SentenceCgg.gf @@ -281,8 +281,8 @@ lin - PredVP np vp = case of { - => { + PredVP np vp = case of { + => { s = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk subjAgr = np.agr; pres = vp.pres; @@ -293,16 +293,16 @@ lin isPerfBlank = vp.isPerfBlank; {- inf = mkVerbInrf vp.root; - pres = mkVerbPres vp.root; - past = mkVerbPast vp.root; - presPart = mkVerbPresPart vp.root; - pastPart = mkVerbPastPart vp.root; -- subject - -} + pres = mkVerbPres vp.root; + past = mkVerbPast vp.root; + presPart = mkVerbPresPart vp.root; + pastPart = mkVerbPastPart vp.root; -- subject + -} --root = vp.root ; compl = vp.adV }; - <_, _> => { + <_, _,True,False> => { s = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk subjAgr = np.agr; pres = vp.pres; @@ -313,13 +313,51 @@ lin isPerfBlank = vp.isPerfBlank; {- inf = mkVerbInrf vp.root; - pres = mkVerbPres vp.root; - past = mkVerbPast vp.root; - presPart = mkVerbPresPart vp.root; - pastPart = mkVerbPastPart vp.root; -- subject + pres = mkVerbPres vp.root; + past = mkVerbPast vp.root; + presPart = mkVerbPresPart vp.root; + pastPart = mkVerbPastPart vp.root; -- subject -} --root = vp.root ; compl = mkSubjClitic np.agr ++ vp.comp --mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp + }; + <_, _,True, 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; + isPresBlank = vp.isPresBlank; + isPerfBlank = vp.isPerfBlank; + {- + 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 ++ vp.comp ++ vp.comp2--mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp + }; + <_, _,_, _> => { + 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; + isPresBlank = vp.isPresBlank; + isPerfBlank = vp.isPerfBlank; + {- + 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 } };--: NP -> VP -> Cl ; -- John walks / John does not walk diff --git a/src/rukiga/VerbCgg.gf b/src/rukiga/VerbCgg.gf index 44e778ff9..dcaad500a 100755 --- a/src/rukiga/VerbCgg.gf +++ b/src/rukiga/VerbCgg.gf @@ -20,7 +20,9 @@ lin adv =[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = False; + containsComp2 = False }; --: V -> VP; -- sleep --ignoring object agreement -- UseComp : Comp -> VP ; -- be warm means complement of a copula especially adjectival Phrase @@ -45,7 +47,9 @@ lin adv = []; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = False }; _ => { s = mkBecome.s ++ BIND ++mkBecome.pres++ comp.s; --Assuming there is no AP which is prepositional @@ -63,7 +67,9 @@ lin adv = []; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = False } }; --its not generating any sentence @@ -97,7 +103,9 @@ lin adv=[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = False; + containsComp2 =False }; --Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her) Slash2V3 v3 np ={ @@ -114,7 +122,9 @@ lin adv = []; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 =False }; --Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her @@ -132,7 +142,9 @@ lin adv = []; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = True }; --SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy SlashVV vv vpslash ={ @@ -152,7 +164,9 @@ lin adv = []; containsAdv = False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = False; + containsComp2 = False }; --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go @@ -176,7 +190,9 @@ lin adv = []; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = vpslash.containsComp2 }; -- AdvVP : VP -> Adv -> VP ; -- sleep here -- VerbPhrase: Type = {s:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist}; @@ -189,7 +205,7 @@ lin isPresBlank = vp.isPresBlank; isPerfBlank = vp.isPerfBlank; comp = adv.s; - comp2 = []; + comp2 = vp.comp2; ap =[]; isCompApStem = False; agr = AgrNo; @@ -197,7 +213,9 @@ lin adv = adv.s; containsAdv =True; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = vp.containsComp2 }; -- AdVVP : AdV -> VP -> VP ; -- always sleep @@ -217,7 +235,9 @@ lin adv = []; containsAdv =False; adV =adV.s; - containsAdV = True + containsAdV = True; + containsComp = vp.containsComp; + containsComp2 = vp.containsComp2 }; --AdvVPSlash : VPSlash -> Adv -> VPSlash ; -- use (it) here @@ -240,7 +260,9 @@ lin adv = adv.s; containsAdv =True; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = vpslash.containsComp; + containsComp2 = vpslash.containsComp2 }; -- Adverb directly attached to verb --AdVVPSlash : AdV -> VPSlash -> VPSlash ; -- always use (it) @@ -262,7 +284,9 @@ lin adv = []; containsAdv =False; adV =adV.s; - containsAdV = True + containsAdV = True; + containsComp = vpslash.containsComp; + containsComp2 = vpslash.containsComp2 }; -- Verb phrases are constructed from verbs by providing their -- complements. There is one rule for each verb category. @@ -272,9 +296,14 @@ lin --This function requires the remodelling of VP to accomodate two Verbs. -- -} - ComplVV vv vp = let vpPres = "ku" ++ BIND ++ vp.s ++ BIND ++ vp.pres; - in case vv.whenUsed of { - VVPerf => { + ComplVV vv vp = let + -- restofVerbPres = case vp.isPresBlank of { + -- True => "a"; + -- False => vp.pres; + -- }; + vpPres = "ku" ++ BIND ++ vp.s ++ BIND ++ vp.pres; + in case of { + => { s= vv.s ++ BIND ++ vv.perf ++ vpPres; pres = [];--vv.pres; perf= []; -- vv.perf; @@ -289,9 +318,11 @@ lin adv =[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = True }; - _ => { + <_,True,True> => { s= vv.s ++ BIND ++ vv.pres ++ vpPres; pres = [];--vv.pres; perf= [];--vv.perf; @@ -307,7 +338,49 @@ lin adv =[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = True + }; + <_,True,_> => { + s= vv.s ++ BIND ++ vv.pres ++ vpPres; + pres = [];--vv.pres; + perf= [];--vv.perf; + --morphs = vv.morphs; + isPresBlank = True; + isPerfBlank = True; + comp=vp.comp ; + comp2 = []; + ap = []; + isCompApStem = False; + agr = AgrNo; + isRegular = vv.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + containsComp = True; + containsComp2 = False + }; + <_,_,_> => { + s= vv.s ++ BIND ++ vv.pres ++ vpPres; + pres = [];--vv.pres; + perf= [];--vv.perf; + --morphs = vv.morphs; + isPresBlank = True; + isPerfBlank = True; + comp=[] ; + comp2 = []; + ap = []; + isCompApStem = False; + agr = AgrNo; + isRegular = vv.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + containsComp = False; + containsComp2 = False } }; @@ -328,7 +401,9 @@ lin adv =[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = False }; {- @@ -351,7 +426,9 @@ lin adv =[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = True; + containsComp2 = False }; {- @@ -379,7 +456,9 @@ lin adv =[]; containsAdv =False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = False; + containsComp2 = False }; -- Copula alone @@ -393,7 +472,9 @@ lin adv = []; containsAdv = False; adV =[]; - containsAdV = False + containsAdV = False; + containsComp = False; + containsComp2 = False }; {- --1 The construction of verb phrases