--# -path=.:../abstract:../common:../../prelude -- --1 Pnbu auxiliary operations. -- -- This module contains operations that are needed to make the -- resource syntax work. resource ResPes = ParamX ** open Prelude,Predef in { flags optimize=all ; coding = utf8; param Order = ODir | OQuest ; Animacy = Animate | Inanimate ; PMood = Del | Imper | PCond ; PPerson = PPers1 | PPers2 | PPers3; VerbForm1 = VF Polarity VTense2 PPerson Number | Vvform AgrPes | Imp Polarity Number | Inf | Root1 | Root2 ; VTense2 = PPresent2 PrAspect | PPast2 PstAspect | PFut2 FtAspect| Infr_Past2 InfrAspect; PrAspect = PrPerf | PrImperf ; PstAspect = PstPerf | PstImperf | PstAorist ; FtAspect = FtAorist ; -- just keep FtAorist InfrAspect = InfrPerf | InfrImperf ; AgrPes = AgPes Number PPerson; Ezafa = bEzafa | aEzafa | enClic; NPCase = NPC Ezafa ; CardOrd = NCard | NOrd ; RAgr = RNoAg | RAg AgrPes ; -- RCase = RC Number Case ; param CPolarity = CPos |CNeg Bool; -- contracted or not oper Noun = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool } ; Verb = {s : VerbForm1 => Str} ; Compl : Type = {s : Str ; ra : Str ; c : VType} ; Adjective = {s:Ezafa => Str ; adv : Str} ; NP : Type = {s : NPCase => Str ; a : AgrPes ; animacy : Animacy } ; Determiner = {s : Str ; n :Number ; isNum : Bool ; fromPron : Bool} ; VPHSlash = VPH ** {c2 : Compl} ; oper contrNeg : Bool -> Polarity -> CPolarity = \b,p -> case p of { Pos => CPos ; Neg => CNeg b } ; ----------------------- --- Verb Phrase ----------------------- oper VPH : Type = { s : VPHForm => {inf : Str} ; obj : {s : Str ; a : AgrPes} ; subj : VType ; comp : AgrPes => Str; vComp : AgrPes => Str; inf : Str; ad : Str; embComp : Str ; wish : Bool ; } ; param VPHForm = VPTense Polarity VPPTense AgrPes -- 9 * 12 -- | VPReq | VPImp Polarity Number -- | VPReqFut | VVForm AgrPes | VPStem1 | VPStem2 ; 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 می گْ" ; 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) (AgPes n p) => { inf = verb.s ! VF pol (PPresent2 PrImperf) p n } ; VPTense pol (VPPres Anter) (AgPes n p) => { inf = verb.s ! VF pol (PPresent2 PrPerf) p n } ; VPTense pol (VPPast Simul) (AgPes n p) => { inf =verb.s ! VF pol (PPast2 PstAorist) p n } ; VPTense pol (VPPast Anter) (AgPes n p) => { inf =verb.s ! VF pol (PPast2 PstPerf) p n } ; VPTense pol (VPFutr Simul) (AgPes n p) => { inf = verb.s ! VF pol (PFut2 FtAorist) p n } ; VPTense pol (VPFutr Anter) (AgPes n p) => { inf = verb.s ! VF pol (PPresent2 PrPerf) p n } ; -- this is to be confirmed VPTense pol (VPCond Simul) (AgPes n p) => { inf = verb.s ! VF pol (PPast2 PstImperf) p n } ; VPTense pol (VPCond Anter) (AgPes n p) => { inf = verb.s ! VF pol (PPast2 PstImperf) p n } ; VVForm (AgPes n p) => {inf = verb.s ! Vvform (AgPes n p)} ; VPStem1 => { inf = verb.s ! Root1}; VPStem2 => { inf = verb.s ! Root2} ; VPImp pol n => { inf = verb.s ! Imp pol n} }; obj = {s = [] ; a = defaultAgrPes} ; subj = VIntrans ; inf = verb.s ! Inf; ad = []; embComp = []; wish = False ; vComp = \\_ => [] ; comp = \\_ => [] } ; predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb -> predV verb ** {c2 = {s = verb.c1 ; ra = [] ; c = VTrans} } ; ---------------------- -- Verb Phrase complimantation ------------------------ {- insertObject : NP -> VPHSlash -> VPH = \np,vps -> { s = vps.s ; -- obj = {s = variants { vps.obj.s ++ np.s ++ vps.c2.s ; vps.obj.s ++ np.s } ; a = np.a} ; obj = {s = case vps.c2.s of { "را" => np.s ++ vps.c2.s ++ vps.obj.s; _ => vps.c2.s ++ np.s ++ vps.obj.s }; a = np.a} ; subj = vps.c2.c ; inf = vps.inf; ad = vps.ad; embComp = vps.embComp; -- wish = vps.wish ; comp = vps.comp } ; -} insertObjc : (AgrPes => Str) -> VPHSlash -> VPHSlash = \obj,vp -> insertObj obj vp ** {c2 = vp.c2} ; insertVVc : (AgrPes => Str) -> VPHSlash -> VPHSlash = \obj,vp -> insertVV obj vp ** {c2 = vp.c2} ; {- insertSubj : PPerson -> Str -> Str = \p,s -> case p of { Pers1 => s ++ "wN" ; _ => s ++ "E"}; -} insertObj : (AgrPes => Str) -> VPH -> VPH = \obj1,vp -> { s = vp.s ; obj = vp.obj ; subj = vp.subj ; inf = vp.inf; ad = vp.ad; embComp = vp.embComp; wish = vp.wish ; vComp = vp.vComp ; comp = \\a => vp.comp ! a ++ obj1 ! a } ; insertVV : (AgrPes => Str) -> VPH -> VPH = \obj1,vp -> { s = vp.s ; -- obj = vp.obj ; obj = vp.obj ; subj = vp.subj ; inf = vp.inf; ad = vp.ad; embComp = vp.embComp; wish = True ; vComp = \\a => vp.comp ! a ++ obj1 ! a ; comp = vp.comp } ; insertObj2 : (Str) -> VPH -> VPH = \obj1,vp -> { s = vp.s; obj = vp.obj ; subj = vp.subj ; inf = vp.inf; ad = vp.ad; embComp = vp.embComp ++ obj1; wish = vp.wish ; vComp = vp.vComp ; comp = \\a => vp.comp ! a -- ++ obj1 } ; insertObj3 : (Str) -> VPH -> VPH = \obj1,vp -> { s = vp.s; obj = {s = obj1 ++ vp.obj.s ; a = vp.obj.a }; subj = vp.subj ; inf = vp.inf; ad = vp.ad; embComp = vp.embComp; wish = vp.wish ; vComp = vp.vComp ; comp = vp.comp } ; insertObjc2 : Str -> VPHSlash -> VPHSlash = \obj,vp -> insertObj2 obj vp ** {c2 = vp.c2} ; insertObjc3 : Str -> VPHSlash -> VPHSlash = \obj,vp -> insertObj3 obj vp ** {c2 = vp.c2} ; {- infVP : Bool -> VPH -> Agr -> Str = \isAux,vp,a -> vp.obj.s ++ vp.inf ++ vp.comp ! a ; -} infVV : Bool -> VPH -> {s : AgrPes => Str} = \isAux,vp -> {s = \\agr => case agr of { AgPes n p => (vp.comp ! (toAgr n p)) ++ (vp.s ! VVForm (AgPes n p)).inf }}; insertObjPre : (AgrPes => Str) -> VPHSlash -> VPH = \obj,vp -> { s = vp.s ; obj = vp.obj ; inf = vp.inf ; subj = vp.subj ; ad = vp.ad ; embComp = vp.embComp; wish = vp.wish ; vComp = vp.vComp ; -- comp = \\a => case vp.c2.s of {"را" => obj ! a ++ vp.c2.s ++ vp.comp ! a ; _ => vp.c2.s ++ obj ! a ++ vp.comp ! a} -- gives linking error comp = \\a => vp.c2.s ++ obj ! a ++ vp.c2.ra ++ vp.comp ! a } ; insertAdV : Str -> VPH -> VPH = \ad,vp -> { s = vp.s ; obj = vp.obj ; inf = vp.inf ; subj = vp.subj; ad = vp.ad ++ ad ; embComp = vp.embComp; wish = vp.wish ; vComp = vp.vComp ; comp = vp.comp } ; conjThat : Str = "که" ; {- checkPron : NP -> Str -> Str = \np,str -> case (np.isPron) of { True => np.s ! NPC Obl; False => np.s ! NPC Obl ++ str} ; insertEmbCompl : VPH -> Str -> VPH = \vp,emb -> { s = vp.s ; obj = vp.obj ; inf = vp.inf ; subj = vp.subj; ad = vp.ad; embComp = vp.embComp ++ emb; wish = vp.wish ; comp = vp.comp } ; insertTrans : VPH -> VType -> VPH = \vp,vtype -> { s = vp.s ; obj = vp.obj ; inf = vp.inf ; subj = case vtype of {VIntrans => VTransPost ; VTrans => VTrans ; _ => vtype} ; -- still some problem not working properly ad = vp.ad; embComp = vp.embComp ; wish = vp.wish ; comp = vp.comp } ; -} --------------------------- --- Clauses --------------------------- Clause : Type = {s : VPHTense => Polarity => Order => Str} ; mkClause : NP -> VPH -> Clause = \np,vp -> { s = \\vt,b,ord => let subj = np.s ! NPC bEzafa; agr = np.a ; n = (fromAgr agr).n; p = (fromAgr agr).p; vps = case of { => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ; => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ; => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ; => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ; => vp.s ! VPTense Pos (VPPast Simul) (AgPes n p) ; => vp.s ! VPTense Neg (VPPast Simul) (AgPes n p) ; => vp.s ! VPTense Pos (VPPast Anter) (AgPes n p) ; => case vp.wish of {True => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ; False => vp.s ! VPTense Pos (VPFutr Simul) (AgPes n p) }; => case vp.wish of {True => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ; False => vp.s ! VPTense Pos (VPFutr Anter) (AgPes n p) }; -- verb form need to be confirmed => vp.s ! VPTense Pos (VPCond Simul) (AgPes n p) ; => vp.s ! VPTense Pos (VPCond Anter) (AgPes n p); -- verb form to be confirmed => vp.s ! VPTense Neg (VPPast Anter) (AgPes n p) ; => case vp.wish of {True => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ; False => vp.s ! VPTense Neg (VPFutr Simul) (AgPes n p) }; => case vp.wish of {True => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ; False => vp.s ! VPTense Neg (VPFutr Anter) (AgPes n p) }; -- verb form need to be confirmed => vp.s ! VPTense Neg (VPCond Simul) (AgPes n p) ; => vp.s ! VPTense Neg (VPCond Anter) (AgPes n p) -- verb form to be confirmed }; quest = case ord of { ODir => []; OQuest => "آیا" }; in quest ++ subj ++ vp.ad ++ vp.comp ! np.a ++ vp.obj.s ++ vps.inf ++ vp.vComp ! np.a ++ vp.embComp }; --Clause : Type = {s : VPHTense => Polarity => Order => Str} ; mkSClause : Str -> AgrPes -> VPH -> Clause = \subj,agr,vp -> { s = \\vt,b,ord => let n = (fromAgr agr).n; p = (fromAgr agr).p; vps = case of { => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ; => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ; => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ; => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ; => vp.s ! VPTense Pos (VPPast Simul) (AgPes n p) ; => vp.s ! VPTense Neg (VPPast Simul) (AgPes n p) ; => vp.s ! VPTense Pos (VPPast Anter) (AgPes n p) ; => case vp.wish of {True => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ; False => vp.s ! VPTense Pos (VPFutr Simul) (AgPes n p) }; => case vp.wish of {True => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ; False => vp.s ! VPTense Pos (VPFutr Anter) (AgPes n p) }; -- verb form need to be confirmed => vp.s ! VPTense Pos (VPCond Simul) (AgPes n p) ; => vp.s ! VPTense Pos (VPCond Anter) (AgPes n p); -- verb form to be confirmed => vp.s ! VPTense Neg (VPPast Anter) (AgPes n p) ; => case vp.wish of {True => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ; False => vp.s ! VPTense Neg (VPFutr Simul) (AgPes n p) }; => case vp.wish of {True => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ; False => vp.s ! VPTense Neg (VPFutr Anter) (AgPes n p) }; -- verb form need to be confirmed => vp.s ! VPTense Neg (VPCond Simul) (AgPes n p) ; => vp.s ! VPTense Neg (VPCond Anter) (AgPes n p) -- verb form to be confirmed }; quest = case ord of { ODir => []; OQuest => "آیا" }; in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vps.inf ++ vp.vComp ! agr ++ vp.embComp }; predAux : Aux -> VPH = \verb -> { s = \\vh => case vh of { VPTense pol (VPPres Simul) (AgPes n p) => { inf = verb.inf ! AX pol (AuxPresent PrImperf) p n } ; VPTense pol (VPPres Anter) (AgPes n p) => { inf = verb.inf ! AX pol (AuxPresent PrPerf) p n } ; VPTense pol (VPPast Simul) (AgPes n p) => { inf = verb.inf ! AX pol (AuxPast PstAorist) p n } ; VPTense pol (VPPast Anter) (AgPes n p) => { inf = verb.inf ! AX pol (AuxPresent PrPerf) p n } ; VPTense pol (VPFutr Simul) (AgPes n p) => { inf = verb.inf ! AX pol (AuxFut FtAorist) p n } ; VPTense pol (VPFutr Anter) (AgPes n p) => { inf = verb.inf ! AX pol (AuxFut FtAorist) p n } ; -- this is to be confirmed VPTense pol (VPCond Simul) (AgPes n p) => { inf = verb.inf ! AX pol (AuxFut FtAorist) p n } ; VPTense pol (VPCond Anter) (AgPes n p) => { inf = verb.inf ! AX pol (AuxPast PstImperf) p n } ; VVForm (AgPes n p) => {inf = ""} ; -- to be checked VPStem1 => { inf = ""}; VPStem2 => { inf = "بود"} ; VPImp _ _ => { inf = ""} -- need to be confirmed -- _ => { inf = ""} }; obj = {s = [] ; a = defaultAgrPes} ; subj = VIntrans ; inf = "بودن"; ad = []; embComp = []; wish = False ; vComp = \\_ => [] ; comp = \\_ => [] } ; Aux = { inf : AuxForm => Str ; } ; auxBe : Aux = { inf = table { AX pol tense person number => (mkAux pol tense person number).s } ; } ; mkAux : Polarity -> AuxTense -> PPerson -> Number -> {s:Str}= \pol,t,p,n -> {s = let bodh = "بوده" ; nbodh = "نبوده" ; hast = "هست" ; nhast = "نیست" ; bod = "بود" ; khah = "خواه" ; mekhah = "می" ++ khah ; bash = "باش" ; nbod = "نبود" ; nkhah = "نخواه" ; nmekhah = "نمی" ++ khah ; nbash = "نباش" in case of { => bodh ++ "ام" ; => bodh ++ "ایم" ; => bodh ++ "ای" ; => bodh ++ "اید" ; => bodh ++ "است" ; => bodh ++ "اند" ; => hast + "م" ; => hast + "یم" ; => hast + "ی" ; => hast + "ید" ; => "است" ; => hast + "ند" ; => ""; => "" ; => "" ; => "" ; => "" ; => "" ; => "می" ++ bod + "م" ; => "می" ++ bod + "یم" ; => "می" ++ bod + "ی"; => "می" ++ bod + "ید" ; => "می" ++ bod ; => "می" ++ bod + "ند" ; => bod + "م" ; => bod + "یم" ; => bod + "ی"; => bod + "ید" ; => bod ; => bod + "ند" ; {- => mekhah + "م" ++ bash + "م" ; => mekhah + "یم" ++ bash + "یم" ; => mekhah + "ی" ++ bash + "ی" ; => mekhah + "ید" ++ bash + "ید" ; => mekhah + "د" ++ bash + "د" ; => mekhah + "ند" ++ bash + "ند" ; -} => khah + "م" ++ bod ; => khah + "یم" ++ bod ; => khah + "ی" ++ bod ; => khah + "ید" ++ bod ; => khah + "د" ++ bod ; => khah + "ند" ++ bod ; -- nagatives => nbodh ++ "ام" ; => nbodh ++ "ایم" ; => nbodh ++ "ای" ; => nbodh ++ "اید" ; => nbodh ++ "است" ; => nbodh ++ "اند" ; => nhast + "م" ; => nhast + "یم" ; => nhast + "ی" ; => nhast + "ید" ; => "نیست" ; => nhast + "ند" ; => ""; => "" ; => "" ; => "" ; => "" ; => "" ; => "نمی" ++ bod + "م" ; => "نمی" ++ bod + "یم" ; => "نمی" ++ bod + "ی"; => "نمی" ++ bod + "ید" ; => "نمی" ++ bod ; => "نمی" ++ bod + "ند" ; => nbod + "م" ; => nbod + "یم" ; => nbod + "ی"; => nbod + "ید" ; => nbod ; => nbod + "ند" ; {- => nmekhah + "م" ++ bash + "م" ; => nmekhah + "یم" ++ bash + "یم" ; => nmekhah + "ی" ++ bash + "ی" ; => nmekhah + "ید" ++ bash + "ید" ; => nmekhah + "د" ++ bash + "د" ; => nmekhah + "ند" ++ bash + "ند" ; -} => nkhah + "م" ++ bod ; => nkhah + "یم" ++ bod ; => nkhah + "ی" ++ bod ; => nkhah + "ید" ++ bod ; => nkhah + "د" ++ bod ; => nkhah + "ند" ++ bod {- => khordh ++ bvdh ++ "ام" ; => khordh ++ bvdh ++ "ایم" ; => khordh ++ bvdh ++ "ای" ; => khordh ++ bvdh ++ "اید" ; => khordh ++ bvdh ++ "است" ; => khordh ++ bvdh ++ "اند" ; => mekhordh ++ "ام" ; => mekhordh ++ "ایم" ; => mekhordh ++ "ای" ; => mekhordh ++ "اید" ; => mekhordh ++ "است" ; => mekhordh ++ "اند" -} } } ; param AuxTense = AuxPresent PrAspect | AuxPast PstAspect | AuxFut FtAspect ; AuxForm = AX Polarity AuxTense PPerson Number ; oper toHave : Polarity -> VTense2 -> Number -> PPerson -> {s:Str} = \pol,t,n,p -> { s = let dasht = "داشت"; ndasht = "نداشت" ; dashteh = "داشته"; ndashteh = "نداشته" ; dar = "دار" ; ndar = "ندار" ; khah = "خواه" ; nkhah = "نخواه" ; bvdh = "بوده" ; in case of { => dashteh ++ "ام" ; => dashteh ++ "ایم" ; => dashteh ++ "ای" ; => dashteh ++ "اید" ; => dashteh ++ "است" ; => dashteh ++ "اند" ; => dar + "م" ; => dar + "یم" ; => dar + "ی" ; => dar + "ید" ; => dar + "د" ; => dar + "ند" ; => dashteh ++ "بودم" ; => dashteh ++ "بودیم" ; => dashteh ++ "بودی" ; => dashteh ++ "بودید" ; => dashteh ++ "بود" ; => dashteh ++ "بودند" ; => dasht + "م" ; => dasht + "یم" ; => dasht + "ی"; => dasht + "ید" ; => dasht ; => dasht + "ند" ; => dasht + "م" ; => dasht + "یم" ; => dasht + "ی"; => dasht + "ید" ; => dasht ; => dasht + "ند" ; => khah + "م" ++ dasht ; => khah + "یم" ++ dasht ; => khah + "ی" ++ dasht ; => khah + "ید" ++ dasht ; => khah + "د" ++ dasht ; => khah + "ند" ++ dasht ; => dashteh ++ bvdh ++ "ام" ; => dashteh ++ bvdh ++ "ایم" ; => dashteh ++ bvdh ++ "ای" ; => dashteh ++ bvdh ++ "اید" ; => dashteh ++ bvdh ++ "است" ; => dashteh ++ bvdh ++ "اند" ; => dashteh ++ "ام" ; => dashteh ++ "ایم" ; => dashteh ++ "ای" ; => dashteh ++ "اید" ; => dashteh ++ "است" ; => dashteh ++ "اند" ; -- negatives => ndashteh ++ "ام" ; => ndashteh ++ "ایم" ; => ndashteh ++ "ای" ; => ndashteh ++ "اید" ; => ndashteh ++ "است" ; => ndashteh ++ "اند" ; => ndar + "م" ; => ndar + "یم" ; => ndar + "ی" ; => ndar + "ید" ; => ndar + "د" ; => ndar + "ند" ; => ndashteh ++ "بودم" ; => ndashteh ++ "بودیم" ; => ndashteh ++ "بودی" ; => ndashteh ++ "بودید" ; => ndashteh ++ "بود" ; => ndashteh ++ "بودند" ; => ndasht + "م" ; => ndasht + "یم" ; => ndasht + "ی"; => ndasht + "ید" ; => ndasht ; => ndasht + "ند" ; => ndasht + "م" ; => ndasht + "یم" ; => ndasht + "ی"; => ndasht + "ید" ; => ndasht ; => ndasht + "ند" ; => nkhah + "م" ++ dasht ; => nkhah + "یم" ++ dasht ; => nkhah + "ی" ++ dasht ; => nkhah + "ید" ++ dasht ; => nkhah + "د" ++ dasht ; => nkhah + "ند" ++ dasht ; => ndashteh ++ bvdh ++ "ام" ; => ndashteh ++ bvdh ++ "ایم" ; => ndashteh ++ bvdh ++ "ای" ; => ndashteh ++ bvdh ++ "اید" ; => ndashteh ++ bvdh ++ "است" ; => ndashteh ++ bvdh ++ "اند" ; => ndashteh ++ "ام" ; => ndashteh ++ "ایم" ; => ndashteh ++ "ای" ; => ndashteh ++ "اید" ; => ndashteh ++ "است" ; => ndashteh ++ "اند" }; } ; predProg : VPH -> VPH = \verb -> { s = \\vh => case vh of { VPTense pol (VPPres Simul) (AgPes n p) => { inf = (toHave Pos (PPresent2 PrImperf) n p).s ++ (verb.s ! VPTense pol (VPPres Simul) (AgPes n p)).inf } ; VPTense pol (VPPres Anter) (AgPes n p) => { inf = (verb.s ! VPTense pol (VPPres Anter) (AgPes n p)).inf } ; VPTense pol (VPPast Simul) (AgPes n p) => { inf = (toHave Pos (PPast2 PstAorist) n p).s ++ (verb.s ! VPTense pol (VPCond Simul) (AgPes n p)).inf } ; VPTense pol (VPPast Anter) (AgPes n p) => { inf = (verb.s ! VPTense pol (VPPast Anter) (AgPes n p)).inf } ; VPTense pol (VPFutr Simul) (AgPes n p) => { inf = (verb.s ! VPTense pol (VPFutr Simul) (AgPes n p)).inf } ; VPTense pol (VPFutr Anter) (AgPes n p) => { inf = (verb.s ! VPTense pol (VPFutr Anter) (AgPes n p)).inf } ; -- this is to be confirmed VPTense pol (VPCond Simul) (AgPes n p) => { inf = (toHave Pos (PPast2 PstAorist) n p).s ++ (verb.s ! VPTense pol (VPCond Simul) (AgPes n p)).inf } ; VPTense pol (VPCond Anter) (AgPes n p) => { inf = (toHave Pos (PPast2 PstAorist) n p).s ++ (verb.s ! VPTense pol (VPCond Anter) (AgPes n p)).inf } ; VVForm (AgPes n p) => {inf = (verb.s ! VVForm (AgPes n p)).inf} ; VPStem1 => { inf = (verb.s ! VPStem1).inf}; VPStem2 => { inf = (verb.s ! VPStem2).inf} ; VPImp pol n => { inf = (verb.s ! VPImp pol n).inf} -- need to be confirmed -- _ => { inf = (verb.s ! VPStem1).inf} }; obj = verb.obj ; subj = VIntrans ; inf = verb.inf; ad = verb.ad; wish = verb.wish; vComp = verb.vComp ; embComp = verb.embComp ; comp = verb.comp } ; ------------------------- -- Ezafa construction ------------------------ oper mkEzafa : Str -> Str ; mkEzafa str = case str of { st + "اه" => str ; st + "وه" => str ; st + "ه" => str ++ "ی" ; st + "او" => str ; st + "وو" => str ; st + "و" => str + "ی" ; st + "ا" => str + "ی" ; _ => str }; mkEnclic : Str -> Str ; mkEnclic str = case str of { st + "ا" => str ++ "یی" ; st + "و" => str ++ "یی" ; st + "ی" => str ++ "یی" ; st + "ه" => str ++ "یی" ; _ => str + "ی" }; IndefArticle : Str ; IndefArticle = "یک"; taryn : Str ; taryn = "ترین" ; --------------- -- making negatives --------------- addN : Str -> Str ; addN str = case str of { "ا" + st => "نی" + str ; "آ" + st => "نیا" + st ; _ => "ن" + str }; addBh2 : Str -> Str ; -- should use drop instead but it gives linking error addBh2 str1 = case str1 of { "می" + str => case str of { "ا" + st => Prelude.glue "بی" str ; -- need to use '+' but it gives linking error "آ" + st => Prelude.glue "بیا" st ; _ => Prelude.glue "ب" str }; _ => "" }; ----------------------------- -- Noun Phrase ----------------------------- {-toNP : Str -> Str = \pn, npc -> case npc of { NPC c => pn ! c ; NPObj => pn ! Dir ; NPErg => pn ! Obl } ; -} partNP : Str -> Str = \str -> (Prelude.glue str "ه") ++ "شده" ; -- partNP : Str -> Str = \str -> str + "ه" ++ "شده" ; ------------------------------------------ -- Agreement transformations ----------------------------------------- toAgr : Number -> PPerson -> AgrPes = \n,p -> AgPes n p; fromAgr : AgrPes -> {n : Number ; p : PPerson } = \agr -> case agr of { AgPes n p => {n = n ; p = p } } ; conjAgrPes : AgrPes -> AgrPes -> AgrPes = \a0,b0 -> let a = fromAgr a0 ; b = fromAgr b0 in toAgr (conjNumber a.n b.n) b.p; giveNumber : AgrPes -> Number =\a -> case a of { AgPes n _ => n }; -- defaultAgr : Agr = agrP3 Sg Inanimate ; -- agrP3 : Number -> Animacy -> Agr = \n,a -> Ag n PPers3 a ; defaultAgrPes : AgrPes = agrPesP3 Sg ; agrPesP3 : Number -> AgrPes = \n -> AgPes n PPers3 ; -- personalAgr : Agr = agrP1 Sg ; agrPesP1 : Number -> AgrPes = \n -> AgPes n PPers1 ; -------------------------------------------------------- -- Reflexive Pronouns ----------------------------------- reflPron : AgrPes => Str = table { AgPes Sg PPers1 => "خودم" ; AgPes Sg PPers2 => "خودت" ; AgPes Sg PPers3 => "خودش" ; AgPes Pl PPers1 => "خودمان" ; AgPes Pl PPers2 => "خودتان" ; AgPes Pl PPers3 => "خودشان" } ; getPron : Animacy -> Number -> Str = \ani,number -> case of { => "او" ; => ["آن ها"] ; => "آن" ; => ["آن ها"] }; }