diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index af48895ab..e79528dfd 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -15,13 +15,13 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { Cl = ResPes.Clause ; ClSlash = { subj : Str ; - vp : ResPes.VPHTense => Polarity => Order => Str ; + vp : ResPes.TAnt => Polarity => Order => Str ; c2 : ResPes.Compl } ; Imp = {s : Polarity => ImpForm => Str} ; ---- Question - QCl = {s : ResPes.VPHTense => Polarity => QForm => Str} ; + QCl = {s : ResPes.TAnt => Polarity => QForm => Str} ; IP = {s: Str ; n : Number}; @@ -32,7 +32,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { ---- Relative RCl = { - s : ResPes.VPHTense => Polarity => Order => Agr => Str ; + s : ResPes.TAnt => Polarity => Order => Agr => Str ; -- c : Case } ; RP = {s: Str ; a:RAgr}; diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index d67e2ea74..199092cf7 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -57,9 +57,16 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { ----------------------- param VVForm = Indic | Subj ; + VVTense = VVPres | VVPerf | VVPast ; -- VVPast Anteriority ??? oper + -- TODO: all forms + ta2vvt : TAnt -> VVTense = \ta -> case ta of { + TA Pres Anter => VVPerf ; + TA Past _ => VVPast ; + _ => VVPres } ; + VV : Type = Verb ** { isAux : Bool ; compl : VVForm ; -- indicative or subjunctive @@ -67,21 +74,22 @@ oper } ; VPH : Type = Verb ** { - comp : Agr => Str; -- complements of a verb, agr for e.g. 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. + 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 => 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") subj : VType ; ad : Str ; 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 : VerbForm -> Agr -> VPH -> Str = showVPH' Simul ; - showVPH : Anteriority -> VerbForm -> Agr -> VPH -> Str = showVPH' + showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' VVPres ; + 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 ++ vp.prefix ++ vp.s ! vf ++ vp.vComp ! agr ! ant ++ vp.embComp ; @@ -91,14 +99,9 @@ oper VPHSlash : Type = VPH ** {c2 : Compl} ; param + TAnt = TA Tense Anteriority ; - VPHTense = - 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 ; + VType = VIntrans | VTrans | VTransPost ; -- TODO: find out if needed oper @@ -107,15 +110,13 @@ oper ad, obj, embComp = []; - defVV = False ; + isDef,isVV = False ; comp = \\_ => [] ; vComp = \\_,_ => [] } ; predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb -> predV verb ** {c2 = {s = verb.c1 ; ra = []} } ; - - --------------------- -- VP complementation --------------------- @@ -130,11 +131,11 @@ oper comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a } ; - insertVV : Bool -> (Agr => Anteriority => Str) -> VPH -> VPH = - \isDef,infcl,vp -> vp ** { - defVV = True; --isDef ; - vComp = \\agr,ant => vp.vComp ! agr ! ant ++ infcl ! agr ! ant ; - } ; + insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** { + vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ; + isVV = True ; + isDef = vv.isDef ; + } ; embComp : Str -> VPH -> VPH = \str,vp -> vp ** { embComp = vp.embComp ++ str ; @@ -150,14 +151,20 @@ oper ---- AR 14/9/2017 trying to fix isAux = True case by inserting conjThat ---- 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 [] ++ - case of { - <_Simul,Subj> => showVPH (VSubj Pos agr) agr vp ; - <_Simul,Indic> => showVPH (VAor Pos agr) agr vp - -- TODO: confirm => showVPH PerfStem agr vp ++ subjAux Pos agr - } ; + case of { + -- Auxiliaries with full inflection: complement in subjunctive + <_,_,False> => showVPH (VSubj Pos agr) agr vp ; -- + -- Auxiliaries with defective inflection: complement inflects in tense + => showVPH (VSubj Pos agr) agr vp ; + => showVPH (VAor Pos agr) agr vp ; + => showVPH (VPast Pos agr) agr vp ; +-- => showVPH PerfStem agr vp ++ pluperfAux Pos agr ; -- TODO do we need this? + => showVPH PerfStem agr vp ++ subjAux Pos agr ; + _ => showVPH (VSubj Pos agr) agr vp ---- TODO more forms ? + } ; insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** { ad = vp.ad ++ ad ; @@ -168,37 +175,35 @@ oper --------------------------- --- Clauses --------------------------- - Clause : Type = {s : VPHTense => Polarity => Order => Str} ; - SlClause : Type = {quest : Order => Str ; subj : Str ; vp : VPHTense => Polarity => Order => Str} ; - + Clause : Type = {s : TAnt => 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 - 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 { 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 Past Simul => vp.s ! VPast pol agr ; TA Past Anter => - case vp.defVV of { + case vp.isDef of { True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; False => vp.s ! PerfStem ++ pluperfAux pol agr } ; TA Fut Simul => - case vp.defVV of { + case vp.isDef of { True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; False => futAux pol agr ++ vp.s ! PastStem } ; -- PastStem is, despite the name, used for future too. /IL TA Fut Anter => - case vp.defVV of { + case vp.isDef of { True => vp.s ! VPerf pol agr ; False => "خواسته" ++ pluperfAux pol agr ++ vp.s ! PastStem } ; -- verb form need to be confirmed TA Cond Simul => vp.s ! VSubj pol agr ; TA Cond Anter => - case vp.defVV of { + case vp.isDef of { True => vp.s ! VSubj pol agr ; - 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 + False => vp.s ! PerfStem ++ subjAux pol agr } -- verb form to be confirmed } ; mkClause : NP -> VPH -> Clause = \np,vp -> @@ -210,25 +215,21 @@ oper { ODir => []; OQuest => "آیا" } ; subj = np.s ! Bare ; - vp = \\vt,b,ord => - let vps = clTable vp ! np.a ! vt ! b ; - ant = case vp.defVV of { - True => case vt of {TA Pres _ => Simul ; TA _ a => Anter ; _ => Simul} ; - False => Simul } + vp = \\ta,p,ord => + let vps = clTable vp ! np.a ! ta ! p ; + vvt = ta2vvt ta ; 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 -> { - s = \\vt,b,ord => - let vps = clTable vp ! agr ! vt ! b ; + s = \\ta,p,ord => + let vps = clTable vp ! agr ! ta ! p ; quest = case ord of { ODir => [] ; OQuest => "آیا" } ; - ant = case vp.defVV of { - True => case vt of {TA Pres _ => Simul ; TA _ a => Anter ; _ => Simul} ; - False => Simul } + vvt = ta2vvt ta ; 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 ** { @@ -236,10 +237,7 @@ oper ImpPrefix _ => [] ; 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 - -- VF pol (VFPres PrImperf) agr => haveVerb.s ! VF Pos (VFPres PrImperf) agr ++ verb.s ! VF pol (VFPres PrImperf) agr ; - -- 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 } ; + _ => verb.s ! vh } ; -- TODO more forms subj = VIntrans } ; diff --git a/src/persian/SentencePes.gf b/src/persian/SentencePes.gf index a82ace94f..c0f91eeac 100644 --- a/src/persian/SentencePes.gf +++ b/src/persian/SentencePes.gf @@ -12,9 +12,10 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in { ImpVP vp = { s = \\pol,n => let agr = Ag (numImp n) P2 ; - in case vp.defVV of { - True => vp.s ! VImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! Simul ++ vp.embComp; - False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! Simul ++ vp.s ! VImp pol (numImp n) ++ vp.embComp } + vps = vp.prefix ++ vp.s ! VImp pol (numImp n) + in case vp.isVV of { + 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 = diff --git a/src/persian/StructuralPes.gf b/src/persian/StructuralPes.gf index e3f880fb9..67d0afe03 100644 --- a/src/persian/StructuralPes.gf +++ b/src/persian/StructuralPes.gf @@ -20,7 +20,7 @@ concrete StructuralPes of Structural = CatPes ** but_PConj = ss "اما" ; by8agent_Prep = ss "توسط" ; by8means_Prep = ss "با" ; --- can8know_VV,can_VV = mkV "سکن" ** { isAux = True} ; +-- can8know_VV,can_VV = mkVV (mkV "سکن") ; can_VV = mkVV (mkV_1 "توانستن") ; ---- AR during_Prep = ss ["در طول"] ; either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ; @@ -50,9 +50,9 @@ concrete StructuralPes of Structural = CatPes ** most_Predet = ss "اکثر"; much_Det = mkDet ["مقدار زیادی"] Pl ; must_VV = - let must_V : V = defV "بایستن" "باید" "بایست" ; - in mkVV must_V ; - -- TODO: ** {isDef=True} ; past tense forms with مجبور+beVerb + let must : VV = mkVV False subjunctive (defV "بایستن" "باید" "باید") ; -- "بایست" is different meaning? + in must ** {isDef=True} ; + -- TODO: past tense forms with مجبور+beVerb no_Utt = ss "نه" ; on_Prep = ss "روی" ; only_Predet = ss "فقط" ; diff --git a/src/persian/VerbPes.gf b/src/persian/VerbPes.gf index beb5d55e6..799da98d7 100644 --- a/src/persian/VerbPes.gf +++ b/src/persian/VerbPes.gf @@ -4,41 +4,35 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in { flags optimize=all_subs ; lin - UseV v = predV v ; + UseV = predV ; SlashV2a v = v ** predV v; Slash2V3 v np = {c2 = v.c3} ** complSlash (predV v ** {c2 = v.c2}) np ; - Slash3V3 v np = {c2 = v.c2} ** complSlash (predV v ** {c2 = v.c3}) np ; - ComplSlash = complSlash ; - ComplVV v vp = insertVV v.isDef (infVV v vp) (predV v) ; + ComplVV = insertVV ; ComplVS v s = embComp (conjThat ++ s.s) (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 - 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) ; 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 - - SlashVV vv vps = vps ** insertVV vv.isDef (infVV vv vps) (predV vv) ; - + SlashV2V v vp = insertVV v vp ** {c2 = {s = v.c1 ; ra = []}} ; 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 in complSlash vvVPS np ** {c2 = vps.c2} ; - - UseComp comp = insertComp comp.s (predV beVerb) ; - AdvVP vp adv = insertAdV adv.s vp ; - AdVVP adv vp = insertAdV adv.s vp ; ReflVP v = insertCompPre reflPron v ; 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 CompAdv adv = {s = \\_ => adv.s } ;