From aac108808c442308b1e32956d30d31d5881f26b2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 18 Apr 2019 18:45:31 +0200 Subject: [PATCH] (Pes) Fixes in verb tenses Co-Authored-By: Nasrin Mostofian --- src/persian/ResPes.gf | 77 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index a9a06f4a..8235a477 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -67,16 +67,23 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { ----------------------- param VVType = NoVV | FullVV | DefVV ; - VVForm = Indic | Subj ; - VVTense = VVPres | VVPerf | VVPast ; -- VVPast Anteriority ??? + VVForm = Indic | Subj ; ---| SubjPast ; -- TODO extend this to VV, VS and Subj + VVTense = VVPres | VVPast VVForm ; TAnt = TA Tense Anteriority ; oper - -- TODO: all forms - ta2vvt : TAnt -> VVTense = \ta -> case ta of { - TA Pres Anter => VVPerf ; - TA Past _ => VVPast ; + -- VVPast Subj is another possibility, used in constructions such as + -- قاتل نمی توانسته آنجا بوده باشد، چون او آن زمان در پاریس بوده + -- The form is created in complVV, but not currently used in other functions. /IL + ta2vvt : TAnt -> VVType -> VVTense = \ta,vvtype -> case ta of { + TA Pres Anter | + TA Past _ => VVPast Indic ; + TA Cond Simul => VVPres ; + TA Cond Anter => + case vvtype of { + DefVV => VVPast Indic ; + _ => VVPres } ; _ => VVPres } ; VV : Type = Verb ** { @@ -95,20 +102,18 @@ oper } ; showVPH = overload { - showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' VVPres ; - showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH' + showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' False VVPres ; + showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH' False } ; - 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 ; - - -- A hack: we reuse the obj field for the VP complement in - -- SlashV2V and this is needed to get the right word order for complVV. - showVPHvv : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp -> - vp.comp ! agr ++ vp.prefix ++ vp.s ! vf -- vp.ad is missing on purpose! we add it in insertVV. - ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ; + showVPH' : Bool -> VVTense -> VerbForm -> Agr -> VPH -> Str = + \showImpPref,ant,vf,agr,vp -> + let impPref = case showImpPref of { + True => vp.s ! ImpPrefix Pos ; + False => [] } + in vp.ad ++ vp.comp ! agr ++ vp.obj + ++ vp.prefix ++ impPref ++ vp.s ! vf + ++ vp.vComp ! agr ! ant ++ vp.embComp ; Compl : Type = {s : Str ; ra : Str ; mod : Mod} ; @@ -161,7 +166,6 @@ oper insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** { vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ; vvtype = case vv.isDef of {True => DefVV ; _ => FullVV} ; - ad = vp.ad -- because complVV doesn't include ad! for word order. } ; embComp : Str -> VPH -> VPH = \str,vp -> vp ** { @@ -183,15 +187,15 @@ oper \\agr,ant => if_then_Str vv.isAux conjThat [] ++ case of { -- Auxiliaries with defective inflection: complement inflects in tense - => showVPHvv (VPast Pos agr) agr vp ; --- => showVPH PerfStem agr vp ++ pluperfAux Pos agr ; -- TODO do we need this? - => showVPHvv PerfStem agr vp ++ subjAux Pos agr ; + => showVPH' True VVPres (VPast Pos agr) agr vp ; + => showVPH (VPast Pos agr) agr vp ; + => showVPH PerfStem agr vp ++ subjAux Pos agr ; -- Auxiliaries that take indicative (full or defective inflection) - => showVPHvv (VAor Pos agr) agr vp ; + => showVPH (VAor Pos agr) agr vp ; -- Default: complement in subjunctive - _ => showVPHvv (VSubj Pos agr) agr vp ---- TODO more forms ? + _ => showVPH (VSubj Pos agr) agr vp } ; insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** { @@ -207,16 +211,15 @@ oper 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 - -- 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.vvtype of { - DefVV => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; - _ => vp.s ! PerfStem ++ pluperfAux pol agr } ; + TA Past Simul => vp.s ! VPast pol agr ; -- Past Simul: simple past + TA Past Anter | TA Cond _ => -- Past Anter & Cond _: continuous past + case vp.vvtype of { + DefVV => vp.s ! VPast pol agr ; + _ => vp.s ! ImpPrefix pol ++ vp.s ! VPast Pos agr } ; TA Fut Simul => case vp.vvtype of { DefVV => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; @@ -225,13 +228,8 @@ oper TA Fut Anter => case vp.vvtype of { DefVV => vp.s ! VPerf pol agr ; - _ => "خواسته" ++ 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.vvtype of { - DefVV => vp.s ! VSubj pol agr ; - _ => vp.s ! PerfStem ++ subjAux pol agr } -- verb form to be confirmed + _ => futAux pol agr ++ vp.s ! PastStem + } } ; mkClause : NP -> VPH -> Clause = \np,vp -> @@ -245,7 +243,7 @@ oper subj = np2str np ; vp = \\ta,p,ord => let vps = clTable vp ! np.a ! ta ! p ; - vvt = ta2vvt ta ; + vvt = ta2vvt ta vp.vvtype ; in case vp.vvtype of { DefVV => vps ++ vp.ad ++ vp.comp ! np.a ++ vp.obj @@ -259,9 +257,8 @@ oper s = \\ta,p,ord => let vps = clTable vp ! agr ! ta ! p ; quest = case ord of { ODir => [] ; OQuest => "آیا" } ; - vvt = ta2vvt ta ; + vvt = ta2vvt ta vp.vvtype ; in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj --- in quest ++ vp.ad ++ subj ++ vp.comp ! agr ++ vp.obj -- TODO check which word order is better /IL ++ vps ++ vp.vComp ! agr ! vvt ++ vp.embComp };