diff --git a/src/persian/IdiomPes.gf b/src/persian/IdiomPes.gf index 213217ea..47c44473 100644 --- a/src/persian/IdiomPes.gf +++ b/src/persian/IdiomPes.gf @@ -9,7 +9,7 @@ lin GenericCl vp = mkSClause "آدم" (agrP3 Sg) vp ; CleftNP np rs = - let cl = mkSClause (np.s ! Bare) (np.a) (predAux auxBe); + let cl = mkSClause (np.s ! Bare) (np.a) (predV beVerb); in {s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a }; @@ -17,10 +17,10 @@ lin ExistNP np = mkSClause " " (agrP3 (fromAgr np.a).n) - (insertComp (\\_ => np.s ! Bare) (predAux auxBe)) ; + (insertComp (\\_ => np.s ! Bare) (predV beVerb)) ; ExistIP ip = - let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predAux auxBe); + let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predV beVerb); in {s = \\t,p,qf => case qf of { QDir => cl.s ! t ! p ! ODir; QIndir => cl.s ! t! p ! ODir @@ -30,8 +30,8 @@ lin ProgrVP vp = predProg vp ; - ImpPl1 vp = {s = "بیایید" ++ vp.s ! VVForm (agrP1 Pl)} ; - ImpP3 np vp = {s = "بگذارید" ++ np.s!Bare ++ vp.s ! VVForm np.a}; + ImpPl1 vp = {s = "بیایید" ++ vp.s ! Vvform (agrP1 Pl)} ; + ImpP3 np vp = {s = "بگذارید" ++ np.s!Bare ++ vp.s ! Vvform np.a}; } diff --git a/src/persian/MorphoPes.gf b/src/persian/MorphoPes.gf index adc16b28..ac6b4fea 100644 --- a/src/persian/MorphoPes.gf +++ b/src/persian/MorphoPes.gf @@ -142,21 +142,21 @@ Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; mod : Mod} ; -- Verbs ------------------------------------------------------------------ param - VerbForm1 = VF Polarity VTense2 Agr + VerbForm = VF Polarity VTense Agr | Vvform Agr | Imp Polarity Number | Inf | Root1 | Root2 ; - VTense2 = PPresent2 PrAspect - | PPast2 PstAspect - | PFut2 FtAspect - | Infr_Past2 InfrAspect; + VTense = VFPres PrAspect + | VFPast PstAspect + | VFFut FtAspect + | VFInfrPast InfrAspect; PrAspect = PrPerf | PrImperf ; PstAspect = PstPerf | PstImperf | PstAorist ; FtAspect = FtAorist ; -- just keep FtAorist InfrAspect = InfrPerf | InfrImperf ; oper - Verb = {s : VerbForm1 => Str} ; + Verb = {s : VerbForm => Str} ; mkVerb : (x1,x2 : Str) -> Verb = \inf,root2 -> let root1 = tk 1 inf ; @@ -180,7 +180,7 @@ oper -- Most verbs that end in C+تن or C+دن mkVerb2 : (_: Str) -> Verb = \inf -> mkVerb inf (tk 2 inf) ; - mkCmnVF : Str -> Str -> Polarity -> VTense2 -> Agr -> Str = \root1,root2,pol,t,ag -> + mkCmnVF : Str -> Str -> Polarity -> VTense -> Agr -> Str = \root1,root2,pol,t,ag -> let khordh = root1 + "ه"; nkhordh = addN khordh ; mekhor = zwnj "می" root2 ; @@ -199,33 +199,33 @@ oper perfSuff : Str -> Str = perfectSuffix ag ; pluperfSuff : Str -> Str = pluperfectSuffix ag in case of { - => impfSuffD mekhor ; - => perfSuff khordh ; + => impfSuffD mekhor ; + => perfSuff khordh ; - => pluperfSuff khordh ; - => impfSuff mekhord ; - => impfSuff root1 ; + => pluperfSuff khordh ; + => impfSuff mekhord ; + => impfSuff root1 ; - => impfSuffD khah ++ root1; + => impfSuffD khah ++ root1; - => khordh ++ perfSuff bvdh ; - => perfSuff khordh ; + => khordh ++ perfSuff bvdh ; + => perfSuff khordh ; -- negatives - => impfSuffD nmekhor ; - => perfSuff nkhordh ; + => impfSuffD nmekhor ; + => perfSuff nkhordh ; - => pluperfSuff nkhordh ; - => impfSuff nmekhord ; - => impfSuff (addN root1) ; + => pluperfSuff nkhordh ; + => impfSuff nmekhord ; + => impfSuff (addN root1) ; - => impfSuffD nkhah ++ root1 ; + => impfSuffD nkhah ++ root1 ; - => nkhordh ++ perfSuff bvdh ; - => perfSuff nmekhordh + => nkhordh ++ perfSuff bvdh ; + => perfSuff nmekhordh - -- => perfSuffD mekhah ++ addBh (perfSuffD root2) ; - -- => perfSuffD nmekhah ++ addBh (perfSuffD root2) ; + -- => perfSuffD mekhah ++ addBh (perfSuffD root2) ; + -- => perfSuffD nmekhah ++ addBh (perfSuffD root2) ; } ; mkvVform : Str -> Agr -> Str = \root2,ag -> @@ -315,20 +315,14 @@ oper Imp Neg Sg => "ندار" ; Imp Neg Pl => "ندارید" ; Vvform agr => mkvVform "دار" agr ; - VF pol tense agr => toHave pol tense agr + VF pol tense agr => case of { + => imperfectSuffixD agr "دار" ; + => imperfectSuffixD agr (addN "دار") ; + _ => mkCmnVF "داشت" "دار" pol tense agr + } } } ; - toHave : Polarity -> VTense2 -> Agr -> Str = \pol,t,ag -> - let dar = "دار" ; - ndar = addN dar ; - dasht = "داشت" - in case of { - => imperfectSuffixD ag dar ; - => imperfectSuffixD ag ndar ; - _ => mkCmnVF dasht dar pol t ag - } ; - -- TODO: merge with auxBe in ResPes beVerb : Verb = { s = table { Vvform agr => imperfectSuffixD agr "باش" ; @@ -343,13 +337,15 @@ oper let impfSuff = imperfectSuffix agr ; perfSuff = perfectSuffix agr in case of { - => "است" ; - => impfSuff "هست" ; - => perfSuff "بوده" ; - => "نیست" ; - => impfSuff "نیست" ; - => perfSuff "نبوده" ; - _ => mkCmnVF "بود" "باش" pol tense agr + => "است" ; + => "نیست" ; + => impfSuff "هست" ; + => impfSuff "نیست" ; + => perfSuff "بوده" ; + => perfSuff "نبوده" ; + => impfSuff "بود" ; + => impfSuff "نبود" ; + _ => mkCmnVF "بود" "باش" pol tense agr } } } ; diff --git a/src/persian/PhrasePes.gf b/src/persian/PhrasePes.gf index e1edfc71..9b1ad002 100644 --- a/src/persian/PhrasePes.gf +++ b/src/persian/PhrasePes.gf @@ -17,7 +17,7 @@ concrete PhrasePes of Phrase = CatPes ** open Prelude, ResPes in { UttNP np = {s = np2str np} ; UttCN cn = {s = cn2str cn}; UttAP ap = {s = ap.s ! Bare} ; - UttVP vp = {s = showVPH VPInf defaultAgr vp} ; + UttVP vp = {s = showVPH Inf defaultAgr vp} ; PConjConj conj = {s = conj.s2} ; diff --git a/src/persian/QuestionPes.gf b/src/persian/QuestionPes.gf index 7c0141bb..924c8568 100644 --- a/src/persian/QuestionPes.gf +++ b/src/persian/QuestionPes.gf @@ -32,7 +32,7 @@ concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in { }; QuestIComp icomp np = - let cl = mkSClause (np.s ! Bare ++ icomp.s) np.a (predAux auxBe); + let cl = mkSClause (np.s ! Bare ++ icomp.s) np.a (predV beVerb); in { s = \\t,p,qf => case qf of { QDir => cl.s ! t ! p ! ODir; diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index a6be9d89..07f5a319 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -59,7 +59,7 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { oper VPH : Type = { - s : VPHForm => Str ; + s : VerbForm => Str ; comp : Agr => Str; -- complements of a verb, agr for e.g. CompCN "I am human/we are humans" vComp : Agr => 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") @@ -69,7 +69,7 @@ oper wish : Bool ; -- whether a VV has been added } ; - showVPH : VPHForm -> Agr -> VPH -> Str = \vf,agr,vp -> + showVPH : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp -> vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.s ! vf ++ vp.vComp ! agr ++ vp.embComp ; Compl : Type = {s : Str ; ra : Str} ; @@ -78,63 +78,24 @@ oper param - VPHForm = - VPTense Polarity VPPTense Agr -- 9 * 12 --- | VPReq - | VPImp Polarity Number --- | VPReqFut - | VVForm Agr - | VPStem1 - | VPStem2 - | VPInf - ; - VPHTense = - VPres -- impf hum nahim "I گْ" - | VPast -- impf Ta nahim "I weنت" - | VFut -- fut na/nahim "I سهلل گْ" - | VPerfPres -- perf hum na/nahim "I هوe گْنe" - | VPerfPast -- perf Ta na/nahim "I هد گْنe" - | VPerfFut - | VCondSimul - | VCondAnter -- subj na "I می گْ" + 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 ; - VPPTense = - VPPres Anteriority - |VPPast Anteriority - |VPFutr Anteriority - |VPCond Anteriority ; oper - predV : Verb -> VPH = \verb -> { - s = \\vh => - case vh of { - VPTense pol (VPPres Simul) agr => verb.s ! VF pol (PPresent2 PrImperf) agr ; - VPTense pol (VPPres Anter) agr => verb.s ! VF pol (PPresent2 PrPerf) agr ; - VPTense pol (VPPast Simul) agr => verb.s ! VF pol (PPast2 PstAorist) agr ; - VPTense pol (VPPast Anter) agr => verb.s ! VF pol (PPast2 PstPerf) agr ; - VPTense pol (VPFutr Simul) agr => verb.s ! VF pol (PFut2 FtAorist) agr ; - VPTense pol (VPFutr Anter) agr => verb.s ! VF pol (PPresent2 PrPerf) agr ; -- this is to be confirmed - VPTense pol (VPCond Simul) agr => verb.s ! VF pol (PPast2 PstImperf) agr ; - VPTense pol (VPCond Anter) agr => verb.s ! VF pol (PPast2 PstImperf) agr ; - VVForm agr => verb.s ! Vvform agr ; - VPStem1 => verb.s ! Root1 ; - VPStem2 => verb.s ! Root2 ; - VPInf => verb.s ! Inf; - VPImp pol n =>verb.s ! Imp pol n }; + predV : Verb -> VPH = \verb -> verb ** { subj = VIntrans ; ad, obj, embComp = []; wish = False ; comp, - vComp = \\_ => [] ; - } ; + vComp = \\_ => [] } ; predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb -> predV verb ** {c2 = {s = verb.c1 ; ra = []} } ; @@ -175,7 +136,7 @@ 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 : Bool -> VPH -> (Agr => Str) = \isAux,vp -> - \\agr => if_then_Str isAux conjThat [] ++ showVPH (VVForm agr) agr vp ; + \\agr => if_then_Str isAux conjThat [] ++ showVPH (Vvform agr) agr vp ; insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** { ad = vp.ad ++ ad ; @@ -192,34 +153,23 @@ oper ---- AR 18/9/2017 intermediate SClause to preserve SOV in e.g. QuestionPes.QuestSlash clTable : VPH -> (Agr => VPHTense => Polarity => Str) = \vp -> - \\agr,vt,b => case of { - => vp.s ! VPTense Pos (VPPres Simul) agr ; - => vp.s ! VPTense Neg (VPPres Simul) agr ; - => vp.s ! VPTense Pos (VPPres Anter) agr ; - => vp.s ! VPTense Neg (VPPres Anter) agr ; - => vp.s ! VPTense Pos (VPPast Simul) agr ; - => vp.s ! VPTense Neg (VPPast Simul) agr ; - => vp.s ! VPTense Pos (VPPast Anter) agr ; - => case vp.wish of { - True => vp.s ! VPTense Pos (VPPres Simul) agr ; - False => vp.s ! VPTense Pos (VPFutr Simul) agr }; - => case vp.wish of { - True => vp.s ! VPTense Pos (VPPres Anter) agr ; - False => vp.s ! VPTense Pos (VPFutr Anter) agr }; -- verb form need to be confirmed - => vp.s ! VPTense Neg (VPPast Anter) agr ; - => case vp.wish of { - True => vp.s ! VPTense Neg (VPPres Simul) agr ; - False => vp.s ! VPTense Neg (VPFutr Simul) agr }; - => case vp.wish of { - True => vp.s ! VPTense Neg (VPPres Anter) agr ; - False => vp.s ! VPTense Neg (VPFutr Anter) agr }; -- verb form need to be confirmed - => vp.s ! VPTense Pos (VPCond Simul) agr ; - => vp.s ! VPTense Pos (VPCond Anter) agr; -- verb form to be confirmed - => vp.s ! VPTense Neg (VPCond Simul) agr ; - => vp.s ! VPTense Neg (VPCond Anter) agr ; -- verb form to be confirmed - <_, VVVForm> => vp.s ! VVForm agr ; -- AR 21/3/2018 - <_, VRoot1> => vp.s ! VPStem1 {- ++ Predef.Bind ++ "ه" -} -- AR 22/3/2018 - }; + \\agr,vt,pol => case vt of { + TA Pres Simul => vp.s ! VF pol (VFPres PrImperf) agr ; + TA Pres Anter => vp.s ! VF pol (VFPres PrPerf) agr ; + TA Past Simul => vp.s ! VF pol (VFPast PstAorist) agr ; + TA Past Anter => vp.s ! VF pol (VFPast PstPerf) agr ; + TA Fut Simul => case vp.wish of { + True => vp.s ! VF pol (VFPres PrImperf) agr ; + False => vp.s ! VF pol (VFFut FtAorist) agr } ; + TA Fut Anter => case vp.wish of { + _True => vp.s ! VF pol (VFPres PrPerf) agr } ; + --False => vp.s ! VF pol (VFFut FtAorist) agr } ; -- verb form need to be confirmed + TA Cond Simul => vp.s ! VF pol (VFPast PstImperf) agr ; + TA Cond Anter => vp.s ! VF pol (VFPast PstImperf) agr ; -- verb form to be confirmed + VVVForm => vp.s ! Vvform agr ; -- AR 21/3/2018 + VRoot1 => vp.s ! Root1 {- ++ Predef.Bind ++ "ه" -} -- AR 22/3/2018 + + } ; mkClause : NP -> VPH -> Clause = \np,vp -> let cls = mkSlClause np vp @@ -243,110 +193,19 @@ oper in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vps ++ vp.vComp ! agr ++ vp.embComp }; - ta2vt : Tense -> Anteriority -> VPHTense = \t,a -> case of { - => VPres ; - => VPerfPres ; - => VPast ; - => VPerfPast ; - => VFut ; - => VPerfFut ; - => VCondSimul ; - => VCondSimul } ; - - predAux : Aux -> VPH = \verb -> { - s = \\vh => case vh of { - VPTense pol (VPPres Simul) agr => verb.inf ! AX pol (AuxPresent PrImperf) agr ; - VPTense pol (VPPres Anter) agr => verb.inf ! AX pol (AuxPresent PrPerf) agr ; - VPTense pol (VPPast Simul) agr => verb.inf ! AX pol (AuxPast PstAorist) agr ; - VPTense pol (VPPast Anter) agr => verb.inf ! AX pol (AuxPresent PrPerf) agr ; - VPTense pol (VPFutr Simul) agr => verb.inf ! AX pol (AuxFut FtAorist) agr ; - VPTense pol (VPFutr Anter) agr => verb.inf ! AX pol (AuxFut FtAorist) agr ; -- this is to be confirmed - VPTense pol (VPCond Simul) agr => verb.inf ! AX pol (AuxFut FtAorist) agr ; - VPTense pol (VPCond Anter) agr => verb.inf ! AX pol (AuxPast PstImperf) agr ; - VVForm agr => []; -- to be checked => verb.s ! Vvform agr ; - VPStem1 => []; - VPStem2 => "بود" ; - VPInf => "بودن"; - VPImp _ _ => [] -- need to be confirmed - }; - obj = [] ; - subj = VIntrans ; - ad = []; - embComp = []; - wish = False ; - vComp = \\_ => [] ; - comp = \\_ => [] - } ; - - Aux = { - inf : AuxForm => Str ; - } ; - - auxBe : Aux = { - inf = table { - AX pol tense ag => mkAux pol tense ag - } ; - } ; - - -- TODO: find out how much overlap with beVerb in MorphoPes /IL - mkAux : Polarity -> AuxTense -> Agr -> Str = \pol,t,ag -> - let bodh = "بوده" ; - nbodh = "نبوده" ; - hast = "هست" ; - nhast = "نیست" ; - bod = "بود" ; - khah = "خواه" ; - nbod = "نبود" ; - nkhah = "نخواه" ; - impfSuff : Str -> Str = imperfectSuffix ag ; - impfSuffD : Str -> Str = imperfectSuffixD ag ; - perfSuff : Str -> Str = perfectSuffix ag - in case of { - => "است" ; - => impfSuff hast ; - => perfSuff bodh ; - - => [] ; - => zwnj "می" (impfSuff bod) ; - => impfSuff bod ; - - => impfSuffD khah ++ bod ; - - -- negatives - => impfSuff nhast ; - => perfSuff nbodh ; - - => [] ; - => zwnj "نمی" (impfSuff bod) ; - => impfSuff nbod ; - - => impfSuffD nkhah ++ bod - } ; - - param - AuxTense = AuxPresent PrAspect | AuxPast PstAspect | AuxFut FtAspect ; - AuxForm = AX Polarity AuxTense Agr ; - - - oper - predProg : VPH -> VPH = \verb -> verb ** { s = \\vh => case vh of { - VPTense pol (VPPres Simul) agr => toHave Pos (PPresent2 PrImperf) agr ++ verb.s ! VPTense pol (VPPres Simul) agr ; - VPTense pol (VPPast Simul) agr => toHave Pos (PPast2 PstAorist) agr ++ verb.s ! VPTense pol (VPCond Simul) agr ; - VPTense pol (VPCond Simul) agr => toHave Pos (PPast2 PstAorist) agr ++ verb.s ! VPTense pol (VPCond Simul) agr ; - VPTense pol (VPCond Anter) agr => toHave Pos (PPast2 PstAorist) agr ++ verb.s ! VPTense pol (VPCond Anter) agr ; - -- VPTense pol (VPFutr Anter) agr => verb.s ! VPTense pol (VPFutr Anter) agr ; -- this is to be confirmed + 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 } ; subj = VIntrans } ; - - -IndefArticle : Str ; -IndefArticle = "یک"; -taryn : Str ; -taryn = "ترین" ; + IndefArticle : Str ; + IndefArticle = "یک"; + taryn : Str ; + taryn = "ترین" ; ----------------------------- -- Noun Phrase diff --git a/src/persian/SentencePes.gf b/src/persian/SentencePes.gf index e20b9037..7c66da7a 100644 --- a/src/persian/SentencePes.gf +++ b/src/persian/SentencePes.gf @@ -13,11 +13,10 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in { s = \\pol,n => let agr = Ag (numImp n) P2 ; in case vp.wish of { - True => vp.s ! VPImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.embComp; - False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.s ! VPImp pol (numImp n) ++ vp.embComp } + True => vp.s ! Imp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.embComp; + False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.s ! Imp pol (numImp n) ++ vp.embComp } } ; - SlashVP np vp = mkSlClause np vp ** {c2 = vp.c2} ; @@ -38,22 +37,22 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in { EmbedS s = {s = conjThat ++ s.s} ; EmbedQS qs = {s = qs.s ! QIndir} ; - EmbedVP vp = {s = showVPH VPInf defaultAgr vp} ; --- agr + EmbedVP vp = {s = showVPH Inf defaultAgr vp} ; --- agr - UseCl temp p cl = let vt = ta2vt temp.t temp.a in { + UseCl temp p cl = let vt = TA temp.t temp.a in { s = temp.s ++ p.s ++ cl.s ! vt ! p.p ! ODir } ; - UseQCl temp p qcl = let vt = ta2vt temp.t temp.a in { + UseQCl temp p qcl = let vt = TA temp.t temp.a in { s = \\q => temp.s ++ p.s ++ qcl.s ! vt ! p.p ! q; } ; - UseRCl temp p rcl = let vt = ta2vt temp.t temp.a in rcl ** { + UseRCl temp p rcl = let vt = TA temp.t temp.a in rcl ** { s = \\q => temp.s ++ p.s ++ rcl.s ! vt ! p.p ! ODir ! q } ; - UseSlash temp p cls = let vt = ta2vt temp.t temp.a in cls ** { + UseSlash temp p cls = let vt = TA temp.t temp.a in cls ** { s = temp.s ++ p.s ++ cls.subj ++ cls.vp ! vt ! p.p ! ODir } ; diff --git a/src/persian/VerbPes.gf b/src/persian/VerbPes.gf index 39399684..afa86db2 100644 --- a/src/persian/VerbPes.gf +++ b/src/persian/VerbPes.gf @@ -32,7 +32,7 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in { in complSlash vvVPS np ** {c2 = vps.c2} ; - UseComp comp = insertComp comp.s (predAux auxBe) ; + UseComp comp = insertComp comp.s (predV beVerb) ; AdvVP vp adv = insertAdV adv.s vp ;