1
0
forked from GitHub/gf-rgl

Added functionality for V3 in lexicon, rearranged the Paradigms to accomodate it. Implemented Slash2V3 and Slash3V3

This commit is contained in:
David Bamutura
2019-05-06 23:15:56 +02:00
parent 48aa65d2dd
commit c2691eda44
8 changed files with 190 additions and 42 deletions

View File

@@ -22,6 +22,8 @@ lincat
Cl, QCl = Res.Clause ; -- declarative clause, with all tenses e.g. "she looks at this"
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"
VP = Res.VerbPhrase ; -- verb phrase e.g. "is very warm"
N = Res.Noun ; -- common noun e.g. "house"
@@ -34,7 +36,7 @@ lincat
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"
V2 = Res.Verb2;
Adv = Res.Adverb;
VPSlash = Res.VPSlash;
PN = Res.ProperNoun; -- ProperNoun : Type = {s: Str ; a:Agreement ; isPlace : Bool};
@@ -43,12 +45,24 @@ lincat
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 ;
subjAgr : Res.Agreement;
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
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
} ;
--VV =
{-
--1 Cat: the Category System

View File

@@ -97,12 +97,18 @@ lin
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 ;
read_V2 = mkV2 "shom";--: V2 ;
see_V2 = mkV2 "reeb"; --: V2 ;
teach_V2 = mkV2 "shomes" ; --: V2 ; or kwegyesa
understand_V2 = mkV2 "étegyerez"; --: V2 ;
wait_V2 = mkV2 "tegyerez"; --: V2 ;
-- ditransitive verbs
add_V3 = mkV3 "gáìt";
give_V3 = mkV3 "héére" "za" "ize";
sell_V3 = mkV3 "gu" "za" "rize";
send_V3 = mkV3 "tum" ;
talk_V3 = mkV3 "gamb";
-- Intransitive verbs
@@ -123,6 +129,9 @@ lin
--today_Adv = mkAdv "erizooba" AgrNo;
{-
--Old LexiconCgg.gf
burn_V = mkV "sya" ;

View File

@@ -12,6 +12,7 @@ oper
mkV : overload {
mkV : (cry : Str) -> V ;
mkV : (cry, pres, perf :Str) -> V;
} ;
@@ -20,11 +21,40 @@ oper
= \fish,nclass -> lin N (mkNoun fish fish nclass) ;
mkN : (man,men : Str) -> Gender -> N
= \man,men,nclass -> lin N (mkNoun man men nclass) ;
};
mkV = overload {
mkV : Str -> Verb
= \root -> lin V (smartVerb root); --{s =root; pres =[]; perf = []; morphs= mkVerbMorphs; isRegular = True}; --only those verbs whose conjugation involves change of last letter and are done in the same way in both runyankore and rukiga
mkV : Str -> Str ->Str -> Verb
= \root, restPres, restPerf ->lin V (mkVerb root restPres restPerf); --{s =root; pres =restPres; perf = restPerf; morphs= mkVerbMorphs; isRegular = False};
};
mkV2 = overload {
mkV2 : Str -> Verb2 = \root ->mkV root ** {comp =[]};
mkV2 : Str -> Str ->Str -> Verb2 = \root, s1, s2 ->mkV root s1 s2 ** {comp =[]};
};
mkV3 = overload {
mkV3 : Str -> Verb3 = \root ->mkV2 root ** {comp2 =[]};
mkV3 : Str -> Str ->Str -> Verb3 = \root ,s1,s2 ->mkV2 root s1 s2 ** {comp2 =[]};
};
{-
--V2V verbs
mkV2V = overload {
mkV2V : Str -> V2V = \s -> lin V2V (dirV2 (regV s) ** {c3 = [] ; typ = VVAux}) ;
mkV2V : V -> V2V = \v -> lin V2V (dirV2 v ** {c3 = [] ; typ = VVAux}) ;
mkV2V : V -> Prep -> Prep -> V2V = \v,p,t -> lin V2V (prepV2 v p ** {c3 = t.s ; typ = VVAux}) ;
} ;
mkV : Str -> Verb = \root ->{s =root; morphs= mkVerbMorphs};
mkV2 : Str -> Verb2 = \root ->mkV root ** {comp =[]};
mkV2V : overload {
mkV2V : Str -> V2V ;
mkV2V : V -> V2V ;
mkV2V : V -> Prep -> Prep -> V2V ; -- e.g. want (noPrep NP) (to VP)
} ;
-}
--mkV = overload {
--mkV : (cry : Str) -> V
--= \cry -> lin V (mkVerb cry) ; -- what does it mean to create a lin on the fly

View File

@@ -1,6 +1,6 @@
--# -path=.:../prelude:../abstract:../common
concrete RelativeCgg of Relative = CatCgg ** open ResCgg in {
concrete RelativeCgg of Relative = CatCgg ** open Prelude, ResCgg in {
lin
{-
@@ -25,25 +25,37 @@ lin
-- a pronoun similar to "such that".
RelCl cl = {
s = "kugira ngu" ++ cl.s ;
subjAgr = cl.subjAgr;
subjAgr = AgrYes cl.subjAgr;
rp = mkRPs;
rObjVariant2 = mkRObjV2;
root = cl.root;
morphs = cl.morphs;
compl =cl.compl
compl =cl.compl;
isCompApStem = False;
agr = AgrNo
}; -- such that John loves her. why does it need any case?
-- The more proper ways are from a verb phrase
-- (formed in [``Verb`` Verb.html]) or a sentence
-- with a missing noun phrase (formed in [``Sentence`` Sentence.html]).
--RelVP : RP -> VP -> RCl ; -- who loves John
{-
RelVP rp vp ={
RelVP rp vp =
{
s = [];
subjAgr = cl.subjAgr;
root = cl.root;
morphs = cl.morphs;
compl =cl.compl
subjAgr = AgrNo;
rp = rp.s;
rObjVariant2 = rp.rObjVariant2;
root = vp.s;
morphs = vp.morphs;
compl =vp.comp;
isCompApStem = vp.isCompApStem;
agr = vp.agr
};
-}
--RelSlash : RP -> ClSlash -> RCl ; -- whom John loves
{-
--1 Relative clauses and pronouns

View File

@@ -92,6 +92,22 @@ oper
gender = g
} ;
mkVerb : Str ->Str ->Str ->Verb = \rad, end1,end2 ->{
s = rad;
pres = end1;
perf = end2;
morphs = mkVerbMorphs;
isRegular = False;
};
--These are regular verbs with {a-ire} entry in the dictionary
smartVerb : Str ->Verb = \rad ->{
s = rad;
pres = [];
perf = [];
morphs = mkVerbMorphs;
isRegular = True;
};
{- Smart paradigm
This operation needs thorough testing with all nouns from a file
-}
@@ -816,7 +832,7 @@ oper
VFormMini = VFInf | VFPres | VFPast | VFPastAnt | VFPresAnt | VFPresProg | VFPresPart |VFPastPart;
oper
--Verb : Type = {s : VFormMini => Str};
Verb : Type = {s : Str; morphs: VFormMini => VerbMorphPos=> Str};
Verb : Type = {s : Str; pres:Str; perf:Str; morphs: VFormMini => VerbMorphPos=> Str; isRegular:Bool};
GVerb : Type = {s : Bool =>Str ; morphs: VFormMini => VerbMorphPos =>Str; isAux : Bool};
{-
@@ -830,6 +846,7 @@ oper
the compPrep. Actually, it is going to be empty in the next version
-}
Verb2 : Type = Verb ** {comp:Str};
Verb3 : Type = Verb2 ** {comp2 : Str} ;
{-
Given a root, can you form the different verbforms?
-}
@@ -839,7 +856,7 @@ oper
RestOfVerb;
oper
VMorphs : Type = VFormMini => VerbMorphPos => Str;
VerbPhrase: Type = {s:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist};
VerbPhrase: Type = {s:Str; pres:Str; perf:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist; isRegular: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{
@@ -889,7 +906,7 @@ oper
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{
mkVerbMorphs:VMorphs = table{
VFInf => table{
PreVerb => "ku";
PriNegM => [];
@@ -992,6 +1009,8 @@ oper
};
--oper
--Concatenates two strings at runtime without spaces
@@ -1001,7 +1020,7 @@ oper
Numer : Type = { s: Str ; n : Number};
--VPSlash : Type = VerbPhrase ** { c : Str };
VPSlash : Type = {s:Str; morphs: VMorphs; comp: Str};
VPSlash : Type = {s:Str; pres:Str; perf:Str; morphs: VMorphs; comp: Str; comp2:Str; isRegular:Bool}; --comp is empty
{-
@@ -1010,7 +1029,7 @@ oper
-- which is the Objects, NPs PPs APs etc.
-}
Clause : Type = { -- word order is fixed in S and QS
s : Str ;
s : Str ; --subject
subjAgr : Agreement;
root : Str;
morphs : VFormMini => VerbMorphPos =>Str;

View File

@@ -83,6 +83,25 @@ PredVP np vp = case vp.isCompApStem of{
}
}
}; --: VP -> Imp ; -- walk / do not walk
--2 Clauses missing object noun phrases
-- This category is a variant of the 'slash category' $S/NP$ of
-- GPSG and categorial grammars, which in turn replaces
-- movement transformations in the formation of questions
-- and relative clauses. Except $SlashV2$, the construction
-- rules can be seen as special cases of function composition, in
-- the style of CCG.
-- *Note* the set is not complete and lacks e.g. verbs with more than 2 places.
--SlashVP : NP -> VPSlash -> ClSlash ; -- (whom) he sees
--SlashVP np vpslash =
--AdvSlash : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
--SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
--SlashVS : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
{-
--1 Sentence: Sentences, Clauses, and Imperatives

View File

@@ -90,7 +90,7 @@ with_Prep = mkPrep "na" [];
n = Sg
};
have_V2 ={s= "ine"; morphs = mkVerbMorphs; comp = []}; --: V2 ;
have_V2 ={s= "ine"; pres=[]; perf =[]; morphs = mkVerbMorphs; comp = []; isRegular=False}; --: V2 ;
{-
All Predeterminers are given here.
Initial analysis shows that

View File

@@ -4,17 +4,21 @@ concrete VerbCgg of Verb = CatCgg ** open ResCgg, Prelude in {
lin
UseV v = {s = v.s ; morphs = v.morphs; comp =[]; isCompApStem = False; agr = AgrNo}; --: V -> VP; -- sleep --ignoring object agreement
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
-- 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 = {
s = comp.s; --Assuming there is no AP which is prepositional
pres =[];
perf = [];
morphs=\\form,morphs=>[] ;
comp = [] ;
isCompApStem = False;
agr = AgrNo}; --its not generating any sentence
agr = AgrNo;
isRegular = False
}; --its not generating any sentence
-- CompAP : AP -> Comp; -- (be) small
CompAP ap = {s=ap.s};
@@ -29,20 +33,61 @@ lin
-- SlashV2a : V2 -> VPSlash ; -- love (it)
SlashV2a v2 ={
s =v2.s;
pres =v2.pres;
perf = v2.perf;
morphs = v2.morphs;
comp = []
comp = [];
comp2 =[];
isRegular =v2.isRegular
};
--Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her)
Slash2V3 v3 np ={
s =v3.s;
pres =v3.pres;
perf = v3.perf;
morphs = v3.morphs;
comp = np.s ! Acc;
comp2 =[];
isRegular = v3.isRegular
};
--Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her
Slash3V3 v3 np ={
s =v3.s;
pres =v3.pres;
perf = v3.perf;
morphs = v3.morphs;
comp = [];
comp2 = np.s ! Acc;
isRegular = v3.isRegular
};
-- ComplSlash : VPSlash -> NP -> VP ; -- love it
ComplSlash vpslash np ={
s =vpslash.s;
pres =vpslash.pres;
perf = vpslash.perf;
morphs = vpslash.morphs;
comp = vpslash.comp ++ np.s ! Acc;
comp2 =vpslash.comp2; --should be empty
isCompApStem = False;
agr = AgrYes np.agr
agr = AgrYes np.agr;
isRegular = vpslash.isRegular
};
-- AdvVP : VP -> Adv -> VP ; -- sleep here
-- 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};
AdvVP vp adv =
{
s=vp.s;
pres =vp.pres;
perf = vp.perf;
morphs = vp.morphs;
comp = adv.s;
comp2 = [];
isCompApStem = False;
agr = AgrNo;
isRegular = vp.isRegular
};