From cdc9fe307208050b3bd5779e27c8b008b866ee35 Mon Sep 17 00:00:00 2001 From: David Bamutura Date: Thu, 16 May 2019 23:23:04 +0200 Subject: [PATCH] =An error in CatCgg after implementing most of the verb functions. The error is: src/compiler/GF/Compile/GeneratePMCFG.hs:137:11-36: Irrefutable pattern failed for pattern [newCat] --- src/rukiga/CatCgg.gf | 8 +- src/rukiga/CatCggOld.gf | 223 ++++++++++++++++++++++++++++++ src/rukiga/LexiconCgg.gf | 19 ++- src/rukiga/ParadigmsCgg.gf | 9 ++ src/rukiga/ResCgg.gf | 40 +++++- src/rukiga/StructuralCgg.gf | 9 ++ src/rukiga/VerbCgg.gf | 264 ++++++++++++++++++++++++++++++++++-- 7 files changed, 547 insertions(+), 25 deletions(-) create mode 100644 src/rukiga/CatCggOld.gf diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index 2f609d0c1..03254861b 100755 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -22,7 +22,7 @@ lincat 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" + V,VS, VQ, VA = 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" VP = Res.VerbPhrase ; -- verb phrase e.g. "is very warm" @@ -75,12 +75,14 @@ lincat N2 = Res.Noun ** {c2 : Res.Agreement =>Str}; -- relational noun e.g. "son" Prep = Res.Preposition; -- preposition, or just case e.g. "in" N3 = N2 ** {c3 : Res.Agreement =>Str}; - --VV = + VV = Res.Verb ** {inf:Str; whenUsed: Res.VVMood}; --inf is the other verb linref 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; + VP =\vp -> vp.adv ++ vp.s ++ BIND ++ vp.pres ++ vp.comp ++vp.comp2; + VPSlash =\vpslash -> vpslash.s ++ BIND ++ vpslash.pres; + {- --1 Cat: the Category System diff --git a/src/rukiga/CatCggOld.gf b/src/rukiga/CatCggOld.gf new file mode 100644 index 000000000..03254861b --- /dev/null +++ b/src/rukiga/CatCggOld.gf @@ -0,0 +1,223 @@ +--# -path=.:../prelude:../abstract:../common + +concrete CatCgg of Cat = CommonX -[Adv,IAdv]** + open (Res=ResCgg), Prelude, (Px=ParamX), Predef 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 + + S = SS ; -- declarative sentence e.g. "she lived here" + 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,VS, VQ, VA = 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" + VP = Res.VerbPhrase ; -- verb phrase e.g. "is very warm" + + N = Res.Noun ; -- common noun e.g. "house" + CN = Res.Noun ; -- common noun (without determiner) e.g. "red house" + NP = Res.NounPhrase; -- noun phrase (subject or object) e.g. "the red house" + Pron = Res.Pronoun ; -- personal pronoun e.g. "she" + Det = Res.Determiner ; -- determiner phrase e.g. "those seven" + Quant = {s : Res.Pronoun; s2 :Res.Agreement => Str; doesAgree : Bool; isPron: Bool} ; -- quantifier ('nucleus' of Det) e.g. "this/these" + Num = Res.Numer ; -- number determining element e.g. "seven" + AP = {s : Str ; position1 : Res.Position1; isProper : Bool; isPrep: Bool};--Res.AdjectivalPhrase; + A = Res.Adjective; + Comp = Res.Comp; -- complement of copula, such as AP e.g. "very warm" + + Adv = Res.Adverb; --Verb Phrase modifying 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" + RP = {s : Res.RCase => Res.Agreement => Str ; rObjVariant2: Res.Agreement => Str} ; + RCl ={ + s : Str ; --subject + rp: Res.RCase => Res.Agreement => Str; + rObjVariant2: Res.Agreement => Str; + subjAgr : Res.AgrExist; + root : Str; + morphs : Res.VFormMini => Res.VerbMorphPos =>Str; + compl : Str; -- after verb: complement, adverbs + agr : Res.AgrExist + } ; + --VPSlash ={s:Str; morphs: VMorphs}; --VPSlash ; -- verb phrase missing complement e.g. "give to John" + --ClSlash;-- clause missing NP (S/NP in GPSG) e.g. "she looks at" + ClSlash = { + s : Str ; --subject + subjAgr : Res.Agreement; + root : Str; + morphs : Res.VFormMini => Res.VerbMorphPos =>Str --; compl : Str -- after verb: complement, adverbs + } ; + Numeral = {s : Res.CardOrd=>Res.Agreement=> Str ; g : Res.Gender; n: Res.Number} ; + 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 ; other:Str; n : Res.Number; isVerbSuffix: Bool; requiresIPPrefix: Bool; aux:Str; endOfSentence:Bool}; -- other holds the Idet without a prefix + IAdv = {s : Str ; requiresSubjPrefix: Bool}; + IDet = {s : Str ; n : Res.Number; requiresSubjPrefix: Bool}; + IQuant = {s : Res.Number =>Str ; requiresSubjPrefix: Bool}; + DAP = Res.Determiner ; + N2 = Res.Noun ** {c2 : Res.Agreement =>Str}; -- relational noun e.g. "son" + Prep = Res.Preposition; -- preposition, or just case e.g. "in" + N3 = N2 ** {c3 : Res.Agreement =>Str}; + VV = Res.Verb ** {inf:Str; whenUsed: Res.VVMood}; --inf is the other verb + +linref + 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.adv ++ vp.s ++ BIND ++ vp.pres ++ vp.comp ++vp.comp2; + VPSlash =\vpslash -> vpslash.s ++ BIND ++ vpslash.pres; + +{- +--1 Cat: the Category System + +-- The category system is central to the library in the sense +-- that the other modules ($Adjective$, $Adverb$, $Noun$, $Verb$ etc) +-- communicate through it. This means that a e.g. a function using +-- $NP$s in $Verb$ need not know how $NP$s are constructed in $Noun$: +-- it is enough that both $Verb$ and $Noun$ use the same type $NP$, +-- which is given here in $Cat$. +-- +-- Some categories are inherited from [``Common`` Common.html]. +-- The reason they are defined there is that they have the same +-- implementation in all languages in the resource (typically, +-- just a string). These categories are +-- $AdA, AdN, AdV, Adv, Ant, CAdv, IAdv, PConj, Phr$, +-- $Pol, SC, Tense, Text, Utt, Voc, Interj$. +-- +-- Moreover, the list categories $ListAdv, ListAP, ListNP, ListS$ +-- are defined on $Conjunction$ and only used locally there. + + +abstract Cat = Common ** { + + cat + +--2 Sentences and clauses + +-- Constructed in [Sentence Sentence.html], and also in +-- [Idiom Idiom.html]. + + S ; -- declarative sentence e.g. "she lived here" + QS ; -- question e.g. "where did she live" + RS ; -- relative e.g. "in which she lived" + Cl ; -- declarative clause, with all tenses e.g. "she looks at this" + ClSlash;-- clause missing NP (S/NP in GPSG) e.g. "she looks at" + SSlash ;-- sentence missing NP e.g. "she has looked at" + Imp ; -- imperative e.g. "look at this" + +--2 Questions and interrogatives + +-- Constructed in [Question Question.html]. + + QCl ; -- question clause, with all tenses e.g. "why does she walk" + IP ; -- interrogative pronoun e.g. "who" + IComp ; -- interrogative complement of copula e.g. "where" + IDet ; -- interrogative determiner e.g. "how many" + IQuant; -- interrogative quantifier e.g. "which" + +--2 Relative clauses and pronouns + +-- Constructed in [Relative Relative.html]. + + RCl ; -- relative clause, with all tenses e.g. "in which she lives" + RP ; -- relative pronoun e.g. "in which" + +--2 Verb phrases + +-- Constructed in [Verb Verb.html]. + + VP ; -- verb phrase e.g. "is very warm" + Comp ; -- complement of copula, such as AP e.g. "very warm" + VPSlash ; -- verb phrase missing complement e.g. "give to John" + +--2 Adjectival phrases + +-- Constructed in [Adjective Adjective.html]. + + AP ; -- adjectival phrase e.g. "very warm" + +--2 Nouns and noun phrases + +-- Constructed in [Noun Noun.html]. +-- Many atomic noun phrases e.g. "everybody" +-- are constructed in [Structural Structural.html]. +-- The determiner structure is +-- ``` Predet (QuantSg | QuantPl Num) Ord +-- as defined in [Noun Noun.html]. + + CN ; -- common noun (without determiner) e.g. "red house" + NP ; -- noun phrase (subject or object) e.g. "the red house" + Pron ; -- personal pronoun e.g. "she" + Det ; -- determiner phrase e.g. "those seven" + Predet ; -- predeterminer (prefixed Quant) e.g. "all" + Quant ; -- quantifier ('nucleus' of Det) e.g. "this/these" + Num ; -- number determining element e.g. "seven" + Card ; -- cardinal number e.g. "seven" + ACard ; -- adjective like cardinal e.g. "few", "many" + Ord ; -- ordinal number (used in Det) e.g. "seventh" + DAP ; -- determiner with adjective e.g. "three small" + +--2 Numerals + +-- Constructed in [Numeral Numeral.html]. + + Numeral ; -- cardinal or ordinal in words e.g. "five/fifth" + Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th" + +--2 Structural words + +-- Constructed in [Structural Structural.html]. + + Conj ; -- conjunction e.g. "and" +---b DConj ; -- distributed conjunction e.g. "both - and" + Subj ; -- subjunction e.g. "if" + Prep ; -- preposition, or just case e.g. "in" + +--2 Words of open classes + +-- These are constructed in [Lexicon Lexicon.html] and in +-- additional lexicon modules. + + V ; -- one-place verb e.g. "sleep" + V2 ; -- two-place verb e.g. "love" + V3 ; -- three-place verb e.g. "show" + VV ; -- verb-phrase-complement verb e.g. "want" + VS ; -- sentence-complement verb e.g. "claim" + VQ ; -- question-complement verb e.g. "wonder" + VA ; -- adjective-complement verb e.g. "look" + V2V ; -- verb with NP and V complement e.g. "cause" + V2S ; -- verb with NP and S complement e.g. "tell" + V2Q ; -- verb with NP and Q complement e.g. "ask" + V2A ; -- verb with NP and AP complement e.g. "paint" + + A ; -- one-place adjective e.g. "warm" + A2 ; -- two-place adjective e.g. "divisible" + + N ; -- common noun e.g. "house" + N2 ; -- relational noun e.g. "son" + N3 ; -- three-place relational noun e.g. "connection" + PN ; -- proper name e.g. "Paris" + +-- DEPRECATED: QuantSg, QuantPl +--- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every" +--- QuantPl ;-- quantifier ('nucleus' of plur. Det) e.g. "many" + +-} + +} diff --git a/src/rukiga/LexiconCgg.gf b/src/rukiga/LexiconCgg.gf index d2a2056aa..dda3c50ee 100755 --- a/src/rukiga/LexiconCgg.gf +++ b/src/rukiga/LexiconCgg.gf @@ -123,6 +123,20 @@ lin travel_V = mkV "gyend";--: V ; walk_V = mkV "ribá" "ta" "si"; --: V ; or kuribata Runynakore it is different + -- A verb whose complement is a sentence + fear_VS = mkVS (lin V (mkV "tin")); --: VS ; + hope_VS = mkVS (lin V (mkV "siga")); --: VS ; -- a bit complicated because what we normally use is nyine amatsiko i.e usin the noun. The verb should be kwesiga but this seems borrowed from Luganda + know_VS = mkVS (lin V (mkV "manya")); --: VS ; + say_VS = mkVS (lin V (mkV "gi" "ra" "zire"));--: VS ; + + -- verbs whose complements are questions + know_VQ = mkVQ (lin V (mkV "many")); --: VQ ; + --wonder_VQ : VQ ; + + -- Verb whose complement is an adjective + become_VA = mkVA (lin V mkBecome);--: VA ; + + --Verbs that have a noun Phrase complement and a verb phrase complement (V2V) --beg_V2V : V2V ; --Adverbs @@ -131,9 +145,10 @@ lin --today_Adv = mkAdv "erizooba" AgrNo; - father_N2 = mkN2 (mkN "tata" MU_BA) (mkPrep [] [] True) ; + father_N2 = mkN2 (mkN "tata" MU_BA) (lin Prep (mkPrep [] [] True)) ; - distance_N3 = mkN3 (mkN "orugyendo" ZERO_BU) (mkPrep "kurunga" "" False) (mkPrep "mpáka" "" False); --could orugyendo work in its place? + distance_N3 = mkN3 (mkN "orugyendo" ZERO_BU) (lin Prep (mkPrep "kurunga" "" False)) (lin Prep (mkPrep "mpáka" "" False)); --could orugyendo work in its place? + oper diff --git a/src/rukiga/ParadigmsCgg.gf b/src/rukiga/ParadigmsCgg.gf index 39d2a425f..ffccce250 100755 --- a/src/rukiga/ParadigmsCgg.gf +++ b/src/rukiga/ParadigmsCgg.gf @@ -74,6 +74,15 @@ oper => n ** {c2 =\\_=> p.s ; c3 = mkGenPrepWithIVClitic; lock_N2 = <>;lock_N3 = <>} ; => n ** {c2 = mkGenPrepWithIVClitic; c3 = mkGenPrepWithIVClitic; lock_N2 = <>; lock_N3 = <>} }; + + mkVS : V -> VS ; -- sentence-compl e.g. say (that S) + mkVS v = lin VS v ; + mkVQ : V -> VQ ; -- e.g. wonder (QS) + mkVQ v = lin VQ v ; + + mkVA : V -> VA ; -- e.g. become (AP) + mkVA v = lin VA v ; + {- prepV2 v p = lin V2 {s = v.s ; p = v.p ; c2 = p.s ; isRefl = v.isRefl} ; dirV2 v = prepV2 v noPrep ; diff --git a/src/rukiga/ResCgg.gf b/src/rukiga/ResCgg.gf index adc38dddb..70212f982 100755 --- a/src/rukiga/ResCgg.gf +++ b/src/rukiga/ResCgg.gf @@ -64,7 +64,7 @@ param -} NounState = Complete | Incomplete ; - +VVMood = VVImp | VVPerf | VVBoth; @@ -1109,7 +1109,22 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of { RestOfVerb; oper VMorphs : Type = VFormMini => VerbMorphPos => Str; - VerbPhrase: Type = {s:Str; pres:Str; perf:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist; isRegular:Bool}; + VerbPhrase: Type = { + s:Str; + pres:Str; + perf:Str; + morphs: VMorphs ; + isRegular:Bool; + comp:Str ; + comp2:Str; + ap : Str; + isCompApStem : Bool; + agr : AgrExist; + adv:Str; + containsAdv: Bool; + adV:Str; + containsAdv:Bool + }; -- 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{ @@ -1129,12 +1144,12 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of { be_GVerb : GVerb = { s= table{True => "ri"; False =>"b" }; morphs = \\form, morphs =>[]; - - isAux = True}; - + + mkBecome : Verb ={ + s = "b" ; pres="a"; perf="ire"; morphs= mkVerbMorphs; isRegular=False}; --be1_Verb: Verb = {s="b"; pres = "e"; perf="a"; morphs = mkVerbMorphs}; @@ -1283,7 +1298,20 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of { Numer : Type = { s: Agreement => Str ; n : Number}; --VPSlash : Type = VerbPhrase ** { c : Str }; - VPSlash : Type = {s:Str; pres:Str; perf:Str; morphs: VMorphs; comp: Str; comp2:Str; isRegular:Bool}; --comp is empty + VPSlash : Type = { + s:Str; + pres:Str; + perf:Str; + morphs: VMorphs; + comp: Str; + comp2:Str; + ap:Str; + isRegular:Bool; + adv:Str; + containsAdv:Bool; + adV:Str; + containsAdV:Bool + }; --comp is empty {- diff --git a/src/rukiga/StructuralCgg.gf b/src/rukiga/StructuralCgg.gf index 2f975b8c4..5c543b8db 100755 --- a/src/rukiga/StructuralCgg.gf +++ b/src/rukiga/StructuralCgg.gf @@ -199,9 +199,18 @@ lin pos = PreDeterminer; doesAgree = True };--: Det ; + + want_VV = {s = "yend"; pres="da"; perf = "zire"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth}; + can8know_VV = {s = "baas"; pres="a"; perf = "ize"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (capacity) + can_VV = {s = "baas"; pres="a"; perf = "ize"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (possibility) + -- must_VV used especially in the perfective mood: see dictionary entry shemerera on Pg 501 of Mpairwe + -- must has no passive form + must_VV = {s = "shemere"; pres="ra"; perf = "ire"; morphs=mkVerbMorphs; isRegular=False; inf=[]; whenUsed = VVPerf}; --VV --somebody_NP = {}; --: NP ; --something_NP : NP ; --somewhere_Adv : Adv ; + +that_Subj = ss "that" ; {- --1 Structural: Structural Words -- diff --git a/src/rukiga/VerbCgg.gf b/src/rukiga/VerbCgg.gf index f0bf4a0b4..e3b57279d 100755 --- a/src/rukiga/VerbCgg.gf +++ b/src/rukiga/VerbCgg.gf @@ -4,20 +4,40 @@ concrete VerbCgg of Verb = CatCgg ** open ResCgg, Prelude in { lin - UseV v = {s = v.s ; pres =v.pres; perf = v.perf; morphs = v.morphs; comp =[]; isCompApStem = False; agr = AgrNo; isRegular = v.isRegular}; --: V -> VP; -- sleep --ignoring object agreement + UseV v = { + s = v.s ; + pres =v.pres; + perf = v.perf; + morphs = v.morphs; + comp =[]; + comp2 = []; + ap =[]; + isCompApStem = False; + agr = AgrNo; + isRegular = v.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + }; --: V -> VP; -- sleep --ignoring object agreement --- UseComp : Comp -> VP ; -- be warm means complement of a copula especially adjectival Phrase ---VerbPhrase: Type ={s:Agr=>Polarity=>Tense=>Anteriority=>Str}; - --AdjectivalPhrase : Type = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool}; + -- UseComp : Comp -> VP ; -- be warm means complement of a copula especially adjectival Phrase + --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 pres =[]; perf = []; - morphs=\\form,morphs=>[] ; - comp = [] ; + morphs=\\form,morphs=>[]; + comp = []; + comp2 = []; + ap = []; isCompApStem = False; agr = AgrNo; - isRegular = False + isRegular = False; + adv = []; + containsAdv =False; + adV =[]; + containsAdV = False; }; --its not generating any sentence -- CompAP : AP -> Comp; -- (be) small @@ -29,7 +49,8 @@ lin -- CompAdv : Adv -> Comp ; -- (be) here CompAdv adv =adv; - + --CompCN : CN -> Comp ; -- (be) a man/men + CompCN cn = ; -- (be) a man/men -- SlashV2a : V2 -> VPSlash ; -- love (it) SlashV2a v2 ={ s =v2.s; @@ -38,7 +59,12 @@ lin morphs = v2.morphs; comp = []; comp2 =[]; - isRegular =v2.isRegular + ap =[]; + isRegular =v2.isRegular; + adv=[]; + containsAdv =False; + adV =[]; + containsAdV = False; }; --Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her) Slash2V3 v3 np ={ @@ -48,7 +74,12 @@ lin morphs = v3.morphs; comp = np.s ! Acc; comp2 =[]; - isRegular = v3.isRegular + ap =[]; + isRegular = v3.isRegular; + adv = []; + containsAdv =False; + adV =[]; + containsAdV = False; }; --Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her @@ -59,7 +90,27 @@ lin morphs = v3.morphs; comp = []; comp2 = np.s ! Acc; - isRegular = v3.isRegular + ap = []; + isRegular = v3.isRegular; + adv = []; + containsAdv =False; + adV =[]; + containsAdV = False; + }; + --SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy + SlashVV vv vpslash ={ + s =vv.s; + pres =vv.pres; + perf = vv.perf; + morphs = vv.morphs; + comp = vpslash.s ++ BIND ++ vpslash.pres; + comp2 = []; + ap = []; + isRegular = vv.isRegular; + adv = []; + containsAdv = False; + adV =[]; + containsAdV = False; }; --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go @@ -74,9 +125,14 @@ lin morphs = vpslash.morphs; comp = vpslash.comp ++ np.s ! Acc; comp2 =vpslash.comp2; --should be empty + ap = []; isCompApStem = False; agr = AgrYes np.agr; - isRegular = vpslash.isRegular + isRegular = vpslash.isRegular; + adv = []; + containsAdv =False; + adV =[]; + containsAdV = False; }; -- AdvVP : VP -> Adv -> VP ; -- sleep here -- VerbPhrase: Type = {s:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist}; @@ -87,15 +143,195 @@ lin perf = vp.perf; morphs = vp.morphs; comp = adv.s; - comp2 = []; + comp2 = []; + ap =[]; isCompApStem = False; agr = AgrNo; - isRegular = vp.isRegular + isRegular = vp.isRegular; + adv = []; + containsAdv =True; + adV =[]; + containsAdV = False; }; + -- AdVVP : AdV -> VP -> VP ; -- always sleep + AdVVP adv vp = { + s=vp.s; + pres =vp.pres; + perf = vp.perf; + morphs = vp.morphs; + comp = []; + comp2 =[]; + ap = []; + isCompApStem = False; + agr = AgrNo; + isRegular = vp.isRegular; + adv = adv.s; + containsAdv =True; + adV =[]; + containsAdV = False; + }; + --AdvVPSlash : VPSlash -> Adv -> VPSlash ; -- use (it) here + {- + FUTURE: + The problem here could rise from the agreement if the adverb agrees. + We could change the type of adv to be Agreement => Str such that we have NONE. + -} + AdvVPSlash vpslash adv ={ + s =vpslash.s; + pres =vpslash.pres; + perf = vpslash.perf; + morphs = vpslash.morphs; + comp = []; + comp2 = np.s ! Acc; + ap = []; + isRegular = v3.isRegular; + adv = adv.s; + containsAdv =True; + adV =[]; + containsAdV = False; + }; + -- Adverb directly attached to verb + --AdVVPSlash : AdV -> VPSlash -> VPSlash ; -- always use (it) + {- NOTE: + This is a hack mainly because we need a separate field for AdV type + -} + AdVVPSlash adV vpslash ={ + s =vpslash.s; + pres =vpslash.pres; + perf = vpslash.perf; + morphs = vpslash.morphs; + comp = adV.s; + comp2 = np.s ! Acc; + ap = []; + isRegular = v3.isRegular; + adv = []; + containsAdv =False; + adV =[]; + containsAdV = False; + }; + -- Verb phrases are constructed from verbs by providing their + -- complements. There is one rule for each verb category. + {- NOTE: This is a hack + --ComplVV : VV -> VP -> VP ; -- want to run + --This function requires the remodelling of VP to accomodate two Verbs. + -- + -} + ComplVV vv vp = let vpPres = vp.s ++ BIND ++ vp.pres; + in case vv.whenUsed of { + VVPerf => { + s= vv.s ++ BIND ++ vv.perf ++ vpPres; + pres =vv.pres; perf=vv.perf; + morphs = vv.morphs; + comp=vp.comp ; + comp2 = vp.comp2; + ap = []; + isCompApStem = False; agr = AgrNo; + isRegular = vv.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + }; + _ => { + s= vv.s ++ BIND ++ vv.pres ++ vpPres; + pres =vv.pres; + perf=vv.perf; + morphs = vv.morphs; + comp=vp.comp ; + comp2 = vp.comp2; + ap = []; + isCompApStem = False; + agr = AgrNo; + isRegular = vv.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + } + }; + + --ComplVS : VS -> S -> VP ; -- say that she runs + ComplVS vs s = { + s= vs.s; + pres =vs.pres; + perf=vs.perf; + morphs = vs.morphs; + comp=s.s ; + comp2 = []; + ap = []; + isCompApStem = False; + agr = AgrNo; + isRegular = vs.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + }; + + {- + This function may need revision as I have not met such kinds of questions + -} + --ComplVQ : VQ -> QS -> VP ; -- wonder who runs + ComplVQ vq qs = { + s= vq.s; + pres =vq.pres; + perf=vq.perf; + morphs = vq.morphs; + comp=qs.s ; + comp2 = []; + ap = []; + isCompApStem = False; + agr = AgrNo; + isRegular = vq.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + }; + + {- + The adgectival Phrase is comlicated here. + + The VP has to accomodate the whole structure of the Adjectival Phrase + + For the timebeing, we can use the isCompApStem field but we need a separate field + -} + --ComplVA : VA -> AP -> VP ; -- they become red + --AP = {s : Str ; position1 : Res.Position1; isProper : Bool; isPrep: Bool};--Res.AdjectivalPhrase; + ComplVA va ap = { + s= va.s; + pres =va.pres; + perf=va.perf; + morphs = va.morphs; + comp=ap.s ; + comp2 = []; + ap =[]; + isCompApStem = False; + agr = AgrNo; + isRegular = va.isRegular; + adv =[]; + containsAdv =False; + adV =[]; + containsAdV = False; + }; + + -- Copula alone + --UseCopula : VP ; -- be + UseCopula = mkBecome ** { + comp=[]; + comp2 = []; + ap = []; + isCompApStem = False; + agr = AgrNo; + adv = []; + containsAdv = False; + adV =[]; + containsAdV = False; + }; {- --1 The construction of verb phrases