diff --git a/lib/src/persian/AdjectivePes.gf b/lib/src/persian/AdjectivePes.gf new file mode 100644 index 000000000..5c1aa357f --- /dev/null +++ b/lib/src/persian/AdjectivePes.gf @@ -0,0 +1,48 @@ +concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in { + + flags coding = utf8; + lin + + PositA a = a ; + UseComparA a = a; + + ComparA a np = { + s =\\ez => a.s ! ez ++ "تر" ++ "از" ++ np.s ! NPC bEzafa ; + adv = a.adv + } ; + +---- $SuperlA$ belongs to determiner syntax in $Noun$. + + ComplA2 a np = { + s =\\ez => np.s ! NPC bEzafa ++ a.c2 ++ a.s ! ez ; + adv = a.adv + } ; + + ReflA2 a = { + s =\\ez => a.s ! ez ++ "" ; -- need to be fixed + adv = a.adv + } ; + + SentAP ap sc = { + s =\\ez => ap.s! ez ++ sc.s ; + adv = ap.adv + } ; + + AdAP ada ap = { + s =\\ez => ada.s ++ ap.s ! ez ; + adv = ap.adv + } ; + + UseA2 a = a ; + + CAdvAP cadv ap np = { + s =\\ez => cadv.s ++ np.s ! NPC bEzafa ++ ap.s ! ez ; + adv = ap.adv + }; + + AdjOrd ord = { s =\\_ => ord.s ; adv = ""}; + + + + AdvAP ap adv = {s =\\ez => ap.s ! ez ++ adv.s ; adv = ap.adv}; +} diff --git a/lib/src/persian/AdverbPes.gf b/lib/src/persian/AdverbPes.gf new file mode 100644 index 000000000..963d4bb70 --- /dev/null +++ b/lib/src/persian/AdverbPes.gf @@ -0,0 +1,22 @@ +concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in { + + flags coding = utf8; + lin + -- PositAdvAdj a = {s = a.s ! bEzafa } ; + PositAdvAdj a = {s = a.adv } ; + ComparAdvAdj cadv a np = { + s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! NPC bEzafa ; + } ; + ComparAdvAdjS cadv a s = { + s = a.adv ++ cadv.p ++ cadv.s ++ s.s; + } ; + + PrepNP prep np = {s = prep.s ++ np.s ! NPC aEzafa } ; + + AdAdv ada adv = { s = ada.s ++ adv.s} ; + +-- SubjS = cc2 ; + SubjS sub snt = {s = sub.s ++ "که" ++ snt.s } ; + AdnCAdv cadv = {s = cadv.s ++ "از"} ; + +} diff --git a/lib/src/persian/AllPes.gf b/lib/src/persian/AllPes.gf new file mode 100644 index 000000000..2623dea98 --- /dev/null +++ b/lib/src/persian/AllPes.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:../prelude + +concrete AllPer of AllPerAbs = + LangPer +-- ExtraPer + ** {} ; diff --git a/lib/src/persian/AllPesAbs.gf b/lib/src/persian/AllPesAbs.gf new file mode 100644 index 000000000..b6e82e39d --- /dev/null +++ b/lib/src/persian/AllPesAbs.gf @@ -0,0 +1,4 @@ +abstract AllPerAbs = + Lang +-- ExtraPnbAbs + ** {} ; diff --git a/lib/src/persian/CatPes.gf b/lib/src/persian/CatPes.gf new file mode 100644 index 000000000..d0c7265d7 --- /dev/null +++ b/lib/src/persian/CatPes.gf @@ -0,0 +1,95 @@ +concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { + + flags optimize=all_subs ; + + lincat +------ Tensed/Untensed + + S = {s : Str} ; + QS = {s : QForm => Str} ; + RS = {s : AgrPes => Str } ; -- c for it clefts + SSlash = {s : Str ; c2 : ResPes.Compl} ; + +---- Sentence + + Cl = ResPes.Clause ; + ClSlash = { + s : ResPes.VPHTense => Polarity => Order => Str ; + c2 : ResPes.Compl + } ; + Imp = {s : CPolarity => ImpForm => Str} ; + +---- Question + QCl = {s : ResPes.VPHTense => Polarity => QForm => Str} ; + + IP = {s: Str ; n : Number}; + +-- IDet = {s :Number => Str } ; + IDet = {s : Str ; n : Number ; isNum : Bool} ; + IQuant = {s : Str ; n : Number } ; + +---- Relative + + RCl = { + s : ResPes.VPHTense => Polarity => Order => AgrPes => Str ; + -- c : Case + } ; + RP = {s: Str ; a:RAgr}; + +---- Verb + + VP = ResPes.VPH ; + + VPSlash = ResPes.VPHSlash ; + Comp = {s : AgrPes => Str} ; + +---- Adv + Adv = {s : Str} ; + +---- Adjective + + AP = ResPes.Adjective ; + +---- Noun + + CN = ResPes.Noun ; + + NP = ResPes.NP ; + Pron = {s : Str ; ps : Str ; a : AgrPes}; + Det = ResPes.Determiner ; + Predet = {s : Str} ; + Num = {s : Str ; n : Number} ; + Card = {s : Str; n : Number} ; + Ord = {s : Str; n : Number} ; + Quant = {s: Number => Str ; a:AgrPes ; fromPron : Bool}; + Art = {s : Str} ; + +---- Numeral + + Numeral = {s : CardOrd => Str ; n : Number} ; + Digits = {s : CardOrd => Str ; n : Number } ; + +---- Structural + + Conj = {s1,s2 : Str ; n : Number} ; +-----b Conj = {s : Str ; n : Number} ; +-----b DConj = {s1,s2 : Str ; n : Number} ; + Subj = {s : Str} ; + Prep = {s : Str }; +---- Open lexical classes, e.g. Lexicon + V, VS, VQ, VA = ResPes.Verb ; -- = {s : VForm => Str} ; + + V2, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ; + V3 = ResPes.Verb ** {c2, c3 : Str} ; + VV = ResPes.Verb ** { isAux : Bool} ; + V2V = ResPes.Verb ** {c1 : Str ; c2 : Str ; isAux : Bool} ; + A = ResPes.Adjective ; --- {s : Gender => Number => Case => Str} ; + A2 = ResPes.Adjective ** { c2 : Str} ; + + N = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool} ; + + N2 = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool} ** {c : Str}; + N3 = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool} ** {c2 : Str ; c3 : Str } ; + PN = {s : Str ; animacy : Animacy} ; + +} diff --git a/lib/src/persian/ConjunctionPes.gf b/lib/src/persian/ConjunctionPes.gf new file mode 100644 index 000000000..09e36e327 --- /dev/null +++ b/lib/src/persian/ConjunctionPes.gf @@ -0,0 +1,46 @@ + +concrete ConjunctionPes of Conjunction = + CatPes ** open ResPes, Coordination, Prelude in { + + + flags optimize=all_subs ; + + lin + + ConjS = conjunctDistrSS ; + + ConjAdv = conjunctDistrSS ; +-- ConjAdv conj advs = conjunctDistrTable Gender conj advs ; + + ConjNP conj ss = conjunctDistrTable NPCase conj ss ** { + a = conjAgrPes (agrPesP3 conj.n) ss.a ; + animacy = ss.animacy ; + } ; + + ConjAP conj ss = conjunctDistrTable Ezafa conj ss ** {adv = ss.adv}; + ConjRS conj rs = conjunctDistrTable AgrPes conj rs ** { c = rs.c}; + +---- These fun's are generated from the list cat's. + + BaseS = twoSS ; + ConsS = consrSS comma ; + BaseAdv = twoSS ; +-- BaseAdv x y = twoTable Gender x y ; + ConsAdv = consrSS comma ; +-- ConsAdv xs x = consrTable Gender comma xs x ; + BaseNP x y = twoTable NPCase x y ** {a = conjAgrPes x.a y.a ; animacy = y.animacy } ; -- check animacy + BaseRS x y = twoTable AgrPes x y ** {c = x.c}; + ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgrPes xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ; + ConsRS xs x = consrTable AgrPes comma xs x ** { c = xs.c}; +-- BaseAP x y = twoTable3 Number Gender Case x y ; -- ** {isPre = andB x.isPre y.isPre} ; + BaseAP x y = twoTable Ezafa x y ** {adv = x.adv}; + ConsAP xs x = consrTable Ezafa comma xs x ** {adv = x.adv}; -- Table3 Number Gender Case comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ; + + lincat + [S] = {s1,s2 : Str} ; + [Adv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : NPCase => Str ; a : AgrPes ; animacy : Animacy } ; + [AP] = {s1,s2 : Ezafa => Str ; adv : Str} ; + [RS] = {s1,s2 : AgrPes => Str }; + +} diff --git a/lib/src/persian/Coordination.gf b/lib/src/persian/Coordination.gf new file mode 100644 index 000000000..faa30ba7e --- /dev/null +++ b/lib/src/persian/Coordination.gf @@ -0,0 +1,170 @@ +resource Coordination = open Prelude in { + +param + ListSize = TwoElem | ManyElem ; + +oper + ListX = {s1,s2 : Str} ; + + twoStr : (x,y : Str) -> ListX = \x,y -> + {s1 = x ; s2 = y} ; + consStr : Str -> ListX -> Str -> ListX = \comma,xs,x -> + {s1 = xs.s1 ++ comma ++ xs.s2 ; s2 = x } ; + + twoSS : (_,_ : SS) -> ListX = \x,y -> + twoStr x.s y.s ; + consSS : Str -> ListX -> SS -> ListX = \comma,xs,x -> + consStr comma xs x.s ; + + Conjunction : Type = SS ; + ConjunctionDistr : Type = {s1 : Str ; s2 : Str} ; + + conjunctX : Conjunction -> ListX -> Str = \or,xs -> + xs.s1 ++ or.s ++ xs.s2 ; + + conjunctDistrX : ConjunctionDistr -> ListX -> Str = \or,xs -> + or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2 ; + + conjunctSS : Conjunction -> ListX -> SS = \or,xs -> + ss (xs.s1 ++ or.s ++ xs.s2) ; + + conjunctDistrSS : ConjunctionDistr -> ListX -> SS = \or,xs -> + ss (or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2) ; + + -- all this lifted to tables + + ListTable : Type -> Type = \P -> {s1,s2 : P => Str} ; + + twoTable : (P : Type) -> (_,_ : {s : P => Str}) -> ListTable P = \_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable : (P : Type) -> Str -> ListTable P -> {s : P => Str} -> ListTable P = + \P,c,xs,x -> + {s1 = table P {o => xs.s1 ! o ++ c ++ xs.s2 ! o} ; s2 = x.s} ; + + conjunctTable : (P : Type) -> Conjunction -> ListTable P -> {s : P => Str} = + \P,or,xs -> + {s = table P {p => xs.s1 ! p ++ or.s ++ xs.s2 ! p}} ; + + conjunctDistrTable : + (P : Type) -> ConjunctionDistr -> ListTable P -> {s : P => Str} = \P,or,xs -> + {s = table P {p => or.s1++ xs.s1 ! p ++ or.s2 ++ xs.s2 ! p}} ; + + -- ... and to two- and three-argument tables: how clumsy! --- + + ListTable2 : Type -> Type -> Type = \P,Q -> + {s1,s2 : P => Q => Str} ; + + twoTable2 : (P,Q : Type) -> (_,_ : {s : P => Q => Str}) -> ListTable2 P Q = + \_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable2 : + (P,Q : Type) -> Str -> ListTable2 P Q -> {s : P => Q => Str} -> ListTable2 P Q = + \P,Q,c,xs,x -> + {s1 = table P {p => table Q {q => xs.s1 ! p ! q ++ c ++ xs.s2 ! p! q}} ; + s2 = x.s + } ; + + conjunctTable2 : + (P,Q : Type) -> Conjunction -> ListTable2 P Q -> {s : P => Q => Str} = + \P,Q,or,xs -> + {s = table P {p => table Q {q => xs.s1 ! p ! q ++ or.s ++ xs.s2 ! p ! q}}} ; + + conjunctDistrTable2 : + (P,Q : Type) -> ConjunctionDistr -> ListTable2 P Q -> {s : P => Q => Str} = + \P,Q,or,xs -> + {s = + table P {p => table Q {q => or.s1++ xs.s1 ! p ! q ++ or.s2 ++ xs.s2 ! p ! q}}} ; + + ListTable3 : Type -> Type -> Type -> Type = \P,Q,R -> + {s1,s2 : P => Q => R => Str} ; + + twoTable3 : (P,Q,R : Type) -> (_,_ : {s : P => Q => R => Str}) -> + ListTable3 P Q R = + \_,_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable3 : + (P,Q,R : Type) -> Str -> ListTable3 P Q R -> {s : P => Q => R => Str} -> + ListTable3 P Q R = + \P,Q,R,c,xs,x -> + {s1 = \\p,q,r => xs.s1 ! p ! q ! r ++ c ++ xs.s2 ! p ! q ! r ; + s2 = x.s + } ; + + conjunctTable3 : + (P,Q,R : Type) -> Conjunction -> ListTable3 P Q R -> {s : P => Q => R => Str} = + \P,Q,R,or,xs -> + {s = \\p,q,r => xs.s1 ! p ! q ! r ++ or.s ++ xs.s2 ! p ! q ! r} ; + + conjunctDistrTable3 : + (P,Q,R : Type) -> ConjunctionDistr -> ListTable3 P Q R -> + {s : P => Q => R => Str} = + \P,Q,R,or,xs -> + {s = \\p,q,r => or.s1++ xs.s1 ! p ! q ! r ++ or.s2 ++ xs.s2 ! p ! q ! r} ; + + --------- + ListTable4 : Type -> Type -> Type -> Type -> Type = \P,Q,R,T -> + {s1,s2 : P => Q => R => T => Str} ; + + twoTable4 : (P,Q,R,T : Type) -> (_,_ : {s : P => Q => R => T => Str}) -> + ListTable4 P Q R T = + \_,_,_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable4 : + (P,Q,R,T : Type) -> Str -> ListTable4 P Q R T -> {s : P => Q => R => T => Str} -> + ListTable4 P Q R T = + \P,Q,R,T,c,xs,x -> + {s1 = \\p,q,r,t => xs.s1 ! p ! q ! r ! t ++ c ++ xs.s2 ! p ! q ! r ! t ; + s2 = x.s + } ; + + conjunctTable4 : + (P,Q,R,T : Type) -> Conjunction -> ListTable4 P Q R T -> {s : P => Q => R => T => Str} = + \P,Q,R,T,or,xs -> + {s = \\p,q,r,t => xs.s1 ! p ! q ! r ! t ++ or.s ++ xs.s2 ! p ! q ! r ! t} ; + + conjunctDistrTable4 : + (P,Q,R,T : Type) -> ConjunctionDistr -> ListTable4 P Q R T -> + {s : P => Q => R => T => Str} = + \P,Q,R,T,or,xs -> + {s = \\p,q,r,t => or.s1++ xs.s1 ! p ! q ! r ! t ++ or.s2 ++ xs.s2 ! p ! q ! r ! t} ; + -------------- + + comma = "," ; + +-- you can also do this to right-associative lists: + + consrStr : Str -> Str -> ListX -> ListX = \comma,x,xs -> + {s1 = x ++ comma ++ xs.s1 ; s2 = xs.s2 } ; + + consrSS : Str -> SS -> ListX -> ListX = \comma,x,xs -> + consrStr comma x.s xs ; + + consrTable : (P : Type) -> Str -> {s : P => Str} -> ListTable P -> ListTable P = + \P,c,x,xs -> + {s1 = table P {o => x.s ! o ++ c ++ xs.s1 ! o} ; s2 = xs.s2} ; + + consrTable2 : (P,Q : Type) -> Str -> {s : P => Q => Str} -> + ListTable2 P Q -> ListTable2 P Q = + \P,Q,c,x,xs -> + {s1 = table P {p => table Q {q => x.s ! p ! q ++ c ++ xs.s1 ! p ! q}} ; + s2 = xs.s2 + } ; + consrTable4 : (P,Q,R,T : Type) -> Str -> {s : P => Q => R => T => Str} -> + ListTable4 P Q R T -> ListTable4 P Q R T = + \P,Q,R,T,c,x,xs -> + {s1 = table P {p => table Q {q => table R { r => table T {t => x.s ! p ! q ! r ! t ++ c ++ xs.s1 ! p ! q ! r ! t}}}} ; + s2 = xs.s2 + } ; + consrTable3 : (P,Q,R : Type) -> Str -> {s : P => Q => R => Str} -> + ListTable3 P Q R -> ListTable3 P Q R = + \P,Q,R,c,x,xs -> + {s1 = table P {p => table Q {q => table R {t => x.s ! p ! q ! t ++ c ++ xs.s1 ! p ! q ! t }}} ; + s2 = xs.s2 + } ; + + +} ; diff --git a/lib/src/persian/ExtraPes.gf b/lib/src/persian/ExtraPes.gf new file mode 100644 index 000000000..87339c8fe --- /dev/null +++ b/lib/src/persian/ExtraPes.gf @@ -0,0 +1,19 @@ +concrete ExtraPes of ExtraPesAbs = CatPes ** + open ResPes, Coordination, Prelude, MorphoPes, ParadigmsPes in { + + flags coding = utf8; + + lin + GenNP np = {s = \\_,_,_ => np.s ! NPC Obl ++ "ka" ; a = np.a} ; + + each_Det = mkDet "hr kwy" "hr kwy" "hr kwy" "hr kwy" Sg ; + have_V = mkV "rakh-na"; + IAdvAdv adv = {s = "ktny" ++ adv.s} ; + ICompAP ap = {s = "ktnE" ++ ap.s ! Sg ! Masc ! Dir ! Posit} ; + cost_V = mkV "qymt" ; + + -- added for causitives + make_CV = mkVerb "nothing" ** {c2 = "" }; + +-- for VP conjunction +} diff --git a/lib/src/persian/GrammarPes.gf b/lib/src/persian/GrammarPes.gf new file mode 100644 index 000000000..0749eb17f --- /dev/null +++ b/lib/src/persian/GrammarPes.gf @@ -0,0 +1,25 @@ +--# -path=.:../abstract:../common:../prelude + + concrete GrammarPes of Grammar = + NounPes, + VerbPes, + AdjectivePes, + AdverbPes, + NumeralPes, + SentencePes, + QuestionPes, + RelativePes, + ConjunctionPes, + + PhrasePes, + TextPes - [Adv], + StructuralPes, + TenseX - [Adv], + IdiomPes + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text ; + +} + + diff --git a/lib/src/persian/IdiomPes.gf b/lib/src/persian/IdiomPes.gf new file mode 100644 index 000000000..0a05e2a48 --- /dev/null +++ b/lib/src/persian/IdiomPes.gf @@ -0,0 +1,40 @@ +concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in { + + flags optimize=all_subs ; + flags coding = utf8; + + lin + + ImpersCl vp = mkSClause " " (agrPesP3 Sg) vp ; + GenericCl vp = mkSClause "آدم" (agrPesP3 Sg) vp ; + + CleftNP np rs = + let cl = mkSClause (np.s ! NPC bEzafa) (np.a) (predAux auxBe); + in + {s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a }; + + CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s}; + + ExistNP np = + mkSClause " " (agrPesP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPC bEzafa) (predAux auxBe)) ; + + ExistIP ip = + let cl = mkSClause ( ip.s ) (agrPesP3 ip.n) (predAux auxBe); + in { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! ODir; + QIndir => cl.s ! t! p ! ODir + } + }; + +-- ProgrVP vp = insertObj (\\a => vp.obj.s ++ vp.ad ++ vp.comp ! a ++ (vp.s ! VPStem).inf ++ raha (fromAgr a).g (fromAgr a).n ) (predAux auxBe) ; + ProgrVP vp = (predProg vp) ; + + + ImpPl1 vp = {s = "بیایید" ++ (vp.s ! VVForm (agrPesP1 Pl)).inf} ; + ImpP3 np vp = {s = "بگذارید" ++ np.s!NPC bEzafa ++ (vp.s ! VVForm (AgPes (fromAgr np.a).n (fromAgr np.a).p)).inf}; + + +} + diff --git a/lib/src/persian/LangPes.gf b/lib/src/persian/LangPes.gf new file mode 100644 index 000000000..13ef882f4 --- /dev/null +++ b/lib/src/persian/LangPes.gf @@ -0,0 +1,10 @@ +--# -path=.:../abstract:../common:../hindustani + +concrete LangPes of Lang = + GrammarPes, + LexiconPes + ** { + +flags startcat = Phr ; unlexer=unwords ; lexer=words ; + +} diff --git a/lib/src/persian/LexiconPes.gf b/lib/src/persian/LexiconPes.gf new file mode 100644 index 000000000..1853c9281 --- /dev/null +++ b/lib/src/persian/LexiconPes.gf @@ -0,0 +1,374 @@ +--# -path=.:prelude:alltenses + +concrete LexiconPes of Lexicon = CatPes ** +--open ResPnb, Prelude in { + open ParadigmsPes,MorphoPes, Prelude in { + + flags + optimize=values ; + coding = utf8; + + lin + + airplane_N = mkN01 "هواپیما" inanimate ; + answer_V2S = mkV2 (compoundV "جواب" (mkV "دادن" "ده")) "به" False; + apartment_N = mkN01 "آپارتمان" inanimate; + apple_N = mkN01 "سیب" inanimate; + art_N = mkN01 "هنر" inanimate; + ask_V2Q = mkV2 (mkV_1 "پرسیدن") "از" False; + baby_N = mkN01 "بچه" animate; -- has variant "کودک" + bad_A = mkA "بد" ; + bank_N = mkN01 "بانک" inanimate; + beautiful_A = mkA "زیبا" ; + become_VA = mkV "شدن" "شو"; + beer_N = mkN01 "آبجو" inanimate; + beg_V2V = mkV2V (compoundV "خواهش" (mkV "کردن" "کن")) "از" "" False; + big_A = mkA "بزرگ" ; + bike_N = mkN01 "دوچرخه" inanimate; + bird_N = mkN02 "پرنده" animate; + black_A = mkA "سیاه" ; + blue_A = mkA "آبی" ; + boat_N = mkN01 "قایق" inanimate; + book_N = mkN01 "کتاب" inanimate; + boot_N = mkN01 "چکمه" inanimate; -- has variant "پوتین" + boss_N = mkN02 "کارفرما" animate; + boy_N = mkN02 "پسر" animate; + bread_N = mkN01 "نان" inanimate; + break_V2 = mkV2 (mkV "شکستن" "شکن") "را"; + broad_A = mkA "وسیع" ; + brother_N2 = (mkN01 "برادر" animate) ** {c=""}; + brown_A = mkA ["قهوه ای"] ; + butter_N = mkN01 "کره" inanimate; + buy_V2 = mkV2 (mkV_1 "خریدن") "را"; + camera_N = mkN01 "دوربین" inanimate; + cap_N = mkCmpdNoun1 "کلاه" (mkN01 "کپ" animate); + car_N = mkN01 "ماشین" inanimate; -- has variant "اتومبیل" + carpet_N = mkN01 "فرش" inanimate; + cat_N = mkN01 "گربه" animate; + ceiling_N = mkN01 "سقف" inanimate; + chair_N = mkN01 "صندلی" inanimate; + cheese_N = mkN01 "پنیر" inanimate; + child_N = mkN02 "فرزند" animate; -- has variant "بچه" + church_N = mkN01 "کلیسا" inanimate; + city_N = mkN01 "شهر" inanimate; + clean_A = mkA "تمیز" ; + clever_A = mkA "باهوش" ["با هوشمندی"]; + close_V2 = mkV2 (mkV "بستن" "بند") "را"; + coat_N = mkN01 "کت" inanimate; + cold_A = mkA "سرد" ; + come_V = mkV "آمدن" "آی" ; + computer_N = mkN01 "کامپیوتر" inanimate; -- also vaiant "رایانه" + country_N = mkN01 "کشور" inanimate; + +-- Note: cousin inflects for gender and for being a mother's or a father's relatives in persian +-- The following is an example which is the daughter of your mom's brother + cousin_N = mkCmpdNoun1 "دختر" (mkN01 "دایی" animate); + cow_N = mkN01 "گاو" animate; + die_V = mkV "مردن" "میر" ; + dirty_A = mkA "کثیف" ; + distance_N3 = (mkN "فاصله" "فواصل" inanimate ) ** {c2="از" ; c3 = "تا"}; + doctor_N = mkN01 "دکتر" animate; -- has variant "پزشک", but only a doctor in medicine + dog_N = mkN01 "سگ" animate; + door_N = mkN01 "در" inanimate; + drink_V2 = mkV2 (mkV_1 "نوشیدن") "را"; +-- easy_A2V = mkA "آسان" "" ; + eat_V2 = mkV2 (mkV_2 "خوردن") "را" ; + empty_A = mkA "خالی" ; + enemy_N = mkN02 "دشمن" animate; + factory_N = mkN01 "کارخانه" inanimate; + father_N2 = (mkN02 "پدر" animate) ** {c=""}; + fear_VS = mkV_1 "ترسیدن"; + find_V2 = mkV2 (compoundV "پیدا" (mkV "کردن" "کن") ) "را"; + fish_N = mkN01 "ماهی" animate; + floor_N = mkN01 "زمین" inanimate; -- Note: floor in persian can have 3 different translations + forget_V2 = mkV2 (compoundV "فراموش" (mkV "کردن" "کن")) "را" ; + fridge_N = mkN01 "یخچال" inanimate; + friend_N = mkN02 "دوست" animate; + fruit_N = mkN01 "میوه" inanimate; +-- fun_AV = mkAV "جالب" ; + garden_N = mkN01 "باغ" inanimate; + girl_N = mkN02 "دختر" animate; + glove_N = mkN01 "دستکش" inanimate; + gold_N = mkN01 "طلا" inanimate; + good_A = mkA "خوب" ; + go_V = mkV "رفتن" "رو"; + green_A = mkA "سبز" ; + harbour_N = mkN "بندر" "بنادر" inanimate; +-- hate_V2 = mkV2 (compoundV "متنفر" (mkToBe "بودن" "باش" "هست")) "از" False; -- needs from/ verb to be + hat_N = mkN01 "کلاه" inanimate; + have_V2 = mkV2 haveVerb "را" ; + hear_V2 = mkV2 (mkV "شنیدن" "شنو") "را" ; + hill_N = mkN01 "تپه" inanimate; +-- hope_VS = compoundV "امیدوار" (mkToBe "بودن" "باش" "هست"); + horse_N = mkN01 "اسب" animate; + hot_A = mkA "داغ" ["داغ داغ"] ; + house_N = mkN01 "خانه" inanimate; + important_A = mkA "مهم" ["با اهمیت"]; + industry_N = mkN "صنعت" "صنایع" inanimate; + iron_N = mkN01 "آهن" inanimate; + king_N = mkN "پادشاه" "پادشاهان" animate; + know_V2 = mkV2 (mkV "شناختن" "شناس") "را"; + know_VS = (mkV_1 "دانستن"); + know_VQ = (mkV_1 "دانستن") ; + lake_N = mkN01 "دریاچه" inanimate; + lamp_N = mkN01 "چراغ" inanimate; -- also "لامپ", but they have different usage + learn_V2 = mkV2 (compoundV "یاد"(mkV "گرفتن" "گیر")) "را"; + leather_N = mkN01 "چرم" inanimate; -- is uncountable + leave_V2 = mkV2 (compoundV "ترک"(mkV "کردن" "کن")) "را"; + like_V2 = mkV2 (compoundV "دوست" haveVerb) "را"; + listen_V2 = mkV2 (compoundV "گوش" (mkV "دادن" "ده")) "به" False; -- has a diferent preposition :"به" + live_V = compoundV "زندگی" (mkV "کردن" "کن"); + long_A = mkA "بلند" ; + lose_V2 = mkV2 (compoundV "گم" (mkV "کردن" "کن")) "را" ; + love_N = mkN01 "عشق" inanimate; + love_V2 = mkV2 (compoundV "دوست" haveVerb) "را"; -- also possible: love_V2 = mkV2 (compoundV "عاشق" (mkToBe "بودن" "باش" "هست")); + man_N = mkN02 "مرد" animate; + married_A2 = mkA "متأهل" ""; + meat_N = mkN01 "گوشت" inanimate; + milk_N = mkN01 "شیر" inanimate; + moon_N = mkN01 "ماه" inanimate; -- is this not a proper noun? + mother_N2 = (mkN02 "مادر" animate) ** {c=""}; + mountain_N = mkN01 "کوه" inanimate; + music_N = mkN "موسیقی" "موسیقی" animate; + narrow_A = mkA "باریک" ; + new_A = mkA "نو" "تازه"; + newspaper_N = mkN01 "روزنامه" inanimate; + oil_N = mkN "نفت" "نفت" inanimate; -- also "روغن" + old_A = mkA "پیر" "پیرانه"; + open_V2 = mkV2 (compoundV "باز" (mkV "کردن" "کن")) "را"; + paint_V2A = mkV2 (compoundV "رنگ" (mkV "کردن" "کن")) "را" ; + paper_N = mkN01 "کاغذ" inanimate; + paris_PN = mkPN "پاریس" inanimate; + peace_N = mkN01 "صلح" inanimate; -- also "آرامش" + pen_N = mkN01 "قلم" inanimate; -- has variant "خودکار" + planet_N = mkN01 "سیّاره" inanimate; + plastic_N = mkN01 "پلاستیک" inanimate; -- is uncountable + play_V2 = mkV2 (mkV "نواختن" "نواز") "را" ; + policeman_N = mkCmpdNoun2 (mkN02 "مأمور" animate) "پلیس"; + priest_N = mkN01 "کشیش" animate; +-- probable_AS = mkAS (regA "محتمل") ; + queen_N = mkN01 "ملکه" animate; + radio_N = mkN01 "رادیو" inanimate; + rain_V0 = compoundV "باران" (mkV "آمدن" "آی" ) ; + read_V2 = mkV2 (mkV_2 "خواندن") "را"; + red_A = mkA "قرمز" ; + religion_N = mkN "مذهب" "مذاهب" inanimate; + restaurant_N = mkN01 "رستوران" inanimate; + river_N = mkN01 "رودخانه" inanimate; + rock_N = mkN01 "صخره" inanimate; + roof_N = mkN01 "بام" inanimate; -- has variant "سقف" + rubber_N = mkN01 "پاککن" inanimate; -- also "لاستیک" + run_V = mkV_1 "دویدن" ; + say_VS = mkV "گفتن" "گوی" ; + school_N = mkN "مدرسه" "مدارس" inanimate; + science_N = mkN "علم" "علوم" inanimate; -- also "دانش" + sea_N = mkN01 "دریا" inanimate; + seek_V2 = mkV2 (compoundV "جستجو" (mkV "کردن" "کن")) "را"; + see_V2 = mkV2 (mkV "دیدن" "بین") "را" ; + sell_V3 = mkV3 (mkV "فروختن" "فروش") "را" "به"; + send_V3 = mkV3 (mkV_1 "فرستادن") "را" "برای"; + sheep_N = mkN01 "گوسفند" animate; + ship_N = mkN01 "کشتی" inanimate; + shirt_N = mkN01 "پیراهن" inanimate; + shoe_N = mkN01 "کفش" inanimate; + shop_N = mkN01 "فروشگاه" inanimate; -- has variant "مغازه" + short_A = mkA "کوتاه" ; + silver_N = mkN "نقره" ["نقره جات"] inanimate; -- add new function which applies + "جات" + sister_N = mkN02 "خواهر" animate; + sleep_V = mkV_1 "خوابیدن" ; + small_A = mkA "کوچک" ; + snake_N = mkN01 "مار" animate; + sock_N = mkN01 "جوراب" inanimate; + speak_V2 = mkV2 (compoundV "صحبت" (mkV "کردن" "کن")) "با" False; + star_N = mkN01 "ستاره" animate; + steel_N = mkN01 "فولاد" inanimate; -- also "استیل" + stone_N = mkN01 "سنگ" inanimate; + stove_N = mkN01 "اجاق" inanimate; + student_N = mkCmpdNoun1 "دانش" (mkN02 "آموز" animate); -- also "دانشجو" + stupid_A = mkA "ابله" "ابلهانه" ; + sun_N = mkN01 "خورشید" inanimate; -- is this not a proper noun?!!! + switch8off_V2 = mkV2 (compoundV "خاموش" (mkV "کردن" "کن")) "را"; + switch8on_V2 = mkV2 (compoundV "روشن" (mkV "کردن" "کن")) "را"; + table_N = mkN01 "میز" inanimate; + talk_V3 = mkV3 (compoundV "حرف" (mkV "زدن" "زن")) "با" [" درباره ی"]; + teacher_N = mkN02 "معلم" animate; + teach_V2 = mkV2 (compoundV "آموزش" (mkV "دادن" "ده")) "را"; + television_N = mkN01 "تلوزیون" inanimate; + thick_A = mkA "کلفت" ; + thin_A = mkA "نازک" ; + train_N = mkN01 "قطار" inanimate; + travel_V = compoundV "سفر" (mkV "کردن" "کن"); + tree_N = mkN02 "درخت" animate; + trousers_N = mkN01 "شلوار" inanimate; + ugly_A = mkA "زشت" ; + understand_V2 = mkV2 (mkV_1 "فهمیدن") "را"; + university_N = mkN01 "دانشگاه" inanimate; + village_N = mkN01 "روستا" inanimate; +-- wait_V2 = mkV2 (compoundV "منتظر" (mkVToBe "بودن" "باش")); + walk_V = compoundV "راه" (mkV "رفتن" "رو"); + warm_A = mkA "گرم" ; + war_N = mkN01 "جنگ" inanimate; +-- watch_V2 = mkV2 (compoundV "مراقب" (mkVToBe "بودن" "باش")); -- check harfe rabt!!! + water_N = mkN01 "آب" inanimate; + white_A = mkA "سفید" ; + window_N = mkN01 "پنجره" inanimate; + wine_N = mkN01 "شراب" inanimate; + win_V2 = mkV2 (compoundV "برنده" (mkV "شدن" "شو")) "را"; -- also possible with simple verb: mkV_2 "بردن" + woman_N = mkN02 "زن" animate; +-- wonder_VQ = compoundV "متعجب" (mkVToBe "بودن" "باش") ; + wood_N = mkN01 "چوب" inanimate; + write_V2 = mkV2 (mkV "نوشتن" "نویس") "را" ; + yellow_A = mkA "زرد" ; + young_A = mkA "جوان""جوانانه" ; + do_V2 = mkV2 (compoundV "انجام" (mkV "دادن" "ده")) "را"; + now_Adv = ss "حالا" ; + already_Adv = ss "قبلاً" ; + song_N = mkN01 "آواز" inanimate; + add_V3 = mkV3 (compoundV "اضافه" (mkV "کردن" "کن")) "را" "به" ; + number_N = mkN01 "عدد" inanimate; -- also "تعداد" + put_V2 = mkV2 (mkV "گذاشتن" "گذار") "را"; + stop_V = compoundV "توقف" (mkV "کردن" "کن"); + jump_V = mkV_1 "پریدن"; +{- + left_Ord = {s = "چپ" ; n = singular}; + right_Ord = {s= "راست" ; n = singular}; +-} + far_Adv = ss "دور" ; + correct_A = mkA "درست" ; + dry_A = mkA "خشک" ["به خشکی"] ; + dull_A = mkA ["ملال آور"] ["به طرزی ملال آور"] ; + full_A = mkA "پر" ; + heavy_A = mkA "سنگین" ; + near_A = mkA "نزدیک" ; + rotten_A = mkA "خراب" ; + round_A = mkA "گرد" ; + sharp_A = mkA "تیز" ; + smooth_A = mkA "نرم" ; + straight_A = mkA "مستقیم" "مستقیماً"; + wet_A = mkA "خیس" ; + wide_A = mkA "پهن" ; + animal_N = mkN "حیوان" "حیوانات" animate; + ashes_N = mkN01 "خاکستر" inanimate; + back_N = mkN01 "کمر" inanimate; + bark_N = mkN01 "عوعو" inanimate; + belly_N = mkN01 "شکم" inanimate; + blood_N = mkN01 "خون" inanimate; + bone_N = mkN01 "استخوان" inanimate; + breast_N = mkN01 "سینه" inanimate; + cloud_N = mkN01 "ابر" inanimate; + day_N = mkN01 "روز" inanimate; + dust_N = mkN01 "غبار" inanimate; + ear_N = mkN01 "گوش" inanimate; + earth_N = mkN01 "زمین" inanimate; -- also "خاک" + egg_N = mkCmpdNoun1 "تخم" (mkN01 "مرغ" inanimate); + eye_N = mkN01 "چشم" inanimate ; + fat_N = mkN01 "چربی" inanimate; + feather_N = mkN01 "پر" inanimate; + fingernail_N = mkN01 "ناخن" inanimate; + fire_N = mkN01 "آتش" inanimate; + flower_N = mkN01 "گل" inanimate; + fog_N = mkN01 "مه" inanimate; + foot_N = mkN01 "پا" inanimate; + forest_N = mkN01 "جنگل" inanimate; + grass_N = mkN01 "چمن" inanimate; + guts_N = mkN01 "شهامت" inanimate; + hair_N = mkN01 "مو" inanimate; + hand_N = mkN01 "دست" inanimate; + head_N = mkN01 "سر" inanimate; + heart_N = mkN01 "قلب" inanimate; + horn_N = mkN01 "بوق" inanimate; -- also "شاخ" + husband_N = mkN02 "شوهر" animate; + ice_N = mkN01 "یخ" inanimate; + knee_N = mkN01 "زانو" inanimate; + leaf_N = mkN01 "برگ" inanimate; + leg_N = mkN01 "پا" inanimate; + liver_N = mkN01 "رودخانه" inanimate; + louse_N = mkN01 "شپش" inanimate; + mouth_N = mkN01 "دهان" inanimate; + name_N = mkN01 "نام" inanimate; -- has variant "اسم" + neck_N = mkN01 "گردن" inanimate; + night_N = mkN01 "شب" inanimate; + nose_N = mkN01 "بینی" inanimate; + person_N = mkN "شخص" "اشخاص" animate; + rain_N = mkN01 "باران" inanimate; + road_N = mkN01 "جاده" inanimate; + root_N = mkN01 "ریشه" inanimate; + rope_N = mkN01 "طناب" inanimate; + salt_N = mkN01 "نمک" inanimate; + sand_N = mkN01 "ماسه" inanimate; + seed_N = mkN01 "دانه" inanimate; + skin_N = mkN01 "پوست" inanimate; + sky_N = mkN01 "آسمان" inanimate; + smoke_N = mkN01 "دود" inanimate; + snow_N = mkN01 "برف" inanimate; + stick_N = mkN01 "ترکه" inanimate; + tail_N = mkN01 "دم" inanimate; + tongue_N = mkN01 "زبان" inanimate; + tooth_N = mkN01 "دندان" inanimate; + wife_N = mkN02 "همسر" animate; + wind_N = mkN01 "باد" inanimate; + wing_N = mkN01 "بال" inanimate; + worm_N = mkN01 "کرم" inanimate; + year_N = mkN01 "سال" inanimate; + blow_V = mkV_1 "دمیدن" ; + breathe_V = compoundV "نفس" (mkV_1 "کشیدن"); + burn_V = mkV "سوختن" "سوز" ; + dig_V = mkV_2 "کندن" ; + fall_V = mkV_1 "افتادن" ; +-- float_V = compoundV "شناور" (mkToBe "بودن" "باش" "هست") ; + flow_V = compoundV "جاری" (mkV "شدن" "شو") ; + fly_V = compoundV "پرواز" (mkV "کردن" "کن") ; + freeze_V = compoundV "یخ" (mkV "زدن" "زن") ; + give_V3 = mkV3 (mkV "دادن" "ده") "را" "به"; + laugh_V = mkV_1 "خندیدن" ; + lie_N = mkN01 "دروغ" inanimate; + lie_V = compoundV "دروغ" (mkV "گفتن" "گو" ); + play_V = compoundV "بازی" (mkV "کردن" "کن"); + sew_V = mkV "دوختن" "دوز" ; + sing_V = compoundV "آواز" (mkV_2 "خواندن"); + sit_V = mkV "نشستن" "نشین" ; + smell_V = compoundV "بو" (mkV "دادن" "ده"); + spit_V = compoundV "تف" (mkV "کردن" "کن"); + stand_V = mkV_1 "ایستادن"; + swell_V = compoundV "ورم" (mkV "کردن" "کن"); + swim_V = compoundV "شنا" (mkV "کردن" "کن"); + think_V = compoundV "فکر" (mkV "کردن" "کن"); + turn_V = mkV_1 "چرخیدن" ; + vomit_V = compoundV "استفراغ" (mkV "کردن" "کن"); + bite_V2 = mkV2 (compoundV "گاز" (mkV "گرفتن" "گیر")) "را"; + count_V2 = mkV2 (mkV_2 "شماردن") "را"; + cut_V2 = mkV2 (mkV_1 "بریدن") ; + fear_V2 = mkV2 (mkV_1 "ترسیدن") "از"; + fight_V2 = mkV2 (mkV_1 "جنگیدن") "با" False; + hit_V2 = mkV2 (compoundV "ضربه" (mkV "زدن" "زن")) "به" False; + hold_V2 = mkV2 (compoundV "نگه" haveVerb) "را"; + hunt_V2 = mkV2 (compoundV "شکار" (mkV "کردن" "کن")) "را"; + kill_V2 = mkV2 ( mkV_2 "کشتن") "را"; + pull_V2 = mkV2 (mkV_1 "کشیدن") "را"; + push_V2 = mkV2 (compoundV "هل" (mkV "دادن" "ده")) "را" ; + rub_V2 = mkV2 (mkV_1 "مالیدن") "را"; + scratch_V2 = mkV2 (mkV_1 "خراشیدن") "را" ; + split_V2 = mkV2 (compoundV "تقسیم" (mkV "کردن" "کن")) "را"; + squeeze_V2 = mkV2 (compoundV "له" (mkV "کردن" "کن")) "را"; + stab_V2 = mkV2 (compoundV "چاقو" (mkV "زدن" "زن")) "به" False; + suck_V2 = mkV2 (mkV_1 "مکیدن") "را" ; + throw_V2 = mkV2 (compoundV "پرتاب" (mkV "کردن" "کن")) "را"; + tie_V2 = mkV2 (compoundV "گره" (mkV "زدن" "زن")) "را"; + wash_V2 = mkV2 (mkV "شستن" "شور") "را" ; -- also "شوی" which is the very formal form of the present root + wipe_V2 = mkV2 (compoundV "پاک" (mkV "کردن" "کن")) "را"; + +---- other_A = regA "دیگر" ; + + grammar_N = mkCmpdNoun1 "دستور" (mkN01 "زبان" inanimate); + language_N = mkN01 "زبان" inanimate; + rule_N = mkN "قانون" "قوانین" inanimate; + +---- added 4/6/2007 + john_PN = mkPN "جان" inanimate; + question_N = mkN01 "سؤال" inanimate; -- has variant "پرسش" + ready_A = mkA "آماده" ["با آمادگی"] ; + reason_N = mkN "دلیل" "دلایل" inanimate; + today_Adv = ss "امروز" ; + uncertain_A = mkA "نامعلوم" ["با تردید"]; + +} diff --git a/lib/src/persian/MakeStructuralPes.gf b/lib/src/persian/MakeStructuralPes.gf new file mode 100644 index 000000000..307b51a0e --- /dev/null +++ b/lib/src/persian/MakeStructuralPes.gf @@ -0,0 +1,14 @@ +--# -path=.:../common:../abstract + +resource MakeStructuralPnb = open CatPnb, ParadigmsPnb, ResPnb, MorphoPnb, NounPnb, Prelude in { + +oper + mkSubj : Str -> CatPnb.Subj = \x -> + lin Subj {s = x} ; + mkNP : Str -> Number -> ResPnb.NP = \s,n -> + MassNP (UseN (ParadigmsPnb.mkN s)); +-- lin NP (regNP s n) ; + mkIDet : Str -> Number -> IDet = \s,n -> + lin IDet {s = \\_ => s ; n = n} ; + +} diff --git a/lib/src/persian/MorphoPes.gf b/lib/src/persian/MorphoPes.gf new file mode 100644 index 000000000..b865569a2 --- /dev/null +++ b/lib/src/persian/MorphoPes.gf @@ -0,0 +1,507 @@ +--# -path=.:../../prelude +-- +----1 A Simple Punjabi Resource Morphology +---- +---- Shafqat Virk, Aarne Ranta,2010 +---- +---- This resource morphology contains definitions needed in the resource +---- syntax. To build a lexicon, it is better to use $ParadigmsPnb$, which +---- gives a higher-level access to this module. +-- +resource MorphoPes = ResPes ** open Prelude,Predef in { + + flags optimize=all ; + coding = utf8; + +----2 Nouns + +oper + + mkN : (x1,x2 : Str) -> Animacy -> Noun = + \sg,pl,ani -> { + s = table { + bEzafa => table { Sg => sg ; + Pl => pl + } ; + aEzafa => table { Sg => mkEzafa sg ; + Pl => mkEzafa pl + } ; + enClic => table { Sg => mkEnclic sg ; + Pl => mkEnclic pl + } + }; + animacy = ani ; + definitness = True + } ; + + + +-- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e) +-- Arabic nouns ends with h. also taken as Masc + ------------------------------------------------------------------ +----Verbs +------------------------------------------------------------------ +{- + mkVerb : (x1,x2 : Str) -> Verb = \inf,root2 -> + let root1 = (tk 1 inf) ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + + VF tense aspect person number => (mkCmnVF root1 root2 tense aspect person number).s +-- Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ; +-- Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s + } + } ; + +--1. Basic stem form, direct & indirect causatives exists +-- v1 nechna nechaana nechwana + + mkVerb1 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 3 inf) ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + + VF tense aspect person number => (mkCmnVF root1 root2 tense aspect person number).s +-- Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ; +-- Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s + } + } ; + + +mkVerb2 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 2 inf) ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + + VF tense aspect person number => (mkCmnVF root1 root2 tense aspect person number).s +-- Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ; +-- Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s + } + } ; + + + +mkCmnVF : Str -> Str -> VTense -> PAspect -> PPerson -> Number -> {s:Str}= \root1,root2,t,a,p,n -> + {s = (mkCmnVF1 root1 root2 t a p n).s ; + }; + + + mkCmnVF1 : Str -> Str -> VTense -> PAspect -> PPerson -> Number -> {s:Str}= \root1,root2,t,a,p,n -> + {s = let khordh = root1 + "ه"; + mekhor = "می" ++ root2 ; + mekhord = "می" ++ root1 ; + mekhordh = "می" ++ khordh ; + khah = "خواه" ; + mekhah = "می" ++ khah ; + bvdh = "بوده" + in + case of { + => khordh ++ "ام" ; + => khordh ++ "ایم" ; + => khordh ++ "ای" ; + => khordh ++ "اید" ; + => khordh ++ "است" ; + => khordh ++ "اند" ; + + => mekhor + "م" ; -- toHave need to have khor instead of mekhor + => mekhor + "یم" ; + => mekhor + "ی" ; + => mekhor + "ید" ; + => mekhor + "د" ; + => mekhor + "ند" ; + + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + + => khordh ++ "بودم" ; + => khordh ++ "بودیم" ; + => khordh ++ "بودی" ; + => khordh ++ "بودید" ; + => khordh ++ "بود" ; + => khordh ++ "بودند" ; + + => mekhord + "م" ; -- toHave need to have khor instead of mekhor + => mekhord + "یم" ; + => mekhord + "ی"; + => mekhord + "ید" ; + => mekhord ; + => mekhord + "ند" ; + + => root1 + "م" ; + => root1 + "یم" ; + => root1 + "ی"; + => root1 + "ید" ; + => root1 ; + => root1 + "ند" ; + + -- check this one + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + + => mekhah + "م" ++ addBh root2 + "م" ; + => mekhah + "یم" ++ addBh root2 + "یم" ; + => mekhah + "ی" ++ addBh root2 + "ی" ; + => mekhah + "ید" ++ addBh root2 + "ید" ; + => mekhah + "د" ++ addBh root2 + "د" ; + => mekhah + "ند" ++ addBh root2 + "ند" ; + + => khah + "م" ++ root1 ; + => khah + "یم" ++ root1 ; + => khah + "ی" ++ root1 ; + => khah + "ید" ++ root1 ; + => khah + "د" ++ root1 ; + => khah + "ند" ++ root1 ; + + + => khordh ++ bvdh ++ "ام" ; + => khordh ++ bvdh ++ "ایم" ; + => khordh ++ bvdh ++ "ای" ; + => khordh ++ bvdh ++ "اید" ; + => khordh ++ bvdh ++ "است" ; + => khordh ++ bvdh ++ "اند" ; + + => mekhordh ++ "ام" ; -- toHave need to have khordh instead of mekhor + => mekhordh ++ "ایم" ; + => mekhordh ++ "ای" ; + => mekhordh ++ "اید" ; + => mekhordh ++ "است" ; + => mekhordh ++ "اند" ; + + + -- check this one + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + => "" + + + } + } ; + -} + mkVerb : (x1,x2 : Str) -> Verb = \inf,root2 -> + let root1 = (tk 1 inf) ; + impRoot = mkimpRoot root2; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + Imp Pos Sg => addBh impRoot ; + Imp Pos Pl => (addBh impRoot) + "ید" ; + Imp Neg Sg => "ن" + impRoot ; + Imp Neg Pl => "ن" + impRoot + "ید" ; + + VF pol tense person number => (mkCmnVF root1 root2 pol tense person number).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes number person) => (mkvVform root2 number person).s + } + } ; + + mkVerb1 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 3 inf) ; + impRoot = mkimpRoot root2 ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + Imp Pos Sg => addBh impRoot ; + Imp Pos Pl => (addBh impRoot) + "ید" ; + Imp Neg Sg => "ن" + impRoot ; + Imp Neg Pl => "ن" + impRoot + "ید" ; + + VF pol tense person number => (mkCmnVF root1 root2 pol tense person number).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes number person) => (mkvVform root2 number person).s + } + }; + + +mkVerb2 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 2 inf) ; + impRoot = mkimpRoot root2 ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + Imp Pos Sg => addBh impRoot ; + Imp Pos Pl => (addBh impRoot) + "ید" ; + Imp Neg Sg => "ن" + impRoot ; + Imp Neg Pl => "ن" + impRoot + "ید" ; + + VF pol tense person number => (mkCmnVF root1 root2 pol tense person number).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes number person) => (mkvVform root2 number person).s + } + } ; + + mkHave : Verb = + + { + s = table { + + Root1 => "داشت" ; + Root2 => "دار" ; + Inf => "داشتن" ; + Imp Pos Sg => ["داشته باش"] ; + Imp Pos Pl => ["داشته باشید"]; + Imp Neg Sg => ["نداشته باش"] ; + Imp Neg Pl => ["نداشته باشید"] ; + + VF pol tense person number => (toHave pol tense number person).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes Sg PPers1) => ["داشته باشم"] ; + Vvform (AgPes Sg PPers2) => ["داشته باشی"] ; + Vvform (AgPes Sg PPers3) => ["داشته باشد"] ; + Vvform (AgPes Pl PPers1) => ["داشته باشیم"] ; + Vvform (AgPes Pl PPers2) => ["داشته باشید"] ; + Vvform (AgPes Pl PPers3) => ["داشته باشند"] + } + } ; + + +mkCmnVF : Str -> Str -> Polarity -> VTense2 -> PPerson -> Number -> {s:Str}= \root1,root2,pol,t,p,n -> + {s = (mkCmnVF1 root1 root2 pol t p n).s ; + }; + + + mkCmnVF1 : Str -> Str -> Polarity -> VTense2 -> PPerson -> Number -> {s:Str}= \root1,root2,pol,t,p,n -> + {s = let khordh = root1 + "ه"; + nkhordh = (addN root1) + "ه" ; + mekhor = "می" ++ root2 ; + nmekhor = "نمی" ++ root2 ; + mekhord = "می" ++ root1 ; + nmekhord = "نمی" ++ root1 ; + mekhordh = "می" ++ khordh ; + nmekhordh = "نمی" ++ khordh ; + khah = "خواه" ; + nkhah = "نخواه" ; + mekhah = "می" ++ khah ; + nmekhah = "نمی" ++ khah ; + bvdh = "بوده" + in + case of { + => khordh ++ "ام" ; + => khordh ++ "ایم" ; + => khordh ++ "ای" ; + => khordh ++ "اید" ; + => khordh ++ "است" ; + => khordh ++ "اند" ; + + => mekhor + "م" ; + => mekhor + "یم" ; + => mekhor + "ی" ; + => mekhor + "ید" ; + => mekhor + "د" ; + => mekhor + "ند" ; + + + => khordh ++ "بودم" ; + => khordh ++ "بودیم" ; + => khordh ++ "بودی" ; + => khordh ++ "بودید" ; + => khordh ++ "بود" ; + => khordh ++ "بودند" ; + + => mekhord + "م" ; + => mekhord + "یم" ; + => mekhord + "ی"; + => mekhord + "ید" ; + => mekhord ; + => mekhord + "ند" ; + + => root1 + "م" ; + => root1 + "یم" ; + => root1 + "ی"; + => root1 + "ید" ; + => root1 ; + => root1 + "ند" ; + + {- + => mekhah + "م" ++ addBh root2 + "م" ; + => mekhah + "یم" ++ addBh root2 + "یم" ; + => mekhah + "ی" ++ addBh root2 + "ی" ; + => mekhah + "ید" ++ addBh root2 + "ید" ; + => mekhah + "د" ++ addBh root2 + "د" ; + => mekhah + "ند" ++ addBh root2 + "ند" ; + -} + => khah + "م" ++ root1 ; + => khah + "یم" ++ root1 ; + => khah + "ی" ++ root1 ; + => khah + "ید" ++ root1 ; + => khah + "د" ++ root1 ; + => khah + "ند" ++ root1 ; + + + => khordh ++ bvdh ++ "ام" ; + => khordh ++ bvdh ++ "ایم" ; + => khordh ++ bvdh ++ "ای" ; + => khordh ++ bvdh ++ "اید" ; + => khordh ++ bvdh ++ "است" ; + => khordh ++ bvdh ++ "اند" ; + + => mekhordh ++ "ام" ; + => mekhordh ++ "ایم" ; + => mekhordh ++ "ای" ; + => mekhordh ++ "اید" ; + => mekhordh ++ "است" ; + => mekhordh ++ "اند" ; + + -- negatives + + => addN khordh ++ "ام" ; + => addN khordh ++ "ایم" ; + => addN khordh ++ "ای" ; + => addN khordh ++ "اید" ; + => addN khordh ++ "است" ; + => addN khordh ++ "اند" ; + + + => nmekhor + "م" ; + => nmekhor + "یم" ; + => nmekhor + "ی" ; + => nmekhor + "ید" ; + => nmekhor + "د" ; + => nmekhor + "ند" ; + + => nkhordh ++ "بودم" ; + => nkhordh ++ "بودیم" ; + => nkhordh ++ "بودی" ; + => nkhordh ++ "بودید" ; + => nkhordh ++ "بود" ; + => nkhordh ++ "بودند" ; + + => nmekhord + "م" ; + => nmekhord + "یم" ; + => nmekhord + "ی"; + => nmekhord + "ید" ; + => nmekhord ; + => nmekhord + "ند" ; + + + => addN root1 + "م" ; + => addN root1 + "یم" ; + => addN root1 + "ی"; + => addN root1 + "ید" ; + => addN root1 ; + => addN root1 + "ند" ; + + {- + => nmekhah + "م" ++ addBh root2 + "م" ; + => nmekhah + "یم" ++ addBh root2 + "یم" ; + => nmekhah + "ی" ++ addBh root2 + "ی" ; + => nmekhah + "ید" ++ addBh root2 + "ید" ; + => nmekhah + "د" ++ addBh root2 + "د" ; + => nmekhah + "ند" ++ addBh root2 + "ند" ; + -} + => nkhah + "م" ++ root1 ; + => nkhah + "یم" ++ root1 ; + => nkhah + "ی" ++ root1 ; + => nkhah + "ید" ++ root1 ; + => nkhah + "د" ++ root1 ; + => nkhah + "ند" ++ root1 ; + + + => nkhordh ++ bvdh ++ "ام" ; + => nkhordh ++ bvdh ++ "ایم" ; + => nkhordh ++ bvdh ++ "ای" ; + => nkhordh ++ bvdh ++ "اید" ; + => nkhordh ++ bvdh ++ "است" ; + => nkhordh ++ bvdh ++ "اند" ; + + => nmekhordh ++ "ام" ; + => nmekhordh ++ "ایم" ; + => nmekhordh ++ "ای" ; + => nmekhordh ++ "اید" ; + => nmekhordh ++ "است" ; + => nmekhordh ++ "اند" + + + } + + } ; + + mkvVform : Str -> Number -> PPerson -> {s: Str} = \root2,n,p -> + {s = + case of { + => addBh root2 + "م" ; + => addBh root2 + "ی" ; + => addBh root2 + "د" ; + => addBh root2 + "یم" ; + => addBh root2 + "ید" ; + => addBh root2 + "ند" + } + }; + + mkimpRoot : Str -> Str ; + mkimpRoot root = + case root of { + st + "ی" => st ; + _ => root + }; + + +addBh : Str -> Str ; +addBh str = + case (take 1 str) of { + "ا" => "بی" + str ; + "آ" => "بیا" + (drop 1 str) ; + _ => "ب" + str + }; + + --------------------- + --Determiners + -------------------- + + makeDet : Str -> Number -> Bool -> {s: Str ; n : Number ; isNum : Bool ; fromPron : Bool} =\str,n,b -> { + s = str; + isNum = b; + fromPron = False ; + n = n + }; + makeQuant : Str -> Str -> {s : Number => Str ; a : AgrPes ; fromPron : Bool } = \sg,pl -> { + s = table {Sg => sg ; Pl => pl} ; + fromPron = False ; + a = agrPesP3 Sg + }; +--------------------------- +-- Adjectives +-------------------------- +mkAdj : Str -> Str -> Adjective = \adj,adv -> { + s = table { bEzafa => adj; + aEzafa => mkEzafa adj ; + enClic => mkEnclic adj + } ; + adv = adv + }; +} \ No newline at end of file diff --git a/lib/src/persian/NounPes.gf b/lib/src/persian/NounPes.gf new file mode 100644 index 000000000..159785969 --- /dev/null +++ b/lib/src/persian/NounPes.gf @@ -0,0 +1,140 @@ +concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { + + flags optimize=all_subs ; + + lin + DetCN det cn = { + s = \\_ => case of { + => cn.s ! aEzafa ! det.n ++ det.s ; -- det.n ; + => det.s ++ cn.s ! bEzafa ! det.n ; -- det.n ; + => cn.s ! aEzafa ! Sg ++ det.s ; + => det.s ++ cn.s ! bEzafa ! Sg + }; + a = agrPesP3 det.n ; + animacy = cn.animacy + } ; + + UsePN pn = {s = \\_ => pn.s ; a = agrPesP3 Sg ; animacy = pn.animacy } ; + UsePron p = {s = \\_ => p.s ; a = p.a ; animacy = Animate} ; + + PredetNP pred np = { + s = \\ez => pred.s ++ np.s ! ez ; + a = np.a; + animacy = np.animacy + } ; + + PPartNP np v2 = { + s = \\ez => np.s ! ez ++ partNP (v2.s ! Root1) ; + a = np.a ; + animacy = np.animacy + } ; + + RelNP np rs = { + s = \\ez => np.s ! ez ++ rs.s ! np.a ; + a = np.a ; + animacy = np.animacy + } ; + + AdvNP np adv = { + s = \\ez => np.s ! NPC aEzafa ++ adv.s ; + a = np.a ; + animacy = np.animacy + } ; + + DetQuantOrd quant num ord = { + s = quant.s ! num.n ++ num.s ++ ord.s ; + isNum = True; + fromPron = quant.fromPron ; + n = num.n + } ; + + DetQuant quant num = { + s = quant.s ! num.n ++ num.s; + isNum = True ; -- this does not work in case of 'these women' but works in case of 'five women' + fromPron = quant.fromPron ; + n = num.n + } ; + + DetNP det = { + s = \\_ => det.s ; ---- case + a = agrPesP3 det.n ; + animacy = Inanimate + } ; + + PossPron p = {s = \\_ => p.ps ; a = p.a ; fromPron = True} ; + + NumSg = {s = [] ; n = Sg} ; + NumPl = {s = [] ; n = Pl} ; +-- from here + NumCard n = n ** {hasCard = True} ; + + NumDigits n = {s = n.s ! NCard ; n = n.n} ; + OrdDigits n = {s = n.s ! NOrd; n = n.n} ; + + NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; + OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ; +-- to here + AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; + + OrdSuperl a = {s = a.s ! bEzafa ++ taryn; n = Sg} ; -- check the form of adjective + + DefArt = {s = \\_ => [] ; a = defaultAgrPes ; fromPron = False} ; + IndefArt = {s = \\_ => IndefArticle ; a =defaultAgrPes ; fromPron = False} ; + + MassNP cn = {s =\\c => case c of { + NPC bEzafa => cn.s ! bEzafa ! Sg ; + NPC aEzafa => cn.s ! aEzafa ! Sg ; + NPC enClic => cn.s ! enClic ! Sg + }; + a = agrPesP3 Sg ; + animacy = cn.animacy + } ; + + UseN n = n ; + UseN2 n = n ; + + Use2N3 f = { + s = f.s; + c = f.c2; + animacy = f.animacy; + definitness = True + } ; + + Use3N3 f = { + s = f.s ; + c = f.c3; + animacy = f.animacy; + definitness = True + } ; + + ComplN2 f x = { + s = \\ez,n => f.s ! ez ! n ++ f.c ++ x.s ! NPC ez ; + animacy = f.animacy; + definitness = True + }; + ComplN3 f x = { + s = \\ez,n => f.s ! ez ! n ++ f.c2 ++ x.s ! NPC ez ; + c = f.c3; + animacy = f.animacy; + definitness = True; + } ; + + AdjCN ap cn = { + s = \\ez,n => cn.s ! aEzafa ! n ++ ap.s ! ez; -- check the form of adjective and also cn.s!ez!n changed from cn.s!aEzafa!n to have correct enclicitic form other wise it creats wrong enclictic form of old man + animacy = cn.animacy ; + definitness = cn.definitness + } ; + + RelCN cn rs = { + s = \\ez,n => cn.s ! enClic ! n ++ rs.s ! agrPesP3 n ; + animacy = cn.animacy ; + definitness = cn.definitness + } ; + + AdvCN cn ad = {s = \\ez,n => cn.s ! aEzafa ! n ++ ad.s ; animacy = cn.animacy ; definitness = cn.definitness} ; + + SentCN cn sc = {s = \\ez,n => cn.s ! ez ! n ++ sc.s ; animacy = cn.animacy ; definitness = cn.definitness} ; + + ApposCN cn np = {s = \\ez,n => cn.s ! ez ! n ++ np.s ! NPC aEzafa ; animacy = cn.animacy ; definitness = True} ; -- ezafa form of city to be used + +} diff --git a/lib/src/persian/NumeralPes.gf b/lib/src/persian/NumeralPes.gf new file mode 100644 index 000000000..6a1419a7f --- /dev/null +++ b/lib/src/persian/NumeralPes.gf @@ -0,0 +1,140 @@ +--# -path=.:../abstract:../common: +concrete NumeralPes of Numeral = CatPes [Numeral,Digits] ** open ResPes,Prelude in { + +flags coding = utf8; + +param DForm = unit | teen | ten | hundreds |thousands; +param DSize = sg | r2 | r3 | r4 | r5 | r6 | r7 | r8 | r9 ; +param Size = singl | less100 | more100 ; + + +lincat + Digit = {s : DForm => CardOrd => Str} ; + Sub10 = {s : DForm => CardOrd => Str ; n : Number} ; + Sub100 = {s : CardOrd => Str ; n : Number} ; + Sub1000 = {s : CardOrd => Str ; n : Number} ; + Sub1000000 = {s : CardOrd => Str ; n : Number} ; + +lin num x = x ; +-- 2 12 20 200 +lin n2 = mkNum "دو" "دوازده" "بیست" "دویست" ; +lin n3 = mkNum3 "سه" "سیزده" "سی" "سیصد" "سوم" ; +lin n4 = mkNum "چهار" "چهارده" "چهل" "چهارصد" ; +lin n5 = mkNum "پنج" "پانزده" "پنجاه" "پانصد" ; +lin n6 = mkNum "شش" "شانزده" "شصت" "ششصد" ; +lin n7 = mkNum "هفت" "هفده" "هفتاد" "هفتصد" ; +lin n8 = mkNum "هشت" "هجده" "هشتاد" "هشتصد" ; +lin n9 = mkNum "نه" "نوزده" "نود" "نهصد" ; + +lin pot01 = mkNum3 "یک" "یازده" "ده" "یکصد" "هزار" ** {n = Sg} ; + +lin pot0 d = d ** {n = Pl} ; + +lin pot110 = {s = table { NCard => "ده" ; + NOrd => "دهم" }; + n = Pl} ; +lin pot111 = {s = table { NCard => "یازده" ; + NOrd => "یازدهم" }; + n = Pl}; + +lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; + +lin pot1plus d e = { + s = \\o => d.s ! ten ! NCard ++"و" ++e.s ! unit ! o ; n = Pl} ; + +lin pot1as2 n = n ; + +lin pot2 d = {s = d.s ! hundreds} ** {n = Pl} ; +lin pot2plus d e = { + s = \\o => d.s ! hundreds ! NCard ++ "و" ++ e.s ! o ; n = Pl} ; -- remove "??" + +lin pot2as3 n = n ; + +lin pot3 n = { s = \\o => n.s ! NCard ++ "هزار" ; n = Pl} ; + +lin pot3plus n m = { + s = \\o => n.s ! NCard ++ "هزار" ++ "و" ++ m.s ! o; n = Pl} ; -- missing word "????????" after NCard + +-- numerals as sequences of digits + + lincat + Dig = TDigit ; + + lin + IDig d = d ** {tail = T1} ; +{- + IIDig d i = { + s = \\o,c => d.s ! NCard ++ commaIf i.tail ++ i.s ! o ! c ; + n = Pl ; + -- tail = inc i.tail + } ; +-} + D_0 = mkDig "?" ; + D_1 = mk3Dig "?" "" Pl; + D_2 = mk2Dig "?" ""; + D_3 = mk2Dig "?" "سوم" ; + D_4 = mkDig "?" ; + D_5 = mkDig "?" ; + D_6 = mkDig "?" ; + D_7 = mkDig "?" ; + D_8 = mkDig "?" ; + D_9 = mkDig "?" ; + + -- lin IDig d = { s = \\_ => d.s ; n = Sg} ; + lin IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + + oper + commaIf : DTail -> Str = \t -> case t of { + T3 => "," ; + _ => [] + } ; + + inc : DTail -> DTail = \t -> case t of { + T1 => T2 ; + T2 => T3 ; + T3 => T1 + } ; + + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c + "م") ; + + mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { + -- s = table {NCard => regGenitiveS c ; NOrd => regGenitiveS o} ; + s = table {NCard => c ; NOrd => o} ; + n = n + } ; + + oper TDigit = { + n : Number ; + s : CardOrd => Str + } ; + + +oper + mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = + \two, twelve, twenty, twohundred-> + {s = table { + unit => table {NCard => two ; NOrd => (two + "مین") | (two + "م")}; + teen => table {NCard => twelve ; NOrd => (twelve + "مین") | (twelve + "م")} ; + ten => table {NCard => twenty ; NOrd => (twenty + "مین") | (twenty + "م")}; + hundreds => table {NCard => twohundred ; NOrd => (twohundred +"مین") | (twohundred + "م")}; + thousands => table {NCard => (two + "هزار" ); NOrd => (two + "هزار" + "م") | (two + "هزار" +"مین" )} + + }}; + + mkNum3 : Str -> Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = + \two, twelve, twenty, twohundred, second-> + {s = table { + unit => table {NCard => two ; NOrd => second}; + teen => table {NCard => twelve ; NOrd => (twelve + "مین") | (twelve + "م")} ; + ten => table {NCard => twenty ; NOrd => (twenty + "مین") | (twenty + "م")}; + hundreds => table {NCard => twohundred ; NOrd => (twohundred +"مین") | (twohundred + "م")}; + thousands => table {NCard => (two + "هزار" ); NOrd => (two + "هزار" + "م") | (two + "هزار"+ "مین" )} + + }}; + + + +} diff --git a/lib/src/persian/ParadigmsPes.gf b/lib/src/persian/ParadigmsPes.gf new file mode 100644 index 000000000..dc1b4cfcb --- /dev/null +++ b/lib/src/persian/ParadigmsPes.gf @@ -0,0 +1,206 @@ +--# -path=.:../abstract:../../prelude:../common +-- +----1 Pnbu Lexical Paradigms + +resource ParadigmsPes = open + Predef, + Prelude, + MorphoPes, + CatPes + in { + + flags optimize=all ; + coding = utf8; + +--2 Parameters + +oper + animate : Animacy ; + inanimate : Animacy ; + singular : Number; + plural : Number; + + singular = Sg ; plural = Pl; + + animate = Animate ; inanimate = Inanimate ; --i + mkN01 : Str -> Animacy -> Noun ; + mkN01 str ani = mkN str (str ++ "ها") ani; + mkN02 : Str -> Animacy -> Noun ; + mkN02 str ani = case (last str) of { + "ه" => mkN str ((init str) + "گان") ani ; + ("ا"|"و") => mkN str (str + "یان") ani ; + _ => mkN str (str+"ان") ani + }; +{- + +--2 Nouns + + + mkN2 : N -> Prep -> Str -> N2; + mkN2 = \n,p,c -> n ** {lock_N2 = <> ; c2 = p.s ; c3 = c } ; + + mkN3 : N -> Prep -> Str -> Str-> N3 ; + mkN3 = \n,p,q,r -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q ; c4 = r} ; +-} +-- Compound Nouns + + mkCmpdNoun1 : Str -> N -> N + = \s,noun -> {s =\\ez,n => s ++ noun.s ! ez ! n ; animacy = noun.animacy ; definitness = noun.definitness ; lock_N = <>}; + mkCmpdNoun2 : N -> Str -> N + = \noun,s -> {s =\\ez,n => noun.s ! ez ! n ++ s ; animacy = noun.animacy ; definitness =noun.definitness ; lock_N = <>}; + + +-- Proper names + mkPN : Str -> Animacy -> PN = + + \str,ani -> {s = str ; animacy = ani ; lock_PN = <>} ; + + +-- Personal Pronouns + personalPN : Str -> Number -> PPerson -> Pron = + \str,nn,p -> {s = str ; a = AgPes nn p ; ps = str ; lock_Pron = <>}; +{- +-- Demonstration Pronouns + demoPN : Str -> Str -> Str -> Quant = + \s1,s2,s3 -> let n = makeDemonPronForm s1 s2 s3 in {s = n.s ; a = defaultAgr ; lock_Quant = <>}; +-- Determiner +-} + mkDet = overload { + mkDet : Str -> Number -> Det = + \s1,n -> makeDet s1 n False ** { lock_Det = <>}; + mkDet : Str -> Number -> Bool -> Det = + \s1,n,b -> makeDet s1 n b ** { lock_Det = <>}; + }; + {- +-- Intergative pronouns + mkIP : (x1,x2,x3,x4:Str) -> Number -> Gender -> IP = + \s1,s2,s3,s4,n,g -> let p = mkIntPronForm s1 s2 s3 s4 in { s = p.s ; n = n ; g = g ; lock_IP = <>}; + +-- AdN + mkAdN : Str -> AdN = \s -> ss s ; +-} +--2 Adjectives + + mkA = overload { + mkA : Str-> A + = \str -> mkAdj str str ** { lock_A = <>} ; + mkA : Str-> Str -> A + = \str,adv -> mkAdj str adv ** { lock_A = <>} ; + mkA : Str -> Str -> A2 + = \a,c -> mkAdj a a ** { c2 = c ; lock_A2 = <>} ; + } ; + +--2 Verbs + mkV : Str -> Str -> V + = \s1, s2 -> mkVerb s1 s2 ** {lock_V = <>} ; + -- mkVerb takes both the Infinitive and the present root(root2) and is applied for iregular verbs + haveVerb : V = mkHave ; + mkV_1 : Str -> V + = \s -> mkVerb1 s ** {lock_V = <>} ; + + mkV_2 : Str -> V + = \s -> mkVerb2 s ** {lock_V = <>} ; + + mkV2 = overload { +-- mkV2 : Str -> V2 +-- = \s -> mkV s ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> V2 + = \v -> v ** {c2 = {s = [] ; ra = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> Str -> V2 + = \v,ra -> v ** {c2 = {ra = ra ; s = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> Str -> Bool -> V2 + = \v,p,b -> v ** {c2 = {ra = [] ; s = p ; c = VTrans} ; lock_V2 = <>} ; + } ; + + mkV3 : V -> Str -> Str -> V3; + mkV3 v p q = v ** { c2 = p ; c3 = q ; lock_V3 = <>} ; + mkV2V : V -> Str -> Str -> Bool -> V2V ; + mkV2V v s1 s2 b = v ** {isAux = b ; c1 = s1 ; c2 = s2 ; lock_V2V = <>} ; + +-- compund verbs + compoundV = overload { + compoundV : Str -> V -> V = \s,v -> {s = \\vf => s ++ v.s ! vf ; lock_V = <>} ; + compoundV : Str -> V2 -> V = \s,v -> {s = \\vf => s ++ v.s ! vf ; lock_V = <>} ; + }; + {- + +----2 Adverbs + mkAdv : Str -> Adv = \str -> {s =\\ _ => str ; lock_Adv = <>}; + +----2 Prepositions + + mkPrep : Str -> Prep ; + mkPrep str = makePrep str ** {lock_Prep = <>}; + +--3 Determiners and quantifiers + +-- mkQuant : overload { +-- mkQuant : Pron -> Quant ; +-- mkQuant : (no_sg, no_pl, none_sg, : Str) -> Quant ; +-- } ; +-} + mkQuant = overload { +-- mkQuant : Pron -> Quant = \p -> {s = \\_,_,c => p.s!c ;a = p.a ; lock_Quant = <>}; + mkQuant : Str -> Str -> Quant = \sg,pl -> makeQuant sg pl; + } ; +{- +--2 Conjunctions + mkConj : overload { + mkConj : Str -> Conj ; -- and (plural agreement) + mkConj : Str -> Number -> Conj ; -- or (agrement number given as argument) + mkConj : Str -> Str -> Conj ; -- both ... and (plural) + mkConj : Str -> Str -> Number -> Conj ; -- either ... or (agrement number given as argument) + } ; + mkConj = overload { + mkConj : Str -> Conj = \y -> mk2Conj [] y plural ; + mkConj : Str -> Number -> Conj = \y,n -> mk2Conj [] y n ; + mkConj : Str -> Str -> Conj = \x,y -> mk2Conj x y plural ; + mkConj : Str -> Str -> Number -> Conj = mk2Conj ; + } ; + + mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> + lin Conj (sd2 x y ** {n = n}) ; + +-- mkV0 : V -> V0 ; +-- mkVS : V -> VS ; +-- mkV2S : V -> Prep -> V2S ; + mkVV : V -> VV = \v -> lin VV (v ** {isAux = False}); + + +-- mkV2V : V -> Prep -> Prep -> V2V ; +-- mkVA : V -> VA ; +-- mkV2A : V -> Prep -> V2A ; +-- mkVQ : V -> VQ ; +-- mkV2Q : V -> Prep -> V2Q ; +-- +-- mkAS : A -> AS ; +-- mkA2S : A -> Prep -> A2S ; +-- mkAV : A -> AV ; +-- mkA2V : A -> Prep -> A2V ; +-- mkA2V a p = a ** {c2 = p.s } ; +-- +---- Notice: Categories $V0, AS, A2S, AV, A2V$ are just $A$. +---- $V0$ is just $V$; the second argument is treated as adverb. +-- +-- V0 : Type ; +-- AS, A2S, AV, A2V : Type ; +-- +----. +----2 Definitions of paradigms +---- +---- The definitions should not bother the user of the API. So they are +---- hidden from the document. +-- +-- Gender = MorphoHin.Gender ; +-- Number = MorphoHin.Number ; +-- Case = MorphoHin.Case ; +-- human = Masc ; +-- nonhuman = Neutr ; +-- masculine = Masc ; +-- feminine = Fem ; +-- singular = Sg ; +-- plural = Pl ; +-- nominative = Nom ; +-- genitive = Gen ; +-} +} diff --git a/lib/src/persian/PhrasePes.gf b/lib/src/persian/PhrasePes.gf new file mode 100644 index 000000000..aee807d47 --- /dev/null +++ b/lib/src/persian/PhrasePes.gf @@ -0,0 +1,27 @@ +concrete PhrasePes of Phrase = CatPes ** open Prelude, ResPes in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = s ; + UttQS qs = {s = qs.s ! QDir} ; + UttImpSg pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg False} ; + UttImpPl pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Pl False} ; + UttImpPol pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg True} ; + + UttIP ip = {s = ip.s } ; --- Acc also + UttIAdv iadv = iadv ; + UttNP np = {s = np.s ! NPC bEzafa} ; + UttVP vp = {s = vp.ad ++ vp.comp ! (AgPes Sg PPers3 ) ++ vp.obj.s ++ vp.inf ++ vp.vComp ! (AgPes Sg PPers3) ++ vp.embComp} ; + UttAdv adv = {s = adv.s } ; + UttCN cn = {s = cn.s ! bEzafa ! Sg }; + UttCard n = n ; + UttAP ap = {s = ap.s ! bEzafa} ; + + NoPConj = {s = []} ; + PConjConj conj = {s = conj.s2} ; --- + + NoVoc = {s = []} ; + VocNP np = {s = np.s ! NPC bEzafa} ; + +} diff --git a/lib/src/persian/QuestionPes.gf b/lib/src/persian/QuestionPes.gf new file mode 100644 index 000000000..7b7788ced --- /dev/null +++ b/lib/src/persian/QuestionPes.gf @@ -0,0 +1,65 @@ +concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in { + flags optimize=all_subs ; + coding = utf8; + + lin + + QuestCl cl = { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! OQuest; + QIndir => cl.s ! t! p ! ODir + } + }; + + QuestVP qp vp = + let cl = mkSClause ("") (AgPes qp.n PPers3) vp; +-- qp1 = qp.s; +-- qp2 = qp.s ! Obl ++ "nE" + in { s = \\t,p,o => qp.s ++ cl.s ! t ! p ! ODir } ; +-- _ => qp1 ++ cl.s ! t ! p ! ODir +-- } + + QuestSlash ip slash = { + s = \\t,p,o => slash.c2.s ++ ip.s ++ slash.c2.ra ++ slash.s ! t ! p ! ODir; -- order of whome and john needs to be changed + + }; + + QuestIAdv iadv cl = { + s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! ODir; + }; + + QuestIComp icomp np = + let cl = mkSClause (np.s ! NPC bEzafa ++ icomp.s) np.a (predAux auxBe); + in { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! ODir; + QIndir => cl.s ! t! p ! ODir + } + }; + + PrepIP p ip = {s = p.s ++ ip.s } ; + + AdvIP ip adv = { + s = ip.s ++ adv.s ; + n = ip.n; + } ; + + IdetCN idet cn = { + s = case idet.isNum of {False => idet.s ++ cn.s ! bEzafa ! idet.n ; True => idet.s ++ cn.s ! bEzafa ! Sg} ; + n = idet.n; + } ; + + IdetIP idet = idet ; + + IdetQuant iqant num = { + s = iqant.s ++ num.s ; + n = num.n ; + isNum = True + } ; + + CompIAdv a = a ; + CompIP p = ss p.s ; + AdvIAdv i a = {s = a.s ++ i.s } ; + + +} diff --git a/lib/src/persian/README b/lib/src/persian/README new file mode 100644 index 000000000..2874bfe7f --- /dev/null +++ b/lib/src/persian/README @@ -0,0 +1,9 @@ +Some of the sources are transliterated, in + + ./src + +Before compilation, do + + gf -s "که" ++ cl.s ! t ! p ! o ; + }; +-- RelVP and RelSlash slows the linking process a lot this is why it is commented for test purposes + + RelVP rp vp = { + s = \\t,p,o,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg a => a + } ; + cl = mkSClause (rp.s) agr vp; + +-- cl = case t of { +-- VPImpPast => mkSClause (rp.s ! (giveNumber agr) ! Obl) agr vp; +-- _ => mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp +-- }; + in + cl.s ! t ! p ! ODir ; +-- c = Dir + } ; + + +---- Pied piping: "ت wهعه we رe لْْکنگ". Stranding and empty +---- relative are defined in $ExtraHin.gf$ ("تهت we رe لْْکنگ ت", +---- "we رe لْْکنگ ت"). +-- + RelSlash rp slash = { + s = \\t,p,o,agr => rp.s ++ slash.c2.s ++ slash.s ! t ! p ! o ;--case t of { +-- VPImpPast => rp.s ! (giveNumber agr) Obl ++ slash.c2.s ++ slash.s ! t ! p ! o ; +-- _ => rp.s ! (giveNumber agr) Dir ++ slash.c2.s ++ slash.s ! t ! p ! o +-- }; +-- c = Dir + } ; + + FunRP p np rp = { + s = np.s ! NPC enClic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY + a = RAg np.a + } ; + + IdRP = { + s = "که" ; + a = RNoAg + } ; + +} diff --git a/lib/src/persian/ResPes.gf b/lib/src/persian/ResPes.gf new file mode 100644 index 000000000..f556e6ea3 --- /dev/null +++ b/lib/src/persian/ResPes.gf @@ -0,0 +1,863 @@ +--# -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 { + => "او" ; + => ["آن ها"] ; + => "آن" ; + => ["آن ها"] + }; + + +} + diff --git a/lib/src/persian/SentencePes.gf b/lib/src/persian/SentencePes.gf new file mode 100644 index 000000000..eca8e0737 --- /dev/null +++ b/lib/src/persian/SentencePes.gf @@ -0,0 +1,103 @@ +concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in { + + flags optimize=all_subs ; + coding = utf8; + + lin + + PredVP np vp = mkClause np vp ; + + PredSCVP sc vp = mkSClause ("این" ++ sc.s) (defaultAgrPes) vp ; + + ImpVP vp = { + s = \\pol,n => + let + agr = AgPes (numImp n) PPers2 ; + in case pol of { + CPos => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ ((vp.s ! VPImp Pos (numImp n)).inf) ++ vp.embComp; + CNeg _ => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ ((vp.s ! VPImp Neg (numImp n)).inf) ++ vp.embComp + } ; + } ; + + + SlashVP np vp = + mkClause np vp ** {c2 = vp.c2} ; + + AdvSlash slash adv = { + s = \\t,p,o => adv.s ++ slash.s ! t ! p ! o ; + c2 = slash.c2 + } ; + + SlashPrep cl prep = cl ** {c2 = { s = prep.s ; ra = [] ; c = VIntrans}} ; + + SlashVS np vs slash = + mkClause np + (insertObj2 (conjThat ++ slash.s) (predV vs)) ** + {c2 = slash.c2} ; + + EmbedS s = {s = conjThat ++ s.s} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = vp.obj.s ++ vp.inf ++ vp.comp ! defaultAgrPes} ; --- agr + + + UseCl temp p cl = + { s = case of { + => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VCondAnter ! p.p ! ODir -- this needs to be fixed by making SubjPerf in ResPnb + + }; + } ; + UseQCl temp p cl = { + s = \\q => case of { + => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VCondAnter ! p.p ! q + + }; + } ; + + UseRCl temp p rcl = { + s = \\q => case of { + => temp.s ++ p.s ++ rcl.s ! VPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPerfPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPast ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPerfPast ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VFut ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPerfFut ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VCondSimul ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VCondAnter ! p.p ! ODir ! q + }; + c = rcl.c + } ; + + UseSlash temp p clslash = { + s = case of { + => temp.s ++ p.s ++ clslash.s ! VPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPerfPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPast ! p.p ! ODir ; + => temp.s ++ p.s ++ clslash.s ! VPerfPast ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VFut ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPerfFut ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VCondSimul ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VCondSimul ! p.p ! ODir + }; + c2 = clslash.c2 + } ; + + AdvS a s = {s = a.s ++ s.s} ; + + RelS s r = {s = s.s ++ r.s ! agrPesP3 Sg} ; + SSubjS s sj s = { s = s.s ++ sj.s ++ s.s}; + +} diff --git a/lib/src/persian/StructuralPes.gf b/lib/src/persian/StructuralPes.gf new file mode 100644 index 000000000..b0303e15d --- /dev/null +++ b/lib/src/persian/StructuralPes.gf @@ -0,0 +1,133 @@ +concrete StructuralPes of Structural = CatPes ** + open MorphoPes, ParadigmsPes, Prelude, NounPes in { + + flags optimize=all ; + coding = utf8; + + lin + above_Prep = ss "بالای" ; + after_Prep = ss ["بعد از"] ; + all_Predet = ss ["همه ی"] ; + almost_AdA, almost_AdN = ss "تقریباً" ; + although_Subj = ss ["با وجود این"] ; + always_AdV = ss "همیشه" ; + and_Conj = sd2 [] "و" ** {n = Pl} ; + because_Subj = ss ["برای این"] ; + before_Prep = ss ["قبل از"] ; + behind_Prep = ss "پشت" ; + between_Prep = ss "بین" ; + both7and_DConj = sd2 "هم" ["و هم"] ** {n = Pl} ; + but_PConj = ss "اما" ; + by8agent_Prep = ss "توسط" ; + by8means_Prep = ss "با" ; +-- can8know_VV,can_VV = mkV "سکن" ** { isAux = True} ; + during_Prep = ss ["در طول"] ; + either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ; +-- everybody_NP = MassNP (UseN (MorphoPnb.mkN11 ["هر کwی"])); -- not a good way coz need to include NounPnb + every_Det = mkDet "هر" Sg ; +-- everything_NP = MassNP (UseN (MorphoPnb.mkN11 ["هر XE"])); + everywhere_Adv = ss ["هر جا"] ; + few_Det = mkDet ["تعداد کمی"] Pl True; -- check +-- first_Ord = {s = "اولین" ; n = Sg} ; --DEPRECATED + for_Prep = ss "برای" ; + from_Prep = ss "از" ; + he_Pron = personalPN "او" Sg PPers3 ; + here_Adv = ss "اینجا" ; + here7to_Adv = ss "اینجا" ; + here7from_Adv = ss "اینجا" ; + how_IAdv = ss "چطور" ; + how8many_IDet = {s = "چند" ; n = Pl ; isNum = True} ; + how8much_IAdv = ss "چقدر" ; + if_Subj = ss "اگر" ; + in8front_Prep = ss "جلوی" ; + i_Pron = personalPN "من" Sg PPers1; + in_Prep = ss "در" ; + it_Pron = personalPN "آن" Sg PPers3; + less_CAdv = {s = "کمتر" ; p = ""} ; + many_Det = mkDet ["تعداد زیادی"] Pl True; -- check + more_CAdv = {s = "بیشتر" ; p = "" } ; + most_Predet = ss "اکثر"; + much_Det = mkDet ["مقدار زیادی"] Pl ; +-- must_VV = { +-- s = table { +-- VVF VInf => ["هوe تْ"] ; +-- VVF VPres => "مست" ; +-- VVF VPPart => ["هد تْ"] ; +-- VVF VPresPart => ["هونگ تْ"] ; +-- VVF VPast => ["هد تْ"] ; --# notpresent +-- VVPastNeg => ["هدn'ت تْ"] ; --# notpresent +-- VVPresNeg => "مستn'ت" +-- } ; +-- isAux = True +-- } ; +-----b no_Phr = ss "نْ" ; + + + no_Utt = ss "نه" ; + on_Prep = ss "روی" ; +-- one_Quant = demoPN "یک" ; -- DEPRECATED + only_Predet = ss "فقط" ; + or_Conj = sd2 [] "یا" ** {n = Sg} ; + otherwise_PConj = ss ["درغیراین صورت"] ; + part_Prep = ss "از" ; -- the object following it should be in Ezafa form + please_Voc = ss "لطفاً" ; + possess_Prep = ss "" ; -- will be handeled in Ezafeh + quite_Adv = ss "کاملاً" ; + she_Pron = personalPN "او" Sg PPers3 ; + so_AdA = ss "بسیار" ; +-- somebody_NP = MassNP (UseN (MorphoPnb.mkN11 "کwی" )); + someSg_Det = mkDet "مقداری" Sg True ; + somePl_Det = mkDet "چند" Pl True ; +-- something_NP = MassNP (UseN (MorphoPnb.mkN11 "چیزی")); + somewhere_Adv = ss "جایی" ; + that_Quant = mkQuant "آن" "آن"; + that_Subj = ss "آن"; + there_Adv = ss "آنجا" ; + there7to_Adv = ss "آنجا" ; + there7from_Adv = ss "آنجا" ; + therefore_PConj = ss ["به همین دلیل"] ; + they_Pron = personalPN ["آن ها"] Pl PPers3 ; + this_Quant = mkQuant "این" "این" ; + through_Prep = ss ["از طریق"] ; + too_AdA = ss "خیلی" ; + to_Prep = ss "به" ** {lock_Prep = <>}; + under_Prep = ss "زیر" ** {lock_Prep = <>}; + very_AdA = ss "خیلی" ; + want_VV = mkV "خواستن" "خواه" ** { isAux = False} ; + we_Pron = personalPN "ما" Pl PPers1 ; + whatSg_IP = {s = ["چه چیزی"] ; n = Sg } ; + whatPl_IP = {s = ["چه چیزهایی"] ; n = Pl } ; + when_IAdv = ss "کی" ; + when_Subj = ss "وقتی" ; + where_IAdv = ss "کجا" ; + which_IQuant = {s = "کدام" ; n = Sg} ; + whichPl_IDet = {s = "کدام" ; n = Pl ; isNum = False} ; + whichSg_IDet = { s = "کدام" ; n = Sg ; isNum = False} ; + whoSg_IP = {s = ["چه کسی"] ; n = Sg} ; + whoPl_IP = {s = ["چه کسانی"] ;n = Pl} ; + why_IAdv = ss "چرا" ; + without_Prep = ss "بدون" ; + with_Prep = ss "با"; +-- yes_Phr = ss "بله" ; + yes_Utt = ss "بله" ; + youSg_Pron = personalPN "تو" Sg PPers2 ; + youPl_Pron = personalPN "شما" Pl PPers2 ; + youPol_Pron = personalPN "شما" Sg PPers2 ; +-- no_Quant = demoPN "هیچ" ; + not_Predet = {s="نه"} ; + if_then_Conj = sd2 "اگر" "آنگاه" ** {n = Sg} ; + at_least_AdN = ss "حداقل" ; + at_most_AdN = ss "حداکثر"; +-- nothing_NP = MassNP (UseN (MorphoPnb.mkN11 "هیچ چیز" )); + except_Prep = ss ["به جز"] ; +-- nobody_NP = MassNP (UseN (MorphoPnb.mkN11 "هیچ کس")); + + as_CAdv = {s = ["به اندازه ی"] ; p = ""} ; + +-- have_V2 = mkV2 (mkV "داشتن" "دار") "را" ; + + language_title_Utt = ss "پeرسن" ; + +} + + diff --git a/lib/src/persian/SymbolPes.gf b/lib/src/persian/SymbolPes.gf new file mode 100644 index 000000000..8dbada93f --- /dev/null +++ b/lib/src/persian/SymbolPes.gf @@ -0,0 +1,47 @@ +--# -path=.:../abstract:../common + +concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in { + + flags coding = utf8; +{- + lin +-- SymbPN i = {s = \\_ => i.s ; g = Masc} ; + SymbPN i = {s = addGenitiveS i.s ; g = Masc} ; + IntPN i = {s = addGenitiveS i.s ; g = Masc} ; + FloatPN i = {s = addGenitiveS i.s ; g = Masc} ; + NumPN i = {s = \\_ =>i.s ; g = Masc} ; + CNIntNP cn i = { + s = \\c => cn.s ! Sg ! Dir ++ i.s ; + a = agrP3 cn.g Sg + } ; + CNSymbNP det cn xs = { + s = \\c => det.s!Sg!Masc ++ cn.s ! det.n ! Dir ++ xs.s ; + a = agrP3 cn.g det.n + } ; + CNNumNP cn i = { + s = \\c => cn.s ! Sg ! Dir ++ i.s ; + a = agrP3 cn.g Sg + } ; + + SymbS sy = sy ; + SymbNum sy = { s = sy.s ; n = Pl } ; + SymbOrd sy = { s = sy.s ++ "waN" ; n = Pl} ; + +lincat + + Symb, [Symb] = SS ; + +lin + MkSymb s = s ; + + BaseSymb = infixSS "tE" ; + ConsSymb = infixSS "" ; + +oper + -- Note: this results in a space before 's, but there's + -- not mauch we can do about that. + addGenitiveS : Str -> Case => Str = \s -> + table {_ => s ++ "da" } ; +-} + +} diff --git a/lib/src/persian/TextPes.gf b/lib/src/persian/TextPes.gf new file mode 100644 index 000000000..aecef148f --- /dev/null +++ b/lib/src/persian/TextPes.gf @@ -0,0 +1,11 @@ +concrete TextPes of Text = CommonX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond] ** { + +-- This works for the special punctuation marks of Persian. + + lin + TEmpty = {s = []} ; + TFullStop x xs = {s = x.s ++ "۔" ++ xs.s} ; + TQuestMark x xs = {s = x.s ++ "" ++ xs.s} ; + TExclMark x xs = {s = x.s ++ "" ++ xs.s} ; + +} diff --git a/lib/src/persian/VerbPes.gf b/lib/src/persian/VerbPes.gf new file mode 100644 index 000000000..03f8048f1 --- /dev/null +++ b/lib/src/persian/VerbPes.gf @@ -0,0 +1,49 @@ +concrete VerbPes of Verb = CatPes ** open ResPes in { + + flags coding = utf8; + flags optimize=all_subs ; + + lin + UseV v = predV v ; + SlashV2a v = predV v ** {c2 = {s = v.c2.s ; ra = v.c2.ra ; c = VTrans}} ; + Slash2V3 v np = + insertObjc (\\_ => np.s ! NPC bEzafa ++ v.c2 ) (predV v ** {c2 = {s = [] ; ra = v.c3 ; c = VTrans}}) ; + + Slash3V3 v np = + insertObjc (\\_ => v.c3 ++ np.s ! NPC bEzafa) (predV v ** {c2 = {s = [] ; ra = v.c2 ; c = VTrans}}) ; + + ComplVV v vp = insertVV (infVV v.isAux vp).s (predV v) ; + ComplVS v s = insertObj2 (conjThat ++ s.s) (predV v) ; + ComplVQ v q = insertObj2 (conjThat ++ q.s ! QIndir) (predV v) ; + ComplVA v ap = insertObj (\\_ => ap.s ! bEzafa) (predV v) ; -- check form of adjective + SlashV2V v vp = insertVV (infVV v.isAux vp).s (predV v) **{c2 = {s = v.c1 ; ra = [] ; c = VTransPost}} ; + + SlashV2S v s = insertObjc2 (conjThat ++ s.s) (predV v ** {c2 = {s = v.c2.s ;ra = [] ; c = VTransPost}}) ; + SlashV2Q v q = insertObjc2 ( q.s ! QIndir) (predV v ** {c2 = {s = v.c2.s ; ra = [] ;c = VTransPost}}) ; + SlashV2A v ap = insertObjc3 ( ap.s ! bEzafa) (predV v ** {c2 = {s = [] ; ra = v.c2.ra ;c = VTransPost}}) ; ---- paint it red , check form of adjective + + ComplSlash vp np = insertObjPre (\\_ => np.s ! NPC bEzafa ) vp ; + SlashVV vv vp = + -- insertObj (infVV vv.isAux vp).s (predV vv) ** + insertVV (infVV vv.isAux vp).s (predV vv) ** + {c2 = vp.c2} ; + SlashV2VNP vv np vp = + insertObjPre (\\_ => np.s ! NPC bEzafa ) +-- (insertObjc (infVV vv.isAux vp).s (predVc vv)) ** + (insertVVc (infVV vv.isAux vp).s (predVc vv)) ** + {c2 = vp.c2} ; + + UseComp comp = insertObj comp.s (predAux auxBe) ; + + AdvVP vp adv = insertAdV adv.s vp ; + + AdVVP adv vp = insertAdV adv.s vp ; + ReflVP v = insertObjPre (\\a => reflPron ! a) v ; + PassV2 v = predV v ; -- need to be fixed + CompAP ap ={s = \\_ => ap.s ! bEzafa} ; -- check form of adjective + CompNP np = {s = \\a => np.s ! NPC bEzafa} ; + CompAdv adv = {s = \\_ => adv.s } ; + CompCN cn = {s = \\a => cn.s ! bEzafa ! giveNumber a } ; + + +} diff --git a/lib/src/persian/src/AdjectivePes.gf b/lib/src/persian/src/AdjectivePes.gf new file mode 100644 index 000000000..6355d4170 --- /dev/null +++ b/lib/src/persian/src/AdjectivePes.gf @@ -0,0 +1,48 @@ +concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in { + + flags coding = utf8; + lin + + PositA a = a ; + UseComparA a = a; + + ComparA a np = { + s =\\ez => a.s ! ez ++ "tr" ++ "Az" ++ np.s ! NPC bEzafa ; + adv = a.adv + } ; + +---- $SuperlA$ belongs to determiner syntax in $Noun$. + + ComplA2 a np = { + s =\\ez => np.s ! NPC bEzafa ++ a.c2 ++ a.s ! ez ; + adv = a.adv + } ; + + ReflA2 a = { + s =\\ez => a.s ! ez ++ "" ; -- need to be fixed + adv = a.adv + } ; + + SentAP ap sc = { + s =\\ez => ap.s! ez ++ sc.s ; + adv = ap.adv + } ; + + AdAP ada ap = { + s =\\ez => ada.s ++ ap.s ! ez ; + adv = ap.adv + } ; + + UseA2 a = a ; + + CAdvAP cadv ap np = { + s =\\ez => cadv.s ++ np.s ! NPC bEzafa ++ ap.s ! ez ; + adv = ap.adv + }; + + AdjOrd ord = { s =\\_ => ord.s ; adv = ""}; + + + + AdvAP ap adv = {s =\\ez => ap.s ! ez ++ adv.s ; adv = ap.adv}; +} diff --git a/lib/src/persian/src/AdverbPes.gf b/lib/src/persian/src/AdverbPes.gf new file mode 100644 index 000000000..26018d1ef --- /dev/null +++ b/lib/src/persian/src/AdverbPes.gf @@ -0,0 +1,22 @@ +concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in { + + flags coding = utf8; + lin + -- PositAdvAdj a = {s = a.s ! bEzafa } ; + PositAdvAdj a = {s = a.adv } ; + ComparAdvAdj cadv a np = { + s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! NPC bEzafa ; + } ; + ComparAdvAdjS cadv a s = { + s = a.adv ++ cadv.p ++ cadv.s ++ s.s; + } ; + + PrepNP prep np = {s = prep.s ++ np.s ! NPC aEzafa } ; + + AdAdv ada adv = { s = ada.s ++ adv.s} ; + +-- SubjS = cc2 ; + SubjS sub snt = {s = sub.s ++ "kh" ++ snt.s } ; + AdnCAdv cadv = {s = cadv.s ++ "Az"} ; + +} diff --git a/lib/src/persian/src/IdiomPes.gf b/lib/src/persian/src/IdiomPes.gf new file mode 100644 index 000000000..d4cc69977 --- /dev/null +++ b/lib/src/persian/src/IdiomPes.gf @@ -0,0 +1,40 @@ +concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in { + + flags optimize=all_subs ; + flags coding = utf8; + + lin + + ImpersCl vp = mkSClause " " (agrPesP3 Sg) vp ; + GenericCl vp = mkSClause "A:dm" (agrPesP3 Sg) vp ; + + CleftNP np rs = + let cl = mkSClause (np.s ! NPC bEzafa) (np.a) (predAux auxBe); + in + {s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a }; + + CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s}; + + ExistNP np = + mkSClause " " (agrPesP3 (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPC bEzafa) (predAux auxBe)) ; + + ExistIP ip = + let cl = mkSClause ( ip.s ) (agrPesP3 ip.n) (predAux auxBe); + in { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! ODir; + QIndir => cl.s ! t! p ! ODir + } + }; + +-- ProgrVP vp = insertObj (\\a => vp.obj.s ++ vp.ad ++ vp.comp ! a ++ (vp.s ! VPStem).inf ++ raha (fromAgr a).g (fromAgr a).n ) (predAux auxBe) ; + ProgrVP vp = (predProg vp) ; + + + ImpPl1 vp = {s = "byAyyd" ++ (vp.s ! VVForm (agrPesP1 Pl)).inf} ; + ImpP3 np vp = {s = "bgWAryd" ++ np.s!NPC bEzafa ++ (vp.s ! VVForm (AgPes (fromAgr np.a).n (fromAgr np.a).p)).inf}; + + +} + diff --git a/lib/src/persian/src/LexiconPes.gf b/lib/src/persian/src/LexiconPes.gf new file mode 100644 index 000000000..2dedd9911 --- /dev/null +++ b/lib/src/persian/src/LexiconPes.gf @@ -0,0 +1,374 @@ +--# -path=.:prelude:alltenses + +concrete LexiconPes of Lexicon = CatPes ** +--open ResPnb, Prelude in { + open ParadigmsPes,MorphoPes, Prelude in { + + flags + optimize=values ; + coding = utf8; + + lin + + airplane_N = mkN01 "hvApymA" inanimate ; + answer_V2S = mkV2 (compoundV "jvAb" (mkV "dAdn" "dh")) "bh" False; + apartment_N = mkN01 "A:pArtmAn" inanimate; + apple_N = mkN01 "syb" inanimate; + art_N = mkN01 "hnr" inanimate; + ask_V2Q = mkV2 (mkV_1 "prsydn") "Az" False; + baby_N = mkN01 "bc^h" animate; -- has variant "kvdk" + bad_A = mkA "bd" ; + bank_N = mkN01 "bAnk" inanimate; + beautiful_A = mkA "zybA" ; + become_VA = mkV "Cdn" "Cv"; + beer_N = mkN01 "A:bjv" inanimate; + beg_V2V = mkV2V (compoundV "KvAhC" (mkV "krdn" "kn")) "Az" "" False; + big_A = mkA "bzrg" ; + bike_N = mkN01 "dvc^rKh" inanimate; + bird_N = mkN02 "prndh" animate; + black_A = mkA "syAh" ; + blue_A = mkA "A:by" ; + boat_N = mkN01 "qAyq" inanimate; + book_N = mkN01 "ktAb" inanimate; + boot_N = mkN01 "c^kmh" inanimate; -- has variant "pvtyn" + boss_N = mkN02 "kArfrmA" animate; + boy_N = mkN02 "psr" animate; + bread_N = mkN01 "nAn" inanimate; + break_V2 = mkV2 (mkV "Ckstn" "Ckn") "rA"; + broad_A = mkA "vsyc" ; + brother_N2 = (mkN01 "brAdr" animate) ** {c=""}; + brown_A = mkA ["qhvh Ay"] ; + butter_N = mkN01 "krh" inanimate; + buy_V2 = mkV2 (mkV_1 "Krydn") "rA"; + camera_N = mkN01 "dvrbyn" inanimate; + cap_N = mkCmpdNoun1 "klAh" (mkN01 "kp" animate); + car_N = mkN01 "mACyn" inanimate; -- has variant "Atvmbyl" + carpet_N = mkN01 "frC" inanimate; + cat_N = mkN01 "grbh" animate; + ceiling_N = mkN01 "sqf" inanimate; + chair_N = mkN01 "Sndly" inanimate; + cheese_N = mkN01 "pnyr" inanimate; + child_N = mkN02 "frznd" animate; -- has variant "bc^h" + church_N = mkN01 "klysA" inanimate; + city_N = mkN01 "Chr" inanimate; + clean_A = mkA "tmyz" ; + clever_A = mkA "bAhvC" ["bA hvCmndy"]; + close_V2 = mkV2 (mkV "bstn" "bnd") "rA"; + coat_N = mkN01 "kt" inanimate; + cold_A = mkA "srd" ; + come_V = mkV "A:mdn" "A:y" ; + computer_N = mkN01 "kAmpyvtr" inanimate; -- also vaiant "rAyAnh" + country_N = mkN01 "kCvr" inanimate; + +-- Note: cousin inflects for gender and for being a mother's or a father's relatives in persian +-- The following is an example which is the daughter of your mom's brother + cousin_N = mkCmpdNoun1 "dKtr" (mkN01 "dAyy" animate); + cow_N = mkN01 "gAv" animate; + die_V = mkV "mrdn" "myr" ; + dirty_A = mkA "kt-yf" ; + distance_N3 = (mkN "fASlh" "fvASl" inanimate ) ** {c2="Az" ; c3 = "tA"}; + doctor_N = mkN01 "dktr" animate; -- has variant "pzCk", but only a doctor in medicine + dog_N = mkN01 "sg" animate; + door_N = mkN01 "dr" inanimate; + drink_V2 = mkV2 (mkV_1 "nvCydn") "rA"; +-- easy_A2V = mkA "A:sAn" "" ; + eat_V2 = mkV2 (mkV_2 "Kvrdn") "rA" ; + empty_A = mkA "KAly" ; + enemy_N = mkN02 "dCmn" animate; + factory_N = mkN01 "kArKAnh" inanimate; + father_N2 = (mkN02 "pdr" animate) ** {c=""}; + fear_VS = mkV_1 "trsydn"; + find_V2 = mkV2 (compoundV "pydA" (mkV "krdn" "kn") ) "rA"; + fish_N = mkN01 "mAhy" animate; + floor_N = mkN01 "zmyn" inanimate; -- Note: floor in persian can have 3 different translations + forget_V2 = mkV2 (compoundV "frAmvC" (mkV "krdn" "kn")) "rA" ; + fridge_N = mkN01 "yKc^Al" inanimate; + friend_N = mkN02 "dvst" animate; + fruit_N = mkN01 "myvh" inanimate; +-- fun_AV = mkAV "jAlb" ; + garden_N = mkN01 "bAG" inanimate; + girl_N = mkN02 "dKtr" animate; + glove_N = mkN01 "dstkC" inanimate; + gold_N = mkN01 "TlA" inanimate; + good_A = mkA "Kvb" ; + go_V = mkV "rftn" "rv"; + green_A = mkA "sbz" ; + harbour_N = mkN "bndr" "bnAdr" inanimate; +-- hate_V2 = mkV2 (compoundV "mtnfr" (mkToBe "bvdn" "bAC" "hst")) "Az" False; -- needs from/ verb to be + hat_N = mkN01 "klAh" inanimate; + have_V2 = mkV2 haveVerb "rA" ; + hear_V2 = mkV2 (mkV "Cnydn" "Cnv") "rA" ; + hill_N = mkN01 "tph" inanimate; +-- hope_VS = compoundV "AmydvAr" (mkToBe "bvdn" "bAC" "hst"); + horse_N = mkN01 "Asb" animate; + hot_A = mkA "dAG" ["dAG dAG"] ; + house_N = mkN01 "KAnh" inanimate; + important_A = mkA "mhm" ["bA Ahmyt"]; + industry_N = mkN "Snct" "SnAyc" inanimate; + iron_N = mkN01 "A:hn" inanimate; + king_N = mkN "pAdCAh" "pAdCAhAn" animate; + know_V2 = mkV2 (mkV "CnAKtn" "CnAs") "rA"; + know_VS = (mkV_1 "dAnstn"); + know_VQ = (mkV_1 "dAnstn") ; + lake_N = mkN01 "dryAc^h" inanimate; + lamp_N = mkN01 "c^rAG" inanimate; -- also "lAmp", but they have different usage + learn_V2 = mkV2 (compoundV "yAd"(mkV "grftn" "gyr")) "rA"; + leather_N = mkN01 "c^rm" inanimate; -- is uncountable + leave_V2 = mkV2 (compoundV "trk"(mkV "krdn" "kn")) "rA"; + like_V2 = mkV2 (compoundV "dvst" haveVerb) "rA"; + listen_V2 = mkV2 (compoundV "gvC" (mkV "dAdn" "dh")) "bh" False; -- has a diferent preposition :"bh" + live_V = compoundV "zndgy" (mkV "krdn" "kn"); + long_A = mkA "blnd" ; + lose_V2 = mkV2 (compoundV "gm" (mkV "krdn" "kn")) "rA" ; + love_N = mkN01 "cCq" inanimate; + love_V2 = mkV2 (compoundV "dvst" haveVerb) "rA"; -- also possible: love_V2 = mkV2 (compoundV "cACq" (mkToBe "bvdn" "bAC" "hst")); + man_N = mkN02 "mrd" animate; + married_A2 = mkA "mtA?hl" ""; + meat_N = mkN01 "gvCt" inanimate; + milk_N = mkN01 "Cyr" inanimate; + moon_N = mkN01 "mAh" inanimate; -- is this not a proper noun? + mother_N2 = (mkN02 "mAdr" animate) ** {c=""}; + mountain_N = mkN01 "kvh" inanimate; + music_N = mkN "mvsyqy" "mvsyqy" animate; + narrow_A = mkA "bAryk" ; + new_A = mkA "nv" "tAzh"; + newspaper_N = mkN01 "rvznAmh" inanimate; + oil_N = mkN "nft" "nft" inanimate; -- also "rvGn" + old_A = mkA "pyr" "pyrAnh"; + open_V2 = mkV2 (compoundV "bAz" (mkV "krdn" "kn")) "rA"; + paint_V2A = mkV2 (compoundV "rng" (mkV "krdn" "kn")) "rA" ; + paper_N = mkN01 "kAGW" inanimate; + paris_PN = mkPN "pArys" inanimate; + peace_N = mkN01 "SlH" inanimate; -- also "A:rAmC" + pen_N = mkN01 "qlm" inanimate; -- has variant "KvdkAr" + planet_N = mkN01 "syv2Arh" inanimate; + plastic_N = mkN01 "plAstyk" inanimate; -- is uncountable + play_V2 = mkV2 (mkV "nvAKtn" "nvAz") "rA" ; + policeman_N = mkCmpdNoun2 (mkN02 "mA?mvr" animate) "plys"; + priest_N = mkN01 "kCyC" animate; +-- probable_AS = mkAS (regA "mHtml") ; + queen_N = mkN01 "mlkh" animate; + radio_N = mkN01 "rAdyv" inanimate; + rain_V0 = compoundV "bArAn" (mkV "A:mdn" "A:y" ) ; + read_V2 = mkV2 (mkV_2 "KvAndn") "rA"; + red_A = mkA "qrmz" ; + religion_N = mkN "mWhb" "mWAhb" inanimate; + restaurant_N = mkN01 "rstvrAn" inanimate; + river_N = mkN01 "rvdKAnh" inanimate; + rock_N = mkN01 "SKrh" inanimate; + roof_N = mkN01 "bAm" inanimate; -- has variant "sqf" + rubber_N = mkN01 "pAkkn" inanimate; -- also "lAstyk" + run_V = mkV_1 "dvydn" ; + say_VS = mkV "gftn" "gvy" ; + school_N = mkN "mdrsh" "mdArs" inanimate; + science_N = mkN "clm" "clvm" inanimate; -- also "dAnC" + sea_N = mkN01 "dryA" inanimate; + seek_V2 = mkV2 (compoundV "jstjv" (mkV "krdn" "kn")) "rA"; + see_V2 = mkV2 (mkV "dydn" "byn") "rA" ; + sell_V3 = mkV3 (mkV "frvKtn" "frvC") "rA" "bh"; + send_V3 = mkV3 (mkV_1 "frstAdn") "rA" "brAy"; + sheep_N = mkN01 "gvsfnd" animate; + ship_N = mkN01 "kCty" inanimate; + shirt_N = mkN01 "pyrAhn" inanimate; + shoe_N = mkN01 "kfC" inanimate; + shop_N = mkN01 "frvCgAh" inanimate; -- has variant "mGAzh" + short_A = mkA "kvtAh" ; + silver_N = mkN "nqrh" ["nqrh jAt"] inanimate; -- add new function which applies + "jAt" + sister_N = mkN02 "KvAhr" animate; + sleep_V = mkV_1 "KvAbydn" ; + small_A = mkA "kvc^k" ; + snake_N = mkN01 "mAr" animate; + sock_N = mkN01 "jvrAb" inanimate; + speak_V2 = mkV2 (compoundV "SHbt" (mkV "krdn" "kn")) "bA" False; + star_N = mkN01 "stArh" animate; + steel_N = mkN01 "fvlAd" inanimate; -- also "Astyl" + stone_N = mkN01 "sng" inanimate; + stove_N = mkN01 "AjAq" inanimate; + student_N = mkCmpdNoun1 "dAnC" (mkN02 "A:mvz" animate); -- also "dAnCjv" + stupid_A = mkA "Ablh" "AblhAnh" ; + sun_N = mkN01 "KvrCyd" inanimate; -- is this not a proper noun?!!! + switch8off_V2 = mkV2 (compoundV "KAmvC" (mkV "krdn" "kn")) "rA"; + switch8on_V2 = mkV2 (compoundV "rvCn" (mkV "krdn" "kn")) "rA"; + table_N = mkN01 "myz" inanimate; + talk_V3 = mkV3 (compoundV "Hrf" (mkV "zdn" "zn")) "bA" [" drbArh y"]; + teacher_N = mkN02 "mclm" animate; + teach_V2 = mkV2 (compoundV "A:mvzC" (mkV "dAdn" "dh")) "rA"; + television_N = mkN01 "tlvzyvn" inanimate; + thick_A = mkA "klft" ; + thin_A = mkA "nAzk" ; + train_N = mkN01 "qTAr" inanimate; + travel_V = compoundV "sfr" (mkV "krdn" "kn"); + tree_N = mkN02 "drKt" animate; + trousers_N = mkN01 "ClvAr" inanimate; + ugly_A = mkA "zCt" ; + understand_V2 = mkV2 (mkV_1 "fhmydn") "rA"; + university_N = mkN01 "dAnCgAh" inanimate; + village_N = mkN01 "rvstA" inanimate; +-- wait_V2 = mkV2 (compoundV "mntZr" (mkVToBe "bvdn" "bAC")); + walk_V = compoundV "rAh" (mkV "rftn" "rv"); + warm_A = mkA "grm" ; + war_N = mkN01 "jng" inanimate; +-- watch_V2 = mkV2 (compoundV "mrAqb" (mkVToBe "bvdn" "bAC")); -- check harfe rabt!!! + water_N = mkN01 "A:b" inanimate; + white_A = mkA "sfyd" ; + window_N = mkN01 "pnjrh" inanimate; + wine_N = mkN01 "CrAb" inanimate; + win_V2 = mkV2 (compoundV "brndh" (mkV "Cdn" "Cv")) "rA"; -- also possible with simple verb: mkV_2 "brdn" + woman_N = mkN02 "zn" animate; +-- wonder_VQ = compoundV "mtcjb" (mkVToBe "bvdn" "bAC") ; + wood_N = mkN01 "c^vb" inanimate; + write_V2 = mkV2 (mkV "nvCtn" "nvys") "rA" ; + yellow_A = mkA "zrd" ; + young_A = mkA "jvAn""jvAnAnh" ; + do_V2 = mkV2 (compoundV "AnjAm" (mkV "dAdn" "dh")) "rA"; + now_Adv = ss "HAlA" ; + already_Adv = ss "qblAa." ; + song_N = mkN01 "A:vAz" inanimate; + add_V3 = mkV3 (compoundV "ADAfh" (mkV "krdn" "kn")) "rA" "bh" ; + number_N = mkN01 "cdd" inanimate; -- also "tcdAd" + put_V2 = mkV2 (mkV "gWACtn" "gWAr") "rA"; + stop_V = compoundV "tvqf" (mkV "krdn" "kn"); + jump_V = mkV_1 "prydn"; +{- + left_Ord = {s = "c^p" ; n = singular}; + right_Ord = {s= "rAst" ; n = singular}; +-} + far_Adv = ss "dvr" ; + correct_A = mkA "drst" ; + dry_A = mkA "KCk" ["bh KCky"] ; + dull_A = mkA ["mlAl A:vr"] ["bh Trzy mlAl A:vr"] ; + full_A = mkA "pr" ; + heavy_A = mkA "sngyn" ; + near_A = mkA "nzdyk" ; + rotten_A = mkA "KrAb" ; + round_A = mkA "grd" ; + sharp_A = mkA "tyz" ; + smooth_A = mkA "nrm" ; + straight_A = mkA "mstqym" "mstqymAa."; + wet_A = mkA "Kys" ; + wide_A = mkA "phn" ; + animal_N = mkN "HyvAn" "HyvAnAt" animate; + ashes_N = mkN01 "KAkstr" inanimate; + back_N = mkN01 "kmr" inanimate; + bark_N = mkN01 "cvcv" inanimate; + belly_N = mkN01 "Ckm" inanimate; + blood_N = mkN01 "Kvn" inanimate; + bone_N = mkN01 "AstKvAn" inanimate; + breast_N = mkN01 "synh" inanimate; + cloud_N = mkN01 "Abr" inanimate; + day_N = mkN01 "rvz" inanimate; + dust_N = mkN01 "GbAr" inanimate; + ear_N = mkN01 "gvC" inanimate; + earth_N = mkN01 "zmyn" inanimate; -- also "KAk" + egg_N = mkCmpdNoun1 "tKm" (mkN01 "mrG" inanimate); + eye_N = mkN01 "c^Cm" inanimate ; + fat_N = mkN01 "c^rby" inanimate; + feather_N = mkN01 "pr" inanimate; + fingernail_N = mkN01 "nAKn" inanimate; + fire_N = mkN01 "A:tC" inanimate; + flower_N = mkN01 "gl" inanimate; + fog_N = mkN01 "mh" inanimate; + foot_N = mkN01 "pA" inanimate; + forest_N = mkN01 "jngl" inanimate; + grass_N = mkN01 "c^mn" inanimate; + guts_N = mkN01 "ChAmt" inanimate; + hair_N = mkN01 "mv" inanimate; + hand_N = mkN01 "dst" inanimate; + head_N = mkN01 "sr" inanimate; + heart_N = mkN01 "qlb" inanimate; + horn_N = mkN01 "bvq" inanimate; -- also "CAK" + husband_N = mkN02 "Cvhr" animate; + ice_N = mkN01 "yK" inanimate; + knee_N = mkN01 "zAnv" inanimate; + leaf_N = mkN01 "brg" inanimate; + leg_N = mkN01 "pA" inanimate; + liver_N = mkN01 "rvdKAnh" inanimate; + louse_N = mkN01 "CpC" inanimate; + mouth_N = mkN01 "dhAn" inanimate; + name_N = mkN01 "nAm" inanimate; -- has variant "Asm" + neck_N = mkN01 "grdn" inanimate; + night_N = mkN01 "Cb" inanimate; + nose_N = mkN01 "byny" inanimate; + person_N = mkN "CKS" "ACKAS" animate; + rain_N = mkN01 "bArAn" inanimate; + road_N = mkN01 "jAdh" inanimate; + root_N = mkN01 "ryCh" inanimate; + rope_N = mkN01 "TnAb" inanimate; + salt_N = mkN01 "nmk" inanimate; + sand_N = mkN01 "mAsh" inanimate; + seed_N = mkN01 "dAnh" inanimate; + skin_N = mkN01 "pvst" inanimate; + sky_N = mkN01 "A:smAn" inanimate; + smoke_N = mkN01 "dvd" inanimate; + snow_N = mkN01 "brf" inanimate; + stick_N = mkN01 "trkh" inanimate; + tail_N = mkN01 "dm" inanimate; + tongue_N = mkN01 "zbAn" inanimate; + tooth_N = mkN01 "dndAn" inanimate; + wife_N = mkN02 "hmsr" animate; + wind_N = mkN01 "bAd" inanimate; + wing_N = mkN01 "bAl" inanimate; + worm_N = mkN01 "krm" inanimate; + year_N = mkN01 "sAl" inanimate; + blow_V = mkV_1 "dmydn" ; + breathe_V = compoundV "nfs" (mkV_1 "kCydn"); + burn_V = mkV "svKtn" "svz" ; + dig_V = mkV_2 "kndn" ; + fall_V = mkV_1 "AftAdn" ; +-- float_V = compoundV "CnAvr" (mkToBe "bvdn" "bAC" "hst") ; + flow_V = compoundV "jAry" (mkV "Cdn" "Cv") ; + fly_V = compoundV "prvAz" (mkV "krdn" "kn") ; + freeze_V = compoundV "yK" (mkV "zdn" "zn") ; + give_V3 = mkV3 (mkV "dAdn" "dh") "rA" "bh"; + laugh_V = mkV_1 "Kndydn" ; + lie_N = mkN01 "drvG" inanimate; + lie_V = compoundV "drvG" (mkV "gftn" "gv" ); + play_V = compoundV "bAzy" (mkV "krdn" "kn"); + sew_V = mkV "dvKtn" "dvz" ; + sing_V = compoundV "A:vAz" (mkV_2 "KvAndn"); + sit_V = mkV "nCstn" "nCyn" ; + smell_V = compoundV "bv" (mkV "dAdn" "dh"); + spit_V = compoundV "tf" (mkV "krdn" "kn"); + stand_V = mkV_1 "AystAdn"; + swell_V = compoundV "vrm" (mkV "krdn" "kn"); + swim_V = compoundV "CnA" (mkV "krdn" "kn"); + think_V = compoundV "fkr" (mkV "krdn" "kn"); + turn_V = mkV_1 "c^rKydn" ; + vomit_V = compoundV "AstfrAG" (mkV "krdn" "kn"); + bite_V2 = mkV2 (compoundV "gAz" (mkV "grftn" "gyr")) "rA"; + count_V2 = mkV2 (mkV_2 "CmArdn") "rA"; + cut_V2 = mkV2 (mkV_1 "brydn") ; + fear_V2 = mkV2 (mkV_1 "trsydn") "Az"; + fight_V2 = mkV2 (mkV_1 "jngydn") "bA" False; + hit_V2 = mkV2 (compoundV "Drbh" (mkV "zdn" "zn")) "bh" False; + hold_V2 = mkV2 (compoundV "ngh" haveVerb) "rA"; + hunt_V2 = mkV2 (compoundV "CkAr" (mkV "krdn" "kn")) "rA"; + kill_V2 = mkV2 ( mkV_2 "kCtn") "rA"; + pull_V2 = mkV2 (mkV_1 "kCydn") "rA"; + push_V2 = mkV2 (compoundV "hl" (mkV "dAdn" "dh")) "rA" ; + rub_V2 = mkV2 (mkV_1 "mAlydn") "rA"; + scratch_V2 = mkV2 (mkV_1 "KrACydn") "rA" ; + split_V2 = mkV2 (compoundV "tqsym" (mkV "krdn" "kn")) "rA"; + squeeze_V2 = mkV2 (compoundV "lh" (mkV "krdn" "kn")) "rA"; + stab_V2 = mkV2 (compoundV "c^Aqv" (mkV "zdn" "zn")) "bh" False; + suck_V2 = mkV2 (mkV_1 "mkydn") "rA" ; + throw_V2 = mkV2 (compoundV "prtAb" (mkV "krdn" "kn")) "rA"; + tie_V2 = mkV2 (compoundV "grh" (mkV "zdn" "zn")) "rA"; + wash_V2 = mkV2 (mkV "Cstn" "Cvr") "rA" ; -- also "Cvy" which is the very formal form of the present root + wipe_V2 = mkV2 (compoundV "pAk" (mkV "krdn" "kn")) "rA"; + +---- other_A = regA "dygr" ; + + grammar_N = mkCmpdNoun1 "dstvr" (mkN01 "zbAn" inanimate); + language_N = mkN01 "zbAn" inanimate; + rule_N = mkN "qAnvn" "qvAnyn" inanimate; + +---- added 4/6/2007 + john_PN = mkPN "jAn" inanimate; + question_N = mkN01 "sw?Al" inanimate; -- has variant "prsC" + ready_A = mkA "A:mAdh" ["bA A:mAdgy"] ; + reason_N = mkN "dlyl" "dlAyl" inanimate; + today_Adv = ss "Amrvz" ; + uncertain_A = mkA "nAmclvm" ["bA trdyd"]; + +} diff --git a/lib/src/persian/src/MorphoPes.gf b/lib/src/persian/src/MorphoPes.gf new file mode 100644 index 000000000..f2820af1f --- /dev/null +++ b/lib/src/persian/src/MorphoPes.gf @@ -0,0 +1,507 @@ +--# -path=.:../../prelude +-- +----1 A Simple Punjabi Resource Morphology +---- +---- Shafqat Virk, Aarne Ranta,2010 +---- +---- This resource morphology contains definitions needed in the resource +---- syntax. To build a lexicon, it is better to use $ParadigmsPnb$, which +---- gives a higher-level access to this module. +-- +resource MorphoPes = ResPes ** open Prelude,Predef in { + + flags optimize=all ; + coding = utf8; + +----2 Nouns + +oper + + mkN : (x1,x2 : Str) -> Animacy -> Noun = + \sg,pl,ani -> { + s = table { + bEzafa => table { Sg => sg ; + Pl => pl + } ; + aEzafa => table { Sg => mkEzafa sg ; + Pl => mkEzafa pl + } ; + enClic => table { Sg => mkEnclic sg ; + Pl => mkEnclic pl + } + }; + animacy = ani ; + definitness = True + } ; + + + +-- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e) +-- Arabic nouns ends with h. also taken as Masc + ------------------------------------------------------------------ +----Verbs +------------------------------------------------------------------ +{- + mkVerb : (x1,x2 : Str) -> Verb = \inf,root2 -> + let root1 = (tk 1 inf) ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + + VF tense aspect person number => (mkCmnVF root1 root2 tense aspect person number).s +-- Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ; +-- Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s + } + } ; + +--1. Basic stem form, direct & indirect causatives exists +-- v1 nechna nechaana nechwana + + mkVerb1 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 3 inf) ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + + VF tense aspect person number => (mkCmnVF root1 root2 tense aspect person number).s +-- Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ; +-- Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s + } + } ; + + +mkVerb2 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 2 inf) ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + + VF tense aspect person number => (mkCmnVF root1 root2 tense aspect person number).s +-- Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ; +-- Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s + } + } ; + + + +mkCmnVF : Str -> Str -> VTense -> PAspect -> PPerson -> Number -> {s:Str}= \root1,root2,t,a,p,n -> + {s = (mkCmnVF1 root1 root2 t a p n).s ; + }; + + + mkCmnVF1 : Str -> Str -> VTense -> PAspect -> PPerson -> Number -> {s:Str}= \root1,root2,t,a,p,n -> + {s = let khordh = root1 + "h"; + mekhor = "my" ++ root2 ; + mekhord = "my" ++ root1 ; + mekhordh = "my" ++ khordh ; + khah = "KvAh" ; + mekhah = "my" ++ khah ; + bvdh = "bvdh" + in + case of { + => khordh ++ "Am" ; + => khordh ++ "Aym" ; + => khordh ++ "Ay" ; + => khordh ++ "Ayd" ; + => khordh ++ "Ast" ; + => khordh ++ "And" ; + + => mekhor + "m" ; -- toHave need to have khor instead of mekhor + => mekhor + "ym" ; + => mekhor + "y" ; + => mekhor + "yd" ; + => mekhor + "d" ; + => mekhor + "nd" ; + + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + + => khordh ++ "bvdm" ; + => khordh ++ "bvdym" ; + => khordh ++ "bvdy" ; + => khordh ++ "bvdyd" ; + => khordh ++ "bvd" ; + => khordh ++ "bvdnd" ; + + => mekhord + "m" ; -- toHave need to have khor instead of mekhor + => mekhord + "ym" ; + => mekhord + "y"; + => mekhord + "yd" ; + => mekhord ; + => mekhord + "nd" ; + + => root1 + "m" ; + => root1 + "ym" ; + => root1 + "y"; + => root1 + "yd" ; + => root1 ; + => root1 + "nd" ; + + -- check this one + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + + => mekhah + "m" ++ addBh root2 + "m" ; + => mekhah + "ym" ++ addBh root2 + "ym" ; + => mekhah + "y" ++ addBh root2 + "y" ; + => mekhah + "yd" ++ addBh root2 + "yd" ; + => mekhah + "d" ++ addBh root2 + "d" ; + => mekhah + "nd" ++ addBh root2 + "nd" ; + + => khah + "m" ++ root1 ; + => khah + "ym" ++ root1 ; + => khah + "y" ++ root1 ; + => khah + "yd" ++ root1 ; + => khah + "d" ++ root1 ; + => khah + "nd" ++ root1 ; + + + => khordh ++ bvdh ++ "Am" ; + => khordh ++ bvdh ++ "Aym" ; + => khordh ++ bvdh ++ "Ay" ; + => khordh ++ bvdh ++ "Ayd" ; + => khordh ++ bvdh ++ "Ast" ; + => khordh ++ bvdh ++ "And" ; + + => mekhordh ++ "Am" ; -- toHave need to have khordh instead of mekhor + => mekhordh ++ "Aym" ; + => mekhordh ++ "Ay" ; + => mekhordh ++ "Ayd" ; + => mekhordh ++ "Ast" ; + => mekhordh ++ "And" ; + + + -- check this one + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + => "" + + + } + } ; + -} + mkVerb : (x1,x2 : Str) -> Verb = \inf,root2 -> + let root1 = (tk 1 inf) ; + impRoot = mkimpRoot root2; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + Imp Pos Sg => addBh impRoot ; + Imp Pos Pl => (addBh impRoot) + "yd" ; + Imp Neg Sg => "n" + impRoot ; + Imp Neg Pl => "n" + impRoot + "yd" ; + + VF pol tense person number => (mkCmnVF root1 root2 pol tense person number).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes number person) => (mkvVform root2 number person).s + } + } ; + + mkVerb1 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 3 inf) ; + impRoot = mkimpRoot root2 ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + Imp Pos Sg => addBh impRoot ; + Imp Pos Pl => (addBh impRoot) + "yd" ; + Imp Neg Sg => "n" + impRoot ; + Imp Neg Pl => "n" + impRoot + "yd" ; + + VF pol tense person number => (mkCmnVF root1 root2 pol tense person number).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes number person) => (mkvVform root2 number person).s + } + }; + + +mkVerb2 : (_: Str) -> Verb = \inf -> + let root1 = (tk 1 inf) ; + root2 = (tk 2 inf) ; + impRoot = mkimpRoot root2 ; + in { + s = table { + + Root1 => root1 ; + Root2 => root2 ; + Inf => inf ; + Imp Pos Sg => addBh impRoot ; + Imp Pos Pl => (addBh impRoot) + "yd" ; + Imp Neg Sg => "n" + impRoot ; + Imp Neg Pl => "n" + impRoot + "yd" ; + + VF pol tense person number => (mkCmnVF root1 root2 pol tense person number).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes number person) => (mkvVform root2 number person).s + } + } ; + + mkHave : Verb = + + { + s = table { + + Root1 => "dACt" ; + Root2 => "dAr" ; + Inf => "dACtn" ; + Imp Pos Sg => ["dACth bAC"] ; + Imp Pos Pl => ["dACth bACyd"]; + Imp Neg Sg => ["ndACth bAC"] ; + Imp Neg Pl => ["ndACth bACyd"] ; + + VF pol tense person number => (toHave pol tense number person).s ; +-- VF Neg tense person number => addN (mkCmnVF root1 root2 tense person number).s ; + Vvform (AgPes Sg PPers1) => ["dACth bACm"] ; + Vvform (AgPes Sg PPers2) => ["dACth bACy"] ; + Vvform (AgPes Sg PPers3) => ["dACth bACd"] ; + Vvform (AgPes Pl PPers1) => ["dACth bACym"] ; + Vvform (AgPes Pl PPers2) => ["dACth bACyd"] ; + Vvform (AgPes Pl PPers3) => ["dACth bACnd"] + } + } ; + + +mkCmnVF : Str -> Str -> Polarity -> VTense2 -> PPerson -> Number -> {s:Str}= \root1,root2,pol,t,p,n -> + {s = (mkCmnVF1 root1 root2 pol t p n).s ; + }; + + + mkCmnVF1 : Str -> Str -> Polarity -> VTense2 -> PPerson -> Number -> {s:Str}= \root1,root2,pol,t,p,n -> + {s = let khordh = root1 + "h"; + nkhordh = (addN root1) + "h" ; + mekhor = "my" ++ root2 ; + nmekhor = "nmy" ++ root2 ; + mekhord = "my" ++ root1 ; + nmekhord = "nmy" ++ root1 ; + mekhordh = "my" ++ khordh ; + nmekhordh = "nmy" ++ khordh ; + khah = "KvAh" ; + nkhah = "nKvAh" ; + mekhah = "my" ++ khah ; + nmekhah = "nmy" ++ khah ; + bvdh = "bvdh" + in + case of { + => khordh ++ "Am" ; + => khordh ++ "Aym" ; + => khordh ++ "Ay" ; + => khordh ++ "Ayd" ; + => khordh ++ "Ast" ; + => khordh ++ "And" ; + + => mekhor + "m" ; + => mekhor + "ym" ; + => mekhor + "y" ; + => mekhor + "yd" ; + => mekhor + "d" ; + => mekhor + "nd" ; + + + => khordh ++ "bvdm" ; + => khordh ++ "bvdym" ; + => khordh ++ "bvdy" ; + => khordh ++ "bvdyd" ; + => khordh ++ "bvd" ; + => khordh ++ "bvdnd" ; + + => mekhord + "m" ; + => mekhord + "ym" ; + => mekhord + "y"; + => mekhord + "yd" ; + => mekhord ; + => mekhord + "nd" ; + + => root1 + "m" ; + => root1 + "ym" ; + => root1 + "y"; + => root1 + "yd" ; + => root1 ; + => root1 + "nd" ; + + {- + => mekhah + "m" ++ addBh root2 + "m" ; + => mekhah + "ym" ++ addBh root2 + "ym" ; + => mekhah + "y" ++ addBh root2 + "y" ; + => mekhah + "yd" ++ addBh root2 + "yd" ; + => mekhah + "d" ++ addBh root2 + "d" ; + => mekhah + "nd" ++ addBh root2 + "nd" ; + -} + => khah + "m" ++ root1 ; + => khah + "ym" ++ root1 ; + => khah + "y" ++ root1 ; + => khah + "yd" ++ root1 ; + => khah + "d" ++ root1 ; + => khah + "nd" ++ root1 ; + + + => khordh ++ bvdh ++ "Am" ; + => khordh ++ bvdh ++ "Aym" ; + => khordh ++ bvdh ++ "Ay" ; + => khordh ++ bvdh ++ "Ayd" ; + => khordh ++ bvdh ++ "Ast" ; + => khordh ++ bvdh ++ "And" ; + + => mekhordh ++ "Am" ; + => mekhordh ++ "Aym" ; + => mekhordh ++ "Ay" ; + => mekhordh ++ "Ayd" ; + => mekhordh ++ "Ast" ; + => mekhordh ++ "And" ; + + -- negatives + + => addN khordh ++ "Am" ; + => addN khordh ++ "Aym" ; + => addN khordh ++ "Ay" ; + => addN khordh ++ "Ayd" ; + => addN khordh ++ "Ast" ; + => addN khordh ++ "And" ; + + + => nmekhor + "m" ; + => nmekhor + "ym" ; + => nmekhor + "y" ; + => nmekhor + "yd" ; + => nmekhor + "d" ; + => nmekhor + "nd" ; + + => nkhordh ++ "bvdm" ; + => nkhordh ++ "bvdym" ; + => nkhordh ++ "bvdy" ; + => nkhordh ++ "bvdyd" ; + => nkhordh ++ "bvd" ; + => nkhordh ++ "bvdnd" ; + + => nmekhord + "m" ; + => nmekhord + "ym" ; + => nmekhord + "y"; + => nmekhord + "yd" ; + => nmekhord ; + => nmekhord + "nd" ; + + + => addN root1 + "m" ; + => addN root1 + "ym" ; + => addN root1 + "y"; + => addN root1 + "yd" ; + => addN root1 ; + => addN root1 + "nd" ; + + {- + => nmekhah + "m" ++ addBh root2 + "m" ; + => nmekhah + "ym" ++ addBh root2 + "ym" ; + => nmekhah + "y" ++ addBh root2 + "y" ; + => nmekhah + "yd" ++ addBh root2 + "yd" ; + => nmekhah + "d" ++ addBh root2 + "d" ; + => nmekhah + "nd" ++ addBh root2 + "nd" ; + -} + => nkhah + "m" ++ root1 ; + => nkhah + "ym" ++ root1 ; + => nkhah + "y" ++ root1 ; + => nkhah + "yd" ++ root1 ; + => nkhah + "d" ++ root1 ; + => nkhah + "nd" ++ root1 ; + + + => nkhordh ++ bvdh ++ "Am" ; + => nkhordh ++ bvdh ++ "Aym" ; + => nkhordh ++ bvdh ++ "Ay" ; + => nkhordh ++ bvdh ++ "Ayd" ; + => nkhordh ++ bvdh ++ "Ast" ; + => nkhordh ++ bvdh ++ "And" ; + + => nmekhordh ++ "Am" ; + => nmekhordh ++ "Aym" ; + => nmekhordh ++ "Ay" ; + => nmekhordh ++ "Ayd" ; + => nmekhordh ++ "Ast" ; + => nmekhordh ++ "And" + + + } + + } ; + + mkvVform : Str -> Number -> PPerson -> {s: Str} = \root2,n,p -> + {s = + case of { + => addBh root2 + "m" ; + => addBh root2 + "y" ; + => addBh root2 + "d" ; + => addBh root2 + "ym" ; + => addBh root2 + "yd" ; + => addBh root2 + "nd" + } + }; + + mkimpRoot : Str -> Str ; + mkimpRoot root = + case root of { + st + "y" => st ; + _ => root + }; + + +addBh : Str -> Str ; +addBh str = + case (take 1 str) of { + "A" => "by" + str ; + "A:" => "byA" + (drop 1 str) ; + _ => "b" + str + }; + + --------------------- + --Determiners + -------------------- + + makeDet : Str -> Number -> Bool -> {s: Str ; n : Number ; isNum : Bool ; fromPron : Bool} =\str,n,b -> { + s = str; + isNum = b; + fromPron = False ; + n = n + }; + makeQuant : Str -> Str -> {s : Number => Str ; a : AgrPes ; fromPron : Bool } = \sg,pl -> { + s = table {Sg => sg ; Pl => pl} ; + fromPron = False ; + a = agrPesP3 Sg + }; +--------------------------- +-- Adjectives +-------------------------- +mkAdj : Str -> Str -> Adjective = \adj,adv -> { + s = table { bEzafa => adj; + aEzafa => mkEzafa adj ; + enClic => mkEnclic adj + } ; + adv = adv + }; +} \ No newline at end of file diff --git a/lib/src/persian/src/NumeralPes.gf b/lib/src/persian/src/NumeralPes.gf new file mode 100644 index 000000000..580a70244 --- /dev/null +++ b/lib/src/persian/src/NumeralPes.gf @@ -0,0 +1,140 @@ +--# -path=.:../abstract:../common: +concrete NumeralPes of Numeral = CatPes [Numeral,Digits] ** open ResPes,Prelude in { + +flags coding = utf8; + +param DForm = unit | teen | ten | hundreds |thousands; +param DSize = sg | r2 | r3 | r4 | r5 | r6 | r7 | r8 | r9 ; +param Size = singl | less100 | more100 ; + + +lincat + Digit = {s : DForm => CardOrd => Str} ; + Sub10 = {s : DForm => CardOrd => Str ; n : Number} ; + Sub100 = {s : CardOrd => Str ; n : Number} ; + Sub1000 = {s : CardOrd => Str ; n : Number} ; + Sub1000000 = {s : CardOrd => Str ; n : Number} ; + +lin num x = x ; +-- 2 12 20 200 +lin n2 = mkNum "dv" "dvAzdh" "byst" "dvyst" ; +lin n3 = mkNum3 "sh" "syzdh" "sy" "sySd" "svm" ; +lin n4 = mkNum "c^hAr" "c^hArdh" "c^hl" "c^hArSd" ; +lin n5 = mkNum "pnj" "pAnzdh" "pnjAh" "pAnSd" ; +lin n6 = mkNum "CC" "CAnzdh" "CSt" "CCSd" ; +lin n7 = mkNum "hft" "hfdh" "hftAd" "hftSd" ; +lin n8 = mkNum "hCt" "hjdh" "hCtAd" "hCtSd" ; +lin n9 = mkNum "nh" "nvzdh" "nvd" "nhSd" ; + +lin pot01 = mkNum3 "yk" "yAzdh" "dh" "ykSd" "hzAr" ** {n = Sg} ; + +lin pot0 d = d ** {n = Pl} ; + +lin pot110 = {s = table { NCard => "dh" ; + NOrd => "dhm" }; + n = Pl} ; +lin pot111 = {s = table { NCard => "yAzdh" ; + NOrd => "yAzdhm" }; + n = Pl}; + +lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; + +lin pot1plus d e = { + s = \\o => d.s ! ten ! NCard ++"v" ++e.s ! unit ! o ; n = Pl} ; + +lin pot1as2 n = n ; + +lin pot2 d = {s = d.s ! hundreds} ** {n = Pl} ; +lin pot2plus d e = { + s = \\o => d.s ! hundreds ! NCard ++ "v" ++ e.s ! o ; n = Pl} ; -- remove "??" + +lin pot2as3 n = n ; + +lin pot3 n = { s = \\o => n.s ! NCard ++ "hzAr" ; n = Pl} ; + +lin pot3plus n m = { + s = \\o => n.s ! NCard ++ "hzAr" ++ "v" ++ m.s ! o; n = Pl} ; -- missing word "????????" after NCard + +-- numerals as sequences of digits + + lincat + Dig = TDigit ; + + lin + IDig d = d ** {tail = T1} ; +{- + IIDig d i = { + s = \\o,c => d.s ! NCard ++ commaIf i.tail ++ i.s ! o ! c ; + n = Pl ; + -- tail = inc i.tail + } ; +-} + D_0 = mkDig "?" ; + D_1 = mk3Dig "?" "" Pl; + D_2 = mk2Dig "?" ""; + D_3 = mk2Dig "?" "svm" ; + D_4 = mkDig "?" ; + D_5 = mkDig "?" ; + D_6 = mkDig "?" ; + D_7 = mkDig "?" ; + D_8 = mkDig "?" ; + D_9 = mkDig "?" ; + + -- lin IDig d = { s = \\_ => d.s ; n = Sg} ; + lin IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + + oper + commaIf : DTail -> Str = \t -> case t of { + T3 => "," ; + _ => [] + } ; + + inc : DTail -> DTail = \t -> case t of { + T1 => T2 ; + T2 => T3 ; + T3 => T1 + } ; + + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c + "m") ; + + mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { + -- s = table {NCard => regGenitiveS c ; NOrd => regGenitiveS o} ; + s = table {NCard => c ; NOrd => o} ; + n = n + } ; + + oper TDigit = { + n : Number ; + s : CardOrd => Str + } ; + + +oper + mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = + \two, twelve, twenty, twohundred-> + {s = table { + unit => table {NCard => two ; NOrd => (two + "myn") | (two + "m")}; + teen => table {NCard => twelve ; NOrd => (twelve + "myn") | (twelve + "m")} ; + ten => table {NCard => twenty ; NOrd => (twenty + "myn") | (twenty + "m")}; + hundreds => table {NCard => twohundred ; NOrd => (twohundred +"myn") | (twohundred + "m")}; + thousands => table {NCard => (two + "hzAr" ); NOrd => (two + "hzAr" + "m") | (two + "hzAr" +"myn" )} + + }}; + + mkNum3 : Str -> Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = + \two, twelve, twenty, twohundred, second-> + {s = table { + unit => table {NCard => two ; NOrd => second}; + teen => table {NCard => twelve ; NOrd => (twelve + "myn") | (twelve + "m")} ; + ten => table {NCard => twenty ; NOrd => (twenty + "myn") | (twenty + "m")}; + hundreds => table {NCard => twohundred ; NOrd => (twohundred +"myn") | (twohundred + "m")}; + thousands => table {NCard => (two + "hzAr" ); NOrd => (two + "hzAr" + "m") | (two + "hzAr"+ "myn" )} + + }}; + + + +} diff --git a/lib/src/persian/src/ParadigmsPes.gf b/lib/src/persian/src/ParadigmsPes.gf new file mode 100644 index 000000000..7f1ccec79 --- /dev/null +++ b/lib/src/persian/src/ParadigmsPes.gf @@ -0,0 +1,206 @@ +--# -path=.:../abstract:../../prelude:../common +-- +----1 Pnbu Lexical Paradigms + +resource ParadigmsPes = open + Predef, + Prelude, + MorphoPes, + CatPes + in { + + flags optimize=all ; + coding = utf8; + +--2 Parameters + +oper + animate : Animacy ; + inanimate : Animacy ; + singular : Number; + plural : Number; + + singular = Sg ; plural = Pl; + + animate = Animate ; inanimate = Inanimate ; --i + mkN01 : Str -> Animacy -> Noun ; + mkN01 str ani = mkN str (str ++ "hA") ani; + mkN02 : Str -> Animacy -> Noun ; + mkN02 str ani = case (last str) of { + "h" => mkN str ((init str) + "gAn") ani ; + ("A"|"v") => mkN str (str + "yAn") ani ; + _ => mkN str (str+"An") ani + }; +{- + +--2 Nouns + + + mkN2 : N -> Prep -> Str -> N2; + mkN2 = \n,p,c -> n ** {lock_N2 = <> ; c2 = p.s ; c3 = c } ; + + mkN3 : N -> Prep -> Str -> Str-> N3 ; + mkN3 = \n,p,q,r -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q ; c4 = r} ; +-} +-- Compound Nouns + + mkCmpdNoun1 : Str -> N -> N + = \s,noun -> {s =\\ez,n => s ++ noun.s ! ez ! n ; animacy = noun.animacy ; definitness = noun.definitness ; lock_N = <>}; + mkCmpdNoun2 : N -> Str -> N + = \noun,s -> {s =\\ez,n => noun.s ! ez ! n ++ s ; animacy = noun.animacy ; definitness =noun.definitness ; lock_N = <>}; + + +-- Proper names + mkPN : Str -> Animacy -> PN = + + \str,ani -> {s = str ; animacy = ani ; lock_PN = <>} ; + + +-- Personal Pronouns + personalPN : Str -> Number -> PPerson -> Pron = + \str,nn,p -> {s = str ; a = AgPes nn p ; ps = str ; lock_Pron = <>}; +{- +-- Demonstration Pronouns + demoPN : Str -> Str -> Str -> Quant = + \s1,s2,s3 -> let n = makeDemonPronForm s1 s2 s3 in {s = n.s ; a = defaultAgr ; lock_Quant = <>}; +-- Determiner +-} + mkDet = overload { + mkDet : Str -> Number -> Det = + \s1,n -> makeDet s1 n False ** { lock_Det = <>}; + mkDet : Str -> Number -> Bool -> Det = + \s1,n,b -> makeDet s1 n b ** { lock_Det = <>}; + }; + {- +-- Intergative pronouns + mkIP : (x1,x2,x3,x4:Str) -> Number -> Gender -> IP = + \s1,s2,s3,s4,n,g -> let p = mkIntPronForm s1 s2 s3 s4 in { s = p.s ; n = n ; g = g ; lock_IP = <>}; + +-- AdN + mkAdN : Str -> AdN = \s -> ss s ; +-} +--2 Adjectives + + mkA = overload { + mkA : Str-> A + = \str -> mkAdj str str ** { lock_A = <>} ; + mkA : Str-> Str -> A + = \str,adv -> mkAdj str adv ** { lock_A = <>} ; + mkA : Str -> Str -> A2 + = \a,c -> mkAdj a a ** { c2 = c ; lock_A2 = <>} ; + } ; + +--2 Verbs + mkV : Str -> Str -> V + = \s1, s2 -> mkVerb s1 s2 ** {lock_V = <>} ; + -- mkVerb takes both the Infinitive and the present root(root2) and is applied for iregular verbs + haveVerb : V = mkHave ; + mkV_1 : Str -> V + = \s -> mkVerb1 s ** {lock_V = <>} ; + + mkV_2 : Str -> V + = \s -> mkVerb2 s ** {lock_V = <>} ; + + mkV2 = overload { +-- mkV2 : Str -> V2 +-- = \s -> mkV s ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> V2 + = \v -> v ** {c2 = {s = [] ; ra = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> Str -> V2 + = \v,ra -> v ** {c2 = {ra = ra ; s = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> Str -> Bool -> V2 + = \v,p,b -> v ** {c2 = {ra = [] ; s = p ; c = VTrans} ; lock_V2 = <>} ; + } ; + + mkV3 : V -> Str -> Str -> V3; + mkV3 v p q = v ** { c2 = p ; c3 = q ; lock_V3 = <>} ; + mkV2V : V -> Str -> Str -> Bool -> V2V ; + mkV2V v s1 s2 b = v ** {isAux = b ; c1 = s1 ; c2 = s2 ; lock_V2V = <>} ; + +-- compund verbs + compoundV = overload { + compoundV : Str -> V -> V = \s,v -> {s = \\vf => s ++ v.s ! vf ; lock_V = <>} ; + compoundV : Str -> V2 -> V = \s,v -> {s = \\vf => s ++ v.s ! vf ; lock_V = <>} ; + }; + {- + +----2 Adverbs + mkAdv : Str -> Adv = \str -> {s =\\ _ => str ; lock_Adv = <>}; + +----2 Prepositions + + mkPrep : Str -> Prep ; + mkPrep str = makePrep str ** {lock_Prep = <>}; + +--3 Determiners and quantifiers + +-- mkQuant : overload { +-- mkQuant : Pron -> Quant ; +-- mkQuant : (no_sg, no_pl, none_sg, : Str) -> Quant ; +-- } ; +-} + mkQuant = overload { +-- mkQuant : Pron -> Quant = \p -> {s = \\_,_,c => p.s!c ;a = p.a ; lock_Quant = <>}; + mkQuant : Str -> Str -> Quant = \sg,pl -> makeQuant sg pl; + } ; +{- +--2 Conjunctions + mkConj : overload { + mkConj : Str -> Conj ; -- and (plural agreement) + mkConj : Str -> Number -> Conj ; -- or (agrement number given as argument) + mkConj : Str -> Str -> Conj ; -- both ... and (plural) + mkConj : Str -> Str -> Number -> Conj ; -- either ... or (agrement number given as argument) + } ; + mkConj = overload { + mkConj : Str -> Conj = \y -> mk2Conj [] y plural ; + mkConj : Str -> Number -> Conj = \y,n -> mk2Conj [] y n ; + mkConj : Str -> Str -> Conj = \x,y -> mk2Conj x y plural ; + mkConj : Str -> Str -> Number -> Conj = mk2Conj ; + } ; + + mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> + lin Conj (sd2 x y ** {n = n}) ; + +-- mkV0 : V -> V0 ; +-- mkVS : V -> VS ; +-- mkV2S : V -> Prep -> V2S ; + mkVV : V -> VV = \v -> lin VV (v ** {isAux = False}); + + +-- mkV2V : V -> Prep -> Prep -> V2V ; +-- mkVA : V -> VA ; +-- mkV2A : V -> Prep -> V2A ; +-- mkVQ : V -> VQ ; +-- mkV2Q : V -> Prep -> V2Q ; +-- +-- mkAS : A -> AS ; +-- mkA2S : A -> Prep -> A2S ; +-- mkAV : A -> AV ; +-- mkA2V : A -> Prep -> A2V ; +-- mkA2V a p = a ** {c2 = p.s } ; +-- +---- Notice: Categories $V0, AS, A2S, AV, A2V$ are just $A$. +---- $V0$ is just $V$; the second argument is treated as adverb. +-- +-- V0 : Type ; +-- AS, A2S, AV, A2V : Type ; +-- +----. +----2 Definitions of paradigms +---- +---- The definitions should not bother the user of the API. So they are +---- hidden from the document. +-- +-- Gender = MorphoHin.Gender ; +-- Number = MorphoHin.Number ; +-- Case = MorphoHin.Case ; +-- human = Masc ; +-- nonhuman = Neutr ; +-- masculine = Masc ; +-- feminine = Fem ; +-- singular = Sg ; +-- plural = Pl ; +-- nominative = Nom ; +-- genitive = Gen ; +-} +} diff --git a/lib/src/persian/src/RelativePes.gf b/lib/src/persian/src/RelativePes.gf new file mode 100644 index 000000000..774bdae7d --- /dev/null +++ b/lib/src/persian/src/RelativePes.gf @@ -0,0 +1,54 @@ +concrete RelativePes of Relative = CatPes ** open ResPes in { + + flags optimize=all_subs ; + coding = utf8; + + lin + + RelCl cl = { + s = \\t,p,o,agr => "kh" ++ cl.s ! t ! p ! o ; + }; +-- RelVP and RelSlash slows the linking process a lot this is why it is commented for test purposes + + RelVP rp vp = { + s = \\t,p,o,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg a => a + } ; + cl = mkSClause (rp.s) agr vp; + +-- cl = case t of { +-- VPImpPast => mkSClause (rp.s ! (giveNumber agr) ! Obl) agr vp; +-- _ => mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp +-- }; + in + cl.s ! t ! p ! ODir ; +-- c = Dir + } ; + + +---- Pied piping: "at which we are looking". Stranding and empty +---- relative are defined in $ExtraHin.gf$ ("that we are looking at", +---- "we are looking at"). +-- + RelSlash rp slash = { + s = \\t,p,o,agr => rp.s ++ slash.c2.s ++ slash.s ! t ! p ! o ;--case t of { +-- VPImpPast => rp.s ! (giveNumber agr) Obl ++ slash.c2.s ++ slash.s ! t ! p ! o ; +-- _ => rp.s ! (giveNumber agr) Dir ++ slash.c2.s ++ slash.s ! t ! p ! o +-- }; +-- c = Dir + } ; + + FunRP p np rp = { + s = np.s ! NPC enClic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY + a = RAg np.a + } ; + + IdRP = { + s = "kh" ; + a = RNoAg + } ; + +} diff --git a/lib/src/persian/src/ResPes.gf b/lib/src/persian/src/ResPes.gf new file mode 100644 index 000000000..406d87083 --- /dev/null +++ b/lib/src/persian/src/ResPes.gf @@ -0,0 +1,863 @@ +--# -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 go" + | VPast -- impf Ta nahim "I went" + | VFut -- fut na/nahim "I shall go" + | VPerfPres -- perf hum na/nahim "I have gone" + | VPerfPast -- perf Ta na/nahim "I had gone" + | VPerfFut + | VCondSimul + | VCondAnter -- subj na "I may go" + ; + + + 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 { + "rA" => 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 {"rA" => 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 = "kh" ; + {- 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 => "A:yA" }; + + + + 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 => "A:yA" }; + + + + 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 = "bvd"} ; + VPImp _ _ => { inf = ""} -- need to be confirmed +-- _ => { inf = ""} + }; + obj = {s = [] ; a = defaultAgrPes} ; + subj = VIntrans ; + inf = "bvdn"; + 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 = "bvdh" ; + nbodh = "nbvdh" ; + hast = "hst" ; + nhast = "nyst" ; + bod = "bvd" ; + khah = "KvAh" ; + mekhah = "my" ++ khah ; + bash = "bAC" ; + nbod = "nbvd" ; + nkhah = "nKvAh" ; + nmekhah = "nmy" ++ khah ; + nbash = "nbAC" + in + case of { + => bodh ++ "Am" ; + => bodh ++ "Aym" ; + => bodh ++ "Ay" ; + => bodh ++ "Ayd" ; + => bodh ++ "Ast" ; + => bodh ++ "And" ; + + => hast + "m" ; + => hast + "ym" ; + => hast + "y" ; + => hast + "yd" ; + => "Ast" ; + => hast + "nd" ; + + + => ""; + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + + => "my" ++ bod + "m" ; + => "my" ++ bod + "ym" ; + => "my" ++ bod + "y"; + => "my" ++ bod + "yd" ; + => "my" ++ bod ; + => "my" ++ bod + "nd" ; + + => bod + "m" ; + => bod + "ym" ; + => bod + "y"; + => bod + "yd" ; + => bod ; + => bod + "nd" ; + + {- + => mekhah + "m" ++ bash + "m" ; + => mekhah + "ym" ++ bash + "ym" ; + => mekhah + "y" ++ bash + "y" ; + => mekhah + "yd" ++ bash + "yd" ; + => mekhah + "d" ++ bash + "d" ; + => mekhah + "nd" ++ bash + "nd" ; + -} + => khah + "m" ++ bod ; + => khah + "ym" ++ bod ; + => khah + "y" ++ bod ; + => khah + "yd" ++ bod ; + => khah + "d" ++ bod ; + => khah + "nd" ++ bod ; + + -- nagatives + + => nbodh ++ "Am" ; + => nbodh ++ "Aym" ; + => nbodh ++ "Ay" ; + => nbodh ++ "Ayd" ; + => nbodh ++ "Ast" ; + => nbodh ++ "And" ; + + => nhast + "m" ; + => nhast + "ym" ; + => nhast + "y" ; + => nhast + "yd" ; + => "nyst" ; + => nhast + "nd" ; + + + => ""; + => "" ; + => "" ; + => "" ; + => "" ; + => "" ; + + => "nmy" ++ bod + "m" ; + => "nmy" ++ bod + "ym" ; + => "nmy" ++ bod + "y"; + => "nmy" ++ bod + "yd" ; + => "nmy" ++ bod ; + => "nmy" ++ bod + "nd" ; + + => nbod + "m" ; + => nbod + "ym" ; + => nbod + "y"; + => nbod + "yd" ; + => nbod ; + => nbod + "nd" ; + + {- + => nmekhah + "m" ++ bash + "m" ; + => nmekhah + "ym" ++ bash + "ym" ; + => nmekhah + "y" ++ bash + "y" ; + => nmekhah + "yd" ++ bash + "yd" ; + => nmekhah + "d" ++ bash + "d" ; + => nmekhah + "nd" ++ bash + "nd" ; + -} + => nkhah + "m" ++ bod ; + => nkhah + "ym" ++ bod ; + => nkhah + "y" ++ bod ; + => nkhah + "yd" ++ bod ; + => nkhah + "d" ++ bod ; + => nkhah + "nd" ++ bod + + + + {- + => khordh ++ bvdh ++ "Am" ; + => khordh ++ bvdh ++ "Aym" ; + => khordh ++ bvdh ++ "Ay" ; + => khordh ++ bvdh ++ "Ayd" ; + => khordh ++ bvdh ++ "Ast" ; + => khordh ++ bvdh ++ "And" ; + + => mekhordh ++ "Am" ; + => mekhordh ++ "Aym" ; + => mekhordh ++ "Ay" ; + => mekhordh ++ "Ayd" ; + => mekhordh ++ "Ast" ; + => mekhordh ++ "And" + + + -} + } + } ; + + 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 = "dACt"; + ndasht = "ndACt" ; + dashteh = "dACth"; + ndashteh = "ndACth" ; + dar = "dAr" ; + ndar = "ndAr" ; + khah = "KvAh" ; + nkhah = "nKvAh" ; + bvdh = "bvdh" ; + in case of { + => dashteh ++ "Am" ; + => dashteh ++ "Aym" ; + => dashteh ++ "Ay" ; + => dashteh ++ "Ayd" ; + => dashteh ++ "Ast" ; + => dashteh ++ "And" ; + + => dar + "m" ; + => dar + "ym" ; + => dar + "y" ; + => dar + "yd" ; + => dar + "d" ; + => dar + "nd" ; + + + => dashteh ++ "bvdm" ; + => dashteh ++ "bvdym" ; + => dashteh ++ "bvdy" ; + => dashteh ++ "bvdyd" ; + => dashteh ++ "bvd" ; + => dashteh ++ "bvdnd" ; + + => dasht + "m" ; + => dasht + "ym" ; + => dasht + "y"; + => dasht + "yd" ; + => dasht ; + => dasht + "nd" ; + + => dasht + "m" ; + => dasht + "ym" ; + => dasht + "y"; + => dasht + "yd" ; + => dasht ; + => dasht + "nd" ; + + + => khah + "m" ++ dasht ; + => khah + "ym" ++ dasht ; + => khah + "y" ++ dasht ; + => khah + "yd" ++ dasht ; + => khah + "d" ++ dasht ; + => khah + "nd" ++ dasht ; + + + => dashteh ++ bvdh ++ "Am" ; + => dashteh ++ bvdh ++ "Aym" ; + => dashteh ++ bvdh ++ "Ay" ; + => dashteh ++ bvdh ++ "Ayd" ; + => dashteh ++ bvdh ++ "Ast" ; + => dashteh ++ bvdh ++ "And" ; + + => dashteh ++ "Am" ; + => dashteh ++ "Aym" ; + => dashteh ++ "Ay" ; + => dashteh ++ "Ayd" ; + => dashteh ++ "Ast" ; + => dashteh ++ "And" ; + + -- negatives + + => ndashteh ++ "Am" ; + => ndashteh ++ "Aym" ; + => ndashteh ++ "Ay" ; + => ndashteh ++ "Ayd" ; + => ndashteh ++ "Ast" ; + => ndashteh ++ "And" ; + + => ndar + "m" ; + => ndar + "ym" ; + => ndar + "y" ; + => ndar + "yd" ; + => ndar + "d" ; + => ndar + "nd" ; + + + => ndashteh ++ "bvdm" ; + => ndashteh ++ "bvdym" ; + => ndashteh ++ "bvdy" ; + => ndashteh ++ "bvdyd" ; + => ndashteh ++ "bvd" ; + => ndashteh ++ "bvdnd" ; + + => ndasht + "m" ; + => ndasht + "ym" ; + => ndasht + "y"; + => ndasht + "yd" ; + => ndasht ; + => ndasht + "nd" ; + + => ndasht + "m" ; + => ndasht + "ym" ; + => ndasht + "y"; + => ndasht + "yd" ; + => ndasht ; + => ndasht + "nd" ; + + + => nkhah + "m" ++ dasht ; + => nkhah + "ym" ++ dasht ; + => nkhah + "y" ++ dasht ; + => nkhah + "yd" ++ dasht ; + => nkhah + "d" ++ dasht ; + => nkhah + "nd" ++ dasht ; + + + => ndashteh ++ bvdh ++ "Am" ; + => ndashteh ++ bvdh ++ "Aym" ; + => ndashteh ++ bvdh ++ "Ay" ; + => ndashteh ++ bvdh ++ "Ayd" ; + => ndashteh ++ bvdh ++ "Ast" ; + => ndashteh ++ bvdh ++ "And" ; + + => ndashteh ++ "Am" ; + => ndashteh ++ "Aym" ; + => ndashteh ++ "Ay" ; + => ndashteh ++ "Ayd" ; + => ndashteh ++ "Ast" ; + => ndashteh ++ "And" + + + }; + + } ; + + 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 + "Ah" => str ; + st + "vh" => str ; + st + "h" => str ++ "y" ; + st + "Av" => str ; + st + "vv" => str ; + st + "v" => str + "y" ; + st + "A" => str + "y" ; + _ => str + }; +mkEnclic : Str -> Str ; +mkEnclic str = case str of { + st + "A" => str ++ "yy" ; + st + "v" => str ++ "yy" ; + st + "y" => str ++ "yy" ; + st + "h" => str ++ "yy" ; + _ => str + "y" + }; + +IndefArticle : Str ; +IndefArticle = "yk"; +taryn : Str ; +taryn = "tryn" ; + +--------------- +-- making negatives +--------------- +addN : Str -> Str ; +addN str = + case str of { + "A" + st => "ny" + str ; + "A:" + st => "nyA" + st ; + _ => "n" + str + }; +addBh2 : Str -> Str ; -- should use drop instead but it gives linking error +addBh2 str1 = + case str1 of { + "my" + str => + case str of { + "A" + st => Prelude.glue "by" str ; -- need to use '+' but it gives linking error + "A:" + st => Prelude.glue "byA" st ; + _ => Prelude.glue "b" 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 "h") ++ "Cdh" ; +-- partNP : Str -> Str = \str -> str + "h" ++ "Cdh" ; + + + +------------------------------------------ +-- 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 => "Kvdm" ; + AgPes Sg PPers2 => "Kvdt" ; + AgPes Sg PPers3 => "KvdC" ; + AgPes Pl PPers1 => "KvdmAn" ; + AgPes Pl PPers2 => "KvdtAn" ; + AgPes Pl PPers3 => "KvdCAn" + + } ; + + getPron : Animacy -> Number -> Str = \ani,number -> + case of { + => "Av" ; + => ["A:n hA"] ; + => "A:n" ; + => ["A:n hA"] + }; + + +} + diff --git a/lib/src/persian/src/SentencePes.gf b/lib/src/persian/src/SentencePes.gf new file mode 100644 index 000000000..bcaafe82d --- /dev/null +++ b/lib/src/persian/src/SentencePes.gf @@ -0,0 +1,103 @@ +concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in { + + flags optimize=all_subs ; + coding = utf8; + + lin + + PredVP np vp = mkClause np vp ; + + PredSCVP sc vp = mkSClause ("Ayn" ++ sc.s) (defaultAgrPes) vp ; + + ImpVP vp = { + s = \\pol,n => + let + agr = AgPes (numImp n) PPers2 ; + in case pol of { + CPos => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ ((vp.s ! VPImp Pos (numImp n)).inf) ++ vp.embComp; + CNeg _ => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ ((vp.s ! VPImp Neg (numImp n)).inf) ++ vp.embComp + } ; + } ; + + + SlashVP np vp = + mkClause np vp ** {c2 = vp.c2} ; + + AdvSlash slash adv = { + s = \\t,p,o => adv.s ++ slash.s ! t ! p ! o ; + c2 = slash.c2 + } ; + + SlashPrep cl prep = cl ** {c2 = { s = prep.s ; ra = [] ; c = VIntrans}} ; + + SlashVS np vs slash = + mkClause np + (insertObj2 (conjThat ++ slash.s) (predV vs)) ** + {c2 = slash.c2} ; + + EmbedS s = {s = conjThat ++ s.s} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = vp.obj.s ++ vp.inf ++ vp.comp ! defaultAgrPes} ; --- agr + + + UseCl temp p cl = + { s = case of { + => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VCondAnter ! p.p ! ODir -- this needs to be fixed by making SubjPerf in ResPnb + + }; + } ; + UseQCl temp p cl = { + s = \\q => case of { + => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VCondAnter ! p.p ! q + + }; + } ; + + UseRCl temp p rcl = { + s = \\q => case of { + => temp.s ++ p.s ++ rcl.s ! VPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPerfPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPast ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPerfPast ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VFut ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPerfFut ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VCondSimul ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VCondAnter ! p.p ! ODir ! q + }; + c = rcl.c + } ; + + UseSlash temp p clslash = { + s = case of { + => temp.s ++ p.s ++ clslash.s ! VPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPerfPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPast ! p.p ! ODir ; + => temp.s ++ p.s ++ clslash.s ! VPerfPast ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VFut ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPerfFut ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VCondSimul ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VCondSimul ! p.p ! ODir + }; + c2 = clslash.c2 + } ; + + AdvS a s = {s = a.s ++ s.s} ; + + RelS s r = {s = s.s ++ r.s ! agrPesP3 Sg} ; + SSubjS s sj s = { s = s.s ++ sj.s ++ s.s}; + +} diff --git a/lib/src/persian/src/StructuralPes.gf b/lib/src/persian/src/StructuralPes.gf new file mode 100644 index 000000000..6f0789b40 --- /dev/null +++ b/lib/src/persian/src/StructuralPes.gf @@ -0,0 +1,133 @@ +concrete StructuralPes of Structural = CatPes ** + open MorphoPes, ParadigmsPes, Prelude, NounPes in { + + flags optimize=all ; + coding = utf8; + + lin + above_Prep = ss "bAlAy" ; + after_Prep = ss ["bcd Az"] ; + all_Predet = ss ["hmh y"] ; + almost_AdA, almost_AdN = ss "tqrybAa." ; + although_Subj = ss ["bA vjvd Ayn"] ; + always_AdV = ss "hmyCh" ; + and_Conj = sd2 [] "v" ** {n = Pl} ; + because_Subj = ss ["brAy Ayn"] ; + before_Prep = ss ["qbl Az"] ; + behind_Prep = ss "pCt" ; + between_Prep = ss "byn" ; + both7and_DConj = sd2 "hm" ["v hm"] ** {n = Pl} ; + but_PConj = ss "AmA" ; + by8agent_Prep = ss "tvsT" ; + by8means_Prep = ss "bA" ; +-- can8know_VV,can_VV = mkV "skna" ** { isAux = True} ; + during_Prep = ss ["dr Tvl"] ; + either7or_DConj = sd2 "yA" "yA" ** {n = Sg} ; +-- everybody_NP = MassNP (UseN (MorphoPnb.mkN11 ["hr kwy"])); -- not a good way coz need to include NounPnb + every_Det = mkDet "hr" Sg ; +-- everything_NP = MassNP (UseN (MorphoPnb.mkN11 ["hr XE"])); + everywhere_Adv = ss ["hr jA"] ; + few_Det = mkDet ["tcdAd kmy"] Pl True; -- check +-- first_Ord = {s = "Avlyn" ; n = Sg} ; --DEPRECATED + for_Prep = ss "brAy" ; + from_Prep = ss "Az" ; + he_Pron = personalPN "Av" Sg PPers3 ; + here_Adv = ss "AynjA" ; + here7to_Adv = ss "AynjA" ; + here7from_Adv = ss "AynjA" ; + how_IAdv = ss "c^Tvr" ; + how8many_IDet = {s = "c^nd" ; n = Pl ; isNum = True} ; + how8much_IAdv = ss "c^qdr" ; + if_Subj = ss "Agr" ; + in8front_Prep = ss "jlvy" ; + i_Pron = personalPN "mn" Sg PPers1; + in_Prep = ss "dr" ; + it_Pron = personalPN "A:n" Sg PPers3; + less_CAdv = {s = "kmtr" ; p = ""} ; + many_Det = mkDet ["tcdAd zyAdy"] Pl True; -- check + more_CAdv = {s = "byCtr" ; p = "" } ; + most_Predet = ss "Akt-r"; + much_Det = mkDet ["mqdAr zyAdy"] Pl ; +-- must_VV = { +-- s = table { +-- VVF VInf => ["have to"] ; +-- VVF VPres => "must" ; +-- VVF VPPart => ["had to"] ; +-- VVF VPresPart => ["having to"] ; +-- VVF VPast => ["had to"] ; --# notpresent +-- VVPastNeg => ["hadn't to"] ; --# notpresent +-- VVPresNeg => "mustn't" +-- } ; +-- isAux = True +-- } ; +-----b no_Phr = ss "no" ; + + + no_Utt = ss "nh" ; + on_Prep = ss "rvy" ; +-- one_Quant = demoPN "yk" ; -- DEPRECATED + only_Predet = ss "fqT" ; + or_Conj = sd2 [] "yA" ** {n = Sg} ; + otherwise_PConj = ss ["drGyrAyn Svrt"] ; + part_Prep = ss "Az" ; -- the object following it should be in Ezafa form + please_Voc = ss "lTfAa." ; + possess_Prep = ss "" ; -- will be handeled in Ezafeh + quite_Adv = ss "kAmlAa." ; + she_Pron = personalPN "Av" Sg PPers3 ; + so_AdA = ss "bsyAr" ; +-- somebody_NP = MassNP (UseN (MorphoPnb.mkN11 "kwy" )); + someSg_Det = mkDet "mqdAry" Sg True ; + somePl_Det = mkDet "c^nd" Pl True ; +-- something_NP = MassNP (UseN (MorphoPnb.mkN11 "c^yzy")); + somewhere_Adv = ss "jAyy" ; + that_Quant = mkQuant "A:n" "A:n"; + that_Subj = ss "A:n"; + there_Adv = ss "A:njA" ; + there7to_Adv = ss "A:njA" ; + there7from_Adv = ss "A:njA" ; + therefore_PConj = ss ["bh hmyn dlyl"] ; + they_Pron = personalPN ["A:n hA"] Pl PPers3 ; + this_Quant = mkQuant "Ayn" "Ayn" ; + through_Prep = ss ["Az Tryq"] ; + too_AdA = ss "Kyly" ; + to_Prep = ss "bh" ** {lock_Prep = <>}; + under_Prep = ss "zyr" ** {lock_Prep = <>}; + very_AdA = ss "Kyly" ; + want_VV = mkV "KvAstn" "KvAh" ** { isAux = False} ; + we_Pron = personalPN "mA" Pl PPers1 ; + whatSg_IP = {s = ["c^h c^yzy"] ; n = Sg } ; + whatPl_IP = {s = ["c^h c^yzhAyy"] ; n = Pl } ; + when_IAdv = ss "ky" ; + when_Subj = ss "vqty" ; + where_IAdv = ss "kjA" ; + which_IQuant = {s = "kdAm" ; n = Sg} ; + whichPl_IDet = {s = "kdAm" ; n = Pl ; isNum = False} ; + whichSg_IDet = { s = "kdAm" ; n = Sg ; isNum = False} ; + whoSg_IP = {s = ["c^h ksy"] ; n = Sg} ; + whoPl_IP = {s = ["c^h ksAny"] ;n = Pl} ; + why_IAdv = ss "c^rA" ; + without_Prep = ss "bdvn" ; + with_Prep = ss "bA"; +-- yes_Phr = ss "blh" ; + yes_Utt = ss "blh" ; + youSg_Pron = personalPN "tv" Sg PPers2 ; + youPl_Pron = personalPN "CmA" Pl PPers2 ; + youPol_Pron = personalPN "CmA" Sg PPers2 ; +-- no_Quant = demoPN "hyc^" ; + not_Predet = {s="nh"} ; + if_then_Conj = sd2 "Agr" "A:ngAh" ** {n = Sg} ; + at_least_AdN = ss "HdAql" ; + at_most_AdN = ss "HdAkt-r"; +-- nothing_NP = MassNP (UseN (MorphoPnb.mkN11 "hyc^ c^yz" )); + except_Prep = ss ["bh jz"] ; +-- nobody_NP = MassNP (UseN (MorphoPnb.mkN11 "hyc^ ks")); + + as_CAdv = {s = ["bh AndAzh y"] ; p = ""} ; + +-- have_V2 = mkV2 (mkV "dACtn" "dAr") "rA" ; + + language_title_Utt = ss "persian" ; + +} + + diff --git a/lib/src/persian/translit.gfs b/lib/src/persian/translit.gfs new file mode 100644 index 000000000..87d9b8902 --- /dev/null +++ b/lib/src/persian/translit.gfs @@ -0,0 +1,11 @@ +rf -file=src/LexiconPes.gf | ps -env=quotes -to_persian | wf -file=LexiconPes.gf +rf -file=src/ParadigmsPes.gf | ps -env=quotes -to_persian | wf -file=ParadigmsPes.gf +rf -file=src/MorphoPes.gf | ps -env=quotes -to_persian | wf -file=MorphoPes.gf +rf -file=src/StructuralPes.gf | ps -env=quotes -to_persian | wf -file=StructuralPes.gf +rf -file=src/ResPes.gf | ps -env=quotes -to_persian | wf -file=ResPes.gf +rf -file=src/AdjectivePes.gf | ps -env=quotes -to_persian | wf -file=AdjectivePes.gf +rf -file=src/IdiomPes.gf | ps -env=quotes -to_persian | wf -file=IdiomPes.gf +rf -file=src/RelativePes.gf | ps -env=quotes -to_persian | wf -file=RelativePes.gf +rf -file=src/AdverbPes.gf | ps -env=quotes -to_persian | wf -file=AdverbPes.gf +rf -file=src/SentencePes.gf | ps -env=quotes -to_persian | wf -file=SentencePes.gf +rf -file=src/NumeralPes.gf | ps -env=quotes -to_persian | wf -file=NumeralPes.gf \ No newline at end of file