(Pes) WIP more on tense in VV complements

This commit is contained in:
Inari Listenmaa
2019-02-28 17:18:01 +01:00
parent 6bc2b3506c
commit 7237755609
5 changed files with 71 additions and 78 deletions

View File

@@ -15,13 +15,13 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
Cl = ResPes.Clause ; Cl = ResPes.Clause ;
ClSlash = { ClSlash = {
subj : Str ; subj : Str ;
vp : ResPes.VPHTense => Polarity => Order => Str ; vp : ResPes.TAnt => Polarity => Order => Str ;
c2 : ResPes.Compl c2 : ResPes.Compl
} ; } ;
Imp = {s : Polarity => ImpForm => Str} ; Imp = {s : Polarity => ImpForm => Str} ;
---- Question ---- Question
QCl = {s : ResPes.VPHTense => Polarity => QForm => Str} ; QCl = {s : ResPes.TAnt => Polarity => QForm => Str} ;
IP = {s: Str ; n : Number}; IP = {s: Str ; n : Number};
@@ -32,7 +32,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
---- Relative ---- Relative
RCl = { RCl = {
s : ResPes.VPHTense => Polarity => Order => Agr => Str ; s : ResPes.TAnt => Polarity => Order => Agr => Str ;
-- c : Case -- c : Case
} ; } ;
RP = {s: Str ; a:RAgr}; RP = {s: Str ; a:RAgr};

View File

@@ -57,9 +57,16 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
----------------------- -----------------------
param param
VVForm = Indic | Subj ; VVForm = Indic | Subj ;
VVTense = VVPres | VVPerf | VVPast ; -- VVPast Anteriority ???
oper oper
-- TODO: all forms
ta2vvt : TAnt -> VVTense = \ta -> case ta of {
TA Pres Anter => VVPerf ;
TA Past _ => VVPast ;
_ => VVPres } ;
VV : Type = Verb ** { VV : Type = Verb ** {
isAux : Bool ; isAux : Bool ;
compl : VVForm ; -- indicative or subjunctive compl : VVForm ; -- indicative or subjunctive
@@ -67,21 +74,22 @@ oper
} ; } ;
VPH : Type = Verb ** { VPH : Type = Verb ** {
comp : Agr => Str; -- complements of a verb, agr for e.g. CompCN "I am human/we are humans" comp : Agr => Str; -- complements of a verb, agr for ReflVP "I/you see myself/yourself" and CompCN "I am human/we are humans"
vComp : Agr => Anteriority => Str; -- when a verb is used as a complement of an auxiliary verb. Unlike comp or obj, this type of complement follows the auxiliary verb. vComp : Agr => VVTense => Str; -- when a verb is used as a complement of an auxiliary verb. Unlike comp or obj, this type of complement follows the auxiliary verb.
obj : Str ; -- object of a verb; so far only used for A ("paint it black") obj : Str ; -- object of a verb; so far only used for A ("paint it black")
subj : VType ; subj : VType ;
ad : Str ; ad : Str ;
embComp : Str ; -- when a declarative or interrogative sentence is used as a complement of a verb. embComp : Str ; -- when a declarative or interrogative sentence is used as a complement of a verb.
defVV : Bool ; -- whether a defective VV has been added isVV : Bool ; -- whether a VV has been added
isDef : Bool ; -- whether a the VV is defective
} ; } ;
showVPH = overload { showVPH = overload {
showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' Simul ; showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' VVPres ;
showVPH : Anteriority -> VerbForm -> Agr -> VPH -> Str = showVPH' showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH'
} ; } ;
showVPH' : Anteriority -> VerbForm -> Agr -> VPH -> Str = showVPH' : VVTense -> VerbForm -> Agr -> VPH -> Str =
\ant,vf,agr,vp -> vp.ad ++ vp.comp ! agr ++ vp.obj \ant,vf,agr,vp -> vp.ad ++ vp.comp ! agr ++ vp.obj
++ vp.prefix ++ vp.s ! vf ++ vp.prefix ++ vp.s ! vf
++ vp.vComp ! agr ! ant ++ vp.embComp ; ++ vp.vComp ! agr ! ant ++ vp.embComp ;
@@ -91,14 +99,9 @@ oper
VPHSlash : Type = VPH ** {c2 : Compl} ; VPHSlash : Type = VPH ** {c2 : Compl} ;
param param
TAnt = TA Tense Anteriority ;
VPHTense = VType = VIntrans | VTrans | VTransPost ; -- TODO: find out if needed
TA Tense Anteriority
| VVVForm -- AR 21/3/2018 for mustCl after Nasrin
| VRoot1 -- AR 22/3/2018 for mustCl past after Nasrin
;
VType = VIntrans | VTrans | VTransPost ;
oper oper
@@ -107,15 +110,13 @@ oper
ad, ad,
obj, obj,
embComp = []; embComp = [];
defVV = False ; isDef,isVV = False ;
comp = \\_ => [] ; comp = \\_ => [] ;
vComp = \\_,_ => [] } ; vComp = \\_,_ => [] } ;
predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb -> predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb ->
predV verb ** {c2 = {s = verb.c1 ; ra = []} } ; predV verb ** {c2 = {s = verb.c1 ; ra = []} } ;
--------------------- ---------------------
-- VP complementation -- VP complementation
--------------------- ---------------------
@@ -130,10 +131,10 @@ oper
comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a
} ; } ;
insertVV : Bool -> (Agr => Anteriority => Str) -> VPH -> VPH = insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** {
\isDef,infcl,vp -> vp ** { vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ;
defVV = True; --isDef ; isVV = True ;
vComp = \\agr,ant => vp.vComp ! agr ! ant ++ infcl ! agr ! ant ; isDef = vv.isDef ;
} ; } ;
embComp : Str -> VPH -> VPH = \str,vp -> vp ** { embComp : Str -> VPH -> VPH = \str,vp -> vp ** {
@@ -150,14 +151,20 @@ oper
---- AR 14/9/2017 trying to fix isAux = True case by inserting conjThat ---- AR 14/9/2017 trying to fix isAux = True case by inserting conjThat
---- but don't know yet how False should be affect ---- but don't know yet how False should be affect
infVV : VV -> VPH -> (Agr => Anteriority => Str) = \vv,vp -> complVV : VV -> VPH -> (Agr => VVTense => Str) = \vv,vp ->
\\agr,ant => if_then_Str vv.isAux conjThat [] ++ \\agr,ant => if_then_Str vv.isAux conjThat [] ++
case <ant,vv.compl> of { case <ant,vv.compl,vv.isDef> of {
<_Simul,Subj> => showVPH (VSubj Pos agr) agr vp ; -- Auxiliaries with full inflection: complement in subjunctive
<_Simul,Indic> => showVPH (VAor Pos agr) agr vp <_,_,False> => showVPH (VSubj Pos agr) agr vp ; --
-- TODO: confirm <Anter,_> => showVPH PerfStem agr vp ++ subjAux Pos agr
} ;
-- Auxiliaries with defective inflection: complement inflects in tense
<VVPres,Subj,True> => showVPH (VSubj Pos agr) agr vp ;
<VVPres,Indic,True> => showVPH (VAor Pos agr) agr vp ;
<VVPast,_,True> => showVPH (VPast Pos agr) agr vp ;
-- <VVPast Anter> => showVPH PerfStem agr vp ++ pluperfAux Pos agr ; -- TODO do we need this?
<VVPerf,_,True> => showVPH PerfStem agr vp ++ subjAux Pos agr ;
_ => showVPH (VSubj Pos agr) agr vp ---- TODO more forms ?
} ;
insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** { insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** {
ad = vp.ad ++ ad ; ad = vp.ad ++ ad ;
@@ -168,37 +175,35 @@ oper
--------------------------- ---------------------------
--- Clauses --- Clauses
--------------------------- ---------------------------
Clause : Type = {s : VPHTense => Polarity => Order => Str} ; Clause : Type = {s : TAnt => Polarity => Order => Str} ;
SlClause : Type = {quest : Order => Str ; subj : Str ; vp : VPHTense => Polarity => Order => Str} ; SlClause : Type = {quest : Order => Str ; subj : Str ; vp : TAnt => Polarity => Order => Str} ;
---- AR 18/9/2017 intermediate SClause to preserve SOV in e.g. QuestionPes.QuestSlash ---- AR 18/9/2017 intermediate SClause to preserve SOV in e.g. QuestionPes.QuestSlash
clTable : VPH -> (Agr => VPHTense => Polarity => Str) = \vp -> -- TODO: check the VV forms with defective verbs
clTable : VPH -> (Agr => TAnt => Polarity => Str) = \vp ->
\\agr,vt,pol => vp.prefix ++ case vt of { \\agr,vt,pol => vp.prefix ++ case vt of {
TA Pres Simul => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; -- for reg. verbs, VAor pol is invariant and negation comes in ImpPrefix. TA Pres Simul => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; -- for reg. verbs, VAor pol is invariant and negation comes in ImpPrefix.
TA Pres Anter => vp.s ! VPerf pol agr ; TA Pres Anter => vp.s ! VPerf pol agr ;
TA Past Simul => vp.s ! VPast pol agr ; TA Past Simul => vp.s ! VPast pol agr ;
TA Past Anter => TA Past Anter =>
case vp.defVV of { case vp.isDef of {
True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ;
False => vp.s ! PerfStem ++ pluperfAux pol agr } ; False => vp.s ! PerfStem ++ pluperfAux pol agr } ;
TA Fut Simul => TA Fut Simul =>
case vp.defVV of { case vp.isDef of {
True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ;
False => futAux pol agr ++ vp.s ! PastStem False => futAux pol agr ++ vp.s ! PastStem
} ; -- PastStem is, despite the name, used for future too. /IL } ; -- PastStem is, despite the name, used for future too. /IL
TA Fut Anter => TA Fut Anter =>
case vp.defVV of { case vp.isDef of {
True => vp.s ! VPerf pol agr ; True => vp.s ! VPerf pol agr ;
False => "خواسته" ++ pluperfAux pol agr ++ vp.s ! PastStem False => "خواسته" ++ pluperfAux pol agr ++ vp.s ! PastStem
} ; -- verb form need to be confirmed } ; -- verb form need to be confirmed
TA Cond Simul => vp.s ! VSubj pol agr ; TA Cond Simul => vp.s ! VSubj pol agr ;
TA Cond Anter => TA Cond Anter =>
case vp.defVV of { case vp.isDef of {
True => vp.s ! VSubj pol agr ; True => vp.s ! VSubj pol agr ;
False => vp.s ! PerfStem ++ subjAux pol agr } ; -- verb form to be confirmed False => vp.s ! PerfStem ++ subjAux pol agr } -- verb form to be confirmed
VVVForm => vp.s ! VSubj Pos agr ; -- AR 21/3/2018
VRoot1 => vp.s ! PastStem -- AR 22/3/2018
} ; } ;
mkClause : NP -> VPH -> Clause = \np,vp -> mkClause : NP -> VPH -> Clause = \np,vp ->
@@ -210,25 +215,21 @@ oper
{ ODir => []; { ODir => [];
OQuest => "آیا" } ; OQuest => "آیا" } ;
subj = np.s ! Bare ; subj = np.s ! Bare ;
vp = \\vt,b,ord => vp = \\ta,p,ord =>
let vps = clTable vp ! np.a ! vt ! b ; let vps = clTable vp ! np.a ! ta ! p ;
ant = case vp.defVV of { vvt = ta2vvt ta ;
True => case vt of {TA Pres _ => Simul ; TA _ a => Anter ; _ => Simul} ;
False => Simul }
in vp.ad ++ vp.comp ! np.a ++ vp.obj ++ vps in vp.ad ++ vp.comp ! np.a ++ vp.obj ++ vps
++ vp.vComp ! np.a ! ant ++ vp.embComp ++ vp.vComp ! np.a ! vvt ++ vp.embComp
}; };
--Clause : Type = {s : VPHTense => Polarity => Order => Str} ; --Clause : Type = {s : TAnt => Polarity => Order => Str} ;
mkSClause : Str -> Agr -> VPH -> Clause = \subj,agr,vp -> { mkSClause : Str -> Agr -> VPH -> Clause = \subj,agr,vp -> {
s = \\vt,b,ord => s = \\ta,p,ord =>
let vps = clTable vp ! agr ! vt ! b ; let vps = clTable vp ! agr ! ta ! p ;
quest = case ord of { ODir => [] ; OQuest => "آیا" } ; quest = case ord of { ODir => [] ; OQuest => "آیا" } ;
ant = case vp.defVV of { vvt = ta2vvt ta ;
True => case vt of {TA Pres _ => Simul ; TA _ a => Anter ; _ => Simul} ;
False => Simul }
in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj
++ vps ++ vp.vComp ! agr ! ant ++ vp.embComp ++ vps ++ vp.vComp ! agr ! vvt ++ vp.embComp
}; };
predProg : VPH -> VPH = \verb -> verb ** { predProg : VPH -> VPH = \verb -> verb ** {
@@ -236,10 +237,7 @@ oper
ImpPrefix _ => [] ; ImpPrefix _ => [] ;
VAor p a => haveVerb.s ! VAor Pos a ++ verb.s ! ImpPrefix p ++ verb.s ! VAor Pos a ; VAor p a => haveVerb.s ! VAor Pos a ++ verb.s ! ImpPrefix p ++ verb.s ! VAor Pos a ;
VPast p a => haveVerb.s ! VPast Pos a ++ verb.s ! ImpPrefix p ++ verb.s ! VPast Pos a ; -- negation in ImpPrefix VPast p a => haveVerb.s ! VPast Pos a ++ verb.s ! ImpPrefix p ++ verb.s ! VPast Pos a ; -- negation in ImpPrefix
-- VF pol (VFPres PrImperf) agr => haveVerb.s ! VF Pos (VFPres PrImperf) agr ++ verb.s ! VF pol (VFPres PrImperf) agr ; _ => verb.s ! vh } ; -- TODO more forms
-- VF pol (VFPast PstAorist) agr => haveVerb.s ! VF Pos (VFPast PstAorist) agr ++ verb.s ! VF pol (VFPast PstAorist) agr ;
-- VF pol (VFPast PstImperf) agr => haveVerb.s ! VF Pos (VFPast PstAorist) agr ++ verb.s ! VF pol (VFPast PstImperf) agr ;
_ => verb.s ! vh } ;
subj = VIntrans subj = VIntrans
} ; } ;

View File

@@ -12,9 +12,10 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
ImpVP vp = { ImpVP vp = {
s = \\pol,n => s = \\pol,n =>
let agr = Ag (numImp n) P2 ; let agr = Ag (numImp n) P2 ;
in case vp.defVV of { vps = vp.prefix ++ vp.s ! VImp pol (numImp n)
True => vp.s ! VImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! Simul ++ vp.embComp; in case vp.isVV of {
False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! Simul ++ vp.s ! VImp pol (numImp n) ++ vp.embComp } True => vps ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ;
False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vps ++ vp.embComp }
} ; } ;
SlashVP np vp = SlashVP np vp =

View File

@@ -20,7 +20,7 @@ concrete StructuralPes of Structural = CatPes **
but_PConj = ss "اما" ; but_PConj = ss "اما" ;
by8agent_Prep = ss "توسط" ; by8agent_Prep = ss "توسط" ;
by8means_Prep = ss "با" ; by8means_Prep = ss "با" ;
-- can8know_VV,can_VV = mkV "سکن" ** { isAux = True} ; -- can8know_VV,can_VV = mkVV (mkV "سکن") ;
can_VV = mkVV (mkV_1 "توانستن") ; ---- AR can_VV = mkVV (mkV_1 "توانستن") ; ---- AR
during_Prep = ss ["در طول"] ; during_Prep = ss ["در طول"] ;
either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ; either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ;
@@ -50,9 +50,9 @@ concrete StructuralPes of Structural = CatPes **
most_Predet = ss "اکثر"; most_Predet = ss "اکثر";
much_Det = mkDet ["مقدار زیادی"] Pl ; much_Det = mkDet ["مقدار زیادی"] Pl ;
must_VV = must_VV =
let must_V : V = defV "بایستن" "باید" "بایست" ; let must : VV = mkVV False subjunctive (defV "بایستن" "باید" "باید") ; -- "بایست" is different meaning?
in mkVV must_V ; in must ** {isDef=True} ;
-- TODO: ** {isDef=True} ; past tense forms with مجبور+beVerb -- TODO: past tense forms with مجبور+beVerb
no_Utt = ss "نه" ; no_Utt = ss "نه" ;
on_Prep = ss "روی" ; on_Prep = ss "روی" ;
only_Predet = ss "فقط" ; only_Predet = ss "فقط" ;

View File

@@ -4,41 +4,35 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
flags optimize=all_subs ; flags optimize=all_subs ;
lin lin
UseV v = predV v ; UseV = predV ;
SlashV2a v = v ** predV v; SlashV2a v = v ** predV v;
Slash2V3 v np = {c2 = v.c3} ** Slash2V3 v np = {c2 = v.c3} **
complSlash (predV v ** {c2 = v.c2}) np ; complSlash (predV v ** {c2 = v.c2}) np ;
Slash3V3 v np = {c2 = v.c2} ** Slash3V3 v np = {c2 = v.c2} **
complSlash (predV v ** {c2 = v.c3}) np ; complSlash (predV v ** {c2 = v.c3}) np ;
ComplSlash = complSlash ; ComplSlash = complSlash ;
ComplVV v vp = insertVV v.isDef (infVV v vp) (predV v) ; ComplVV = insertVV ;
ComplVS v s = embComp (conjThat ++ s.s) (predV v) ; ComplVS v s = embComp (conjThat ++ s.s) (predV v) ;
ComplVQ v q = embComp (conjThat ++ q.s ! QIndir) (predV v) ; ComplVQ v q = embComp (conjThat ++ q.s ! QIndir) (predV v) ;
ComplVA v ap = insertObj (ap.s ! Bare) (predV v) ; -- check form of adjective ComplVA v ap = insertObj (ap.s ! Bare) (predV v) ; -- check form of adjective
SlashV2V v vp = insertVV v.isDef (infVV v vp) (predV v) **{c2 = {s = v.c1 ; ra = []}} ;
SlashVV vv vps = vps ** insertVV vv vps ;
SlashV2S v s = v ** embComp (conjThat ++ s.s) (predV v) ; SlashV2S v s = v ** embComp (conjThat ++ s.s) (predV v) ;
SlashV2Q v q = v ** embComp (q.s ! QIndir) (predV v) ; SlashV2Q v q = v ** embComp (q.s ! QIndir) (predV v) ;
SlashV2A v ap = v ** insertObj (ap.s ! Bare) (predV v) ; ---- paint it red , check form of adjective SlashV2A v ap = v ** insertObj (ap.s ! Bare) (predV v) ; ---- paint it red , check form of adjective
SlashV2V v vp = insertVV v vp ** {c2 = {s = v.c1 ; ra = []}} ;
SlashVV vv vps = vps ** insertVV vv.isDef (infVV vv vps) (predV vv) ;
SlashV2VNP v2v np vps = SlashV2VNP v2v np vps =
let vvVP : VPH = insertVV v2v.isDef (infVV v2v vps) (predV v2v) ; let vvVP : VPH = insertVV v2v vps ;
vvVPS = vvVP ** {c2={s=v2v.c1 ; ra=v2v.c2}} ; -- TODO find out if it's a general rule; only one V2V in the lexicon /IL vvVPS = vvVP ** {c2={s=v2v.c1 ; ra=v2v.c2}} ; -- TODO find out if it's a general rule; only one V2V in the lexicon /IL
in complSlash vvVPS np ** {c2 = vps.c2} ; in complSlash vvVPS np ** {c2 = vps.c2} ;
UseComp comp = insertComp comp.s (predV beVerb) ;
AdvVP vp adv = insertAdV adv.s vp ; AdvVP vp adv = insertAdV adv.s vp ;
AdVVP adv vp = insertAdV adv.s vp ; AdVVP adv vp = insertAdV adv.s vp ;
ReflVP v = insertCompPre reflPron v ; ReflVP v = insertCompPre reflPron v ;
PassV2 v = predV v ; -- need to be fixed PassV2 v = predV v ; -- need to be fixed
UseComp comp = insertComp comp.s (predV beVerb) ;
CompAP ap = {s = \\_ => ap.s ! Bare} ; -- check form of adjective CompAP ap = {s = \\_ => ap.s ! Bare} ; -- check form of adjective
CompAdv adv = {s = \\_ => adv.s } ; CompAdv adv = {s = \\_ => adv.s } ;