1
0
forked from GitHub/gf-core

PersianRG

This commit is contained in:
virk.shafqat
2011-06-13 18:23:30 +00:00
parent 525bf8f410
commit 052c75a71c
39 changed files with 5728 additions and 0 deletions

View File

@@ -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};
}

View File

@@ -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 ++ "از"} ;
}

View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:../prelude
concrete AllPer of AllPerAbs =
LangPer
-- ExtraPer
** {} ;

View File

@@ -0,0 +1,4 @@
abstract AllPerAbs =
Lang
-- ExtraPnbAbs
** {} ;

95
lib/src/persian/CatPes.gf Normal file
View File

@@ -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} ;
}

View File

@@ -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 };
}

View File

@@ -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
} ;
} ;

View File

@@ -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
}

View File

@@ -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 ;
}

View File

@@ -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};
}

View File

@@ -0,0 +1,10 @@
--# -path=.:../abstract:../common:../hindustani
concrete LangPes of Lang =
GrammarPes,
LexiconPes
** {
flags startcat = Phr ; unlexer=unwords ; lexer=words ;
}

View File

@@ -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 "نامعلوم" ["با تردید"];
}

View File

@@ -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} ;
}

View File

@@ -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 <t,a,p,n> of {
<PPresent,PPerf,PPers1,Sg> => khordh ++ "ام" ;
<PPresent,PPerf,PPers1,Pl> => khordh ++ "ایم" ;
<PPresent,PPerf,PPers2,Sg> => khordh ++ "ای" ;
<PPresent,PPerf,PPers2,Pl> => khordh ++ "اید" ;
<PPresent,PPerf,PPers3,Sg> => khordh ++ "است" ;
<PPresent,PPerf,PPers3,Pl> => khordh ++ "اند" ;
<PPresent,PImperf,PPers1,Sg> => mekhor + "م" ; -- toHave need to have khor instead of mekhor
<PPresent,PImperf,PPers1,Pl> => mekhor + "یم" ;
<PPresent,PImperf,PPers2,Sg> => mekhor + "ی" ;
<PPresent,PImperf,PPers2,Pl> => mekhor + "ید" ;
<PPresent,PImperf,PPers3,Sg> => mekhor + "د" ;
<PPresent,PImperf,PPers3,Pl> => mekhor + "ند" ;
<PPresent,Aorist,PPers1,Sg> => "" ;
<PPresent,Aorist,PPers1,Pl> => "" ;
<PPresent,Aorist,PPers2,Sg> => "" ;
<PPresent,Aorist,PPers2,Pl> => "" ;
<PPresent,Aorist,PPers3,Sg> => "" ;
<PPresent,Aorist,PPers3,Pl> => "" ;
<PPast,PPerf,PPers1,Sg> => khordh ++ "بودم" ;
<PPast,PPerf,PPers1,Pl> => khordh ++ "بودیم" ;
<PPast,PPerf,PPers2,Sg> => khordh ++ "بودی" ;
<PPast,PPerf,PPers2,Pl> => khordh ++ "بودید" ;
<PPast,PPerf,PPers3,Sg> => khordh ++ "بود" ;
<PPast,PPerf,PPers3,Pl> => khordh ++ "بودند" ;
<PPast,PImperf,PPers1,Sg> => mekhord + "م" ; -- toHave need to have khor instead of mekhor
<PPast,PImperf,PPers1,Pl> => mekhord + "یم" ;
<PPast,PImperf,PPers2,Sg> => mekhord + "ی";
<PPast,PImperf,PPers2,Pl> => mekhord + "ید" ;
<PPast,PImperf,PPers3,Sg> => mekhord ;
<PPast,PImperf,PPers3,Pl> => mekhord + "ند" ;
<PPast,Aorist,PPers1,Sg> => root1 + "م" ;
<PPast,Aorist,PPers1,Pl> => root1 + "یم" ;
<PPast,Aorist,PPers2,Sg> => root1 + "ی";
<PPast,Aorist,PPers2,Pl> => root1 + "ید" ;
<PPast,Aorist,PPers3,Sg> => root1 ;
<PPast,Aorist,PPers3,Pl> => root1 + "ند" ;
-- check this one
<PFut,PPerf,PPers1,Sg> => "" ;
<PFut,PPerf,PPers1,Pl> => "" ;
<PFut,PPerf,PPers2,Sg> => "" ;
<PFut,PPerf,PPers2,Pl> => "" ;
<PFut,PPerf,PPers3,Sg> => "" ;
<PFut,PPerf,PPers3,Pl> => "" ;
<PFut,PImperf,PPers1,Sg> => mekhah + "م" ++ addBh root2 + "م" ;
<PFut,PImperf,PPers1,Pl> => mekhah + "یم" ++ addBh root2 + "یم" ;
<PFut,PImperf,PPers2,Sg> => mekhah + "ی" ++ addBh root2 + "ی" ;
<PFut,PImperf,PPers2,Pl> => mekhah + "ید" ++ addBh root2 + "ید" ;
<PFut,PImperf,PPers3,Sg> => mekhah + "د" ++ addBh root2 + "د" ;
<PFut,PImperf,PPers3,Pl> => mekhah + "ند" ++ addBh root2 + "ند" ;
<PFut,Aorist,PPers1,Sg> => khah + "م" ++ root1 ;
<PFut,Aorist,PPers1,Pl> => khah + "یم" ++ root1 ;
<PFut,Aorist,PPers2,Sg> => khah + "ی" ++ root1 ;
<PFut,Aorist,PPers2,Pl> => khah + "ید" ++ root1 ;
<PFut,Aorist,PPers3,Sg> => khah + "د" ++ root1 ;
<PFut,Aorist,PPers3,Pl> => khah + "ند" ++ root1 ;
<Infr_Past,PPerf,PPers1,Sg> => khordh ++ bvdh ++ "ام" ;
<Infr_Past,PPerf,PPers1,Pl> => khordh ++ bvdh ++ "ایم" ;
<Infr_Past,PPerf,PPers2,Sg> => khordh ++ bvdh ++ "ای" ;
<Infr_Past,PPerf,PPers2,Pl> => khordh ++ bvdh ++ "اید" ;
<Infr_Past,PPerf,PPers3,Sg> => khordh ++ bvdh ++ "است" ;
<Infr_Past,PPerf,PPers3,Pl> => khordh ++ bvdh ++ "اند" ;
<Infr_Past,PImperf,PPers1,Sg> => mekhordh ++ "ام" ; -- toHave need to have khordh instead of mekhor
<Infr_Past,PImperf,PPers1,Pl> => mekhordh ++ "ایم" ;
<Infr_Past,PImperf,PPers2,Sg> => mekhordh ++ "ای" ;
<Infr_Past,PImperf,PPers2,Pl> => mekhordh ++ "اید" ;
<Infr_Past,PImperf,PPers3,Sg> => mekhordh ++ "است" ;
<Infr_Past,PImperf,PPers3,Pl> => mekhordh ++ "اند" ;
-- check this one
<Infr_Past,Aorist,PPers1,Sg> => "" ;
<Infr_Past,Aorist,PPers1,Pl> => "" ;
<Infr_Past,Aorist,PPers2,Sg> => "" ;
<Infr_Past,Aorist,PPers2,Pl> => "" ;
<Infr_Past,Aorist,PPers3,Sg> => "" ;
<Infr_Past,Aorist,PPers3,Pl> => ""
}
} ;
-}
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 <pol,t,p,n> of {
<Pos,PPresent2 PrPerf,PPers1,Sg> => khordh ++ "ام" ;
<Pos,PPresent2 PrPerf,PPers1,Pl> => khordh ++ "ایم" ;
<Pos,PPresent2 PrPerf,PPers2,Sg> => khordh ++ "ای" ;
<Pos,PPresent2 PrPerf,PPers2,Pl> => khordh ++ "اید" ;
<Pos,PPresent2 PrPerf,PPers3,Sg> => khordh ++ "است" ;
<Pos,PPresent2 PrPerf,PPers3,Pl> => khordh ++ "اند" ;
<Pos,PPresent2 PrImperf,PPers1,Sg> => mekhor + "م" ;
<Pos,PPresent2 PrImperf,PPers1,Pl> => mekhor + "یم" ;
<Pos,PPresent2 PrImperf,PPers2,Sg> => mekhor + "ی" ;
<Pos,PPresent2 PrImperf,PPers2,Pl> => mekhor + "ید" ;
<Pos,PPresent2 PrImperf,PPers3,Sg> => mekhor + "د" ;
<Pos,PPresent2 PrImperf,PPers3,Pl> => mekhor + "ند" ;
<Pos,PPast2 PstPerf,PPers1,Sg> => khordh ++ "بودم" ;
<Pos,PPast2 PstPerf,PPers1,Pl> => khordh ++ "بودیم" ;
<Pos,PPast2 PstPerf,PPers2,Sg> => khordh ++ "بودی" ;
<Pos,PPast2 PstPerf,PPers2,Pl> => khordh ++ "بودید" ;
<Pos,PPast2 PstPerf,PPers3,Sg> => khordh ++ "بود" ;
<Pos,PPast2 PstPerf,PPers3,Pl> => khordh ++ "بودند" ;
<Pos,PPast2 PstImperf,PPers1,Sg> => mekhord + "م" ;
<Pos,PPast2 PstImperf,PPers1,Pl> => mekhord + "یم" ;
<Pos,PPast2 PstImperf,PPers2,Sg> => mekhord + "ی";
<Pos,PPast2 PstImperf,PPers2,Pl> => mekhord + "ید" ;
<Pos,PPast2 PstImperf,PPers3,Sg> => mekhord ;
<Pos,PPast2 PstImperf,PPers3,Pl> => mekhord + "ند" ;
<Pos,PPast2 PstAorist,PPers1,Sg> => root1 + "م" ;
<Pos,PPast2 PstAorist,PPers1,Pl> => root1 + "یم" ;
<Pos,PPast2 PstAorist,PPers2,Sg> => root1 + "ی";
<Pos,PPast2 PstAorist,PPers2,Pl> => root1 + "ید" ;
<Pos,PPast2 PstAorist,PPers3,Sg> => root1 ;
<Pos,PPast2 PstAorist,PPers3,Pl> => root1 + "ند" ;
{-
<Pos,PFut2 FtImperf,PPers1,Sg> => mekhah + "م" ++ addBh root2 + "م" ;
<Pos,PFut2 FtImperf,PPers1,Pl> => mekhah + "یم" ++ addBh root2 + "یم" ;
<Pos,PFut2 FtImperf,PPers2,Sg> => mekhah + "ی" ++ addBh root2 + "ی" ;
<Pos,PFut2 FtImperf,PPers2,Pl> => mekhah + "ید" ++ addBh root2 + "ید" ;
<Pos,PFut2 FtImperf,PPers3,Sg> => mekhah + "د" ++ addBh root2 + "د" ;
<Pos,PFut2 FtImperf,PPers3,Pl> => mekhah + "ند" ++ addBh root2 + "ند" ;
-}
<Pos,PFut2 FtAorist,PPers1,Sg> => khah + "م" ++ root1 ;
<Pos,PFut2 FtAorist,PPers1,Pl> => khah + "یم" ++ root1 ;
<Pos,PFut2 Ftorist,PPers2,Sg> => khah + "ی" ++ root1 ;
<Pos,PFut2 FtAorist,PPers2,Pl> => khah + "ید" ++ root1 ;
<Pos,PFut2 FtAorist,PPers3,Sg> => khah + "د" ++ root1 ;
<Pos,PFut2 FtAorist,PPers3,Pl> => khah + "ند" ++ root1 ;
<Pos,Infr_Past2 InfrPerf,PPers1,Sg> => khordh ++ bvdh ++ "ام" ;
<Pos,Infr_Past2 InfrPerf,PPers1,Pl> => khordh ++ bvdh ++ "ایم" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Sg> => khordh ++ bvdh ++ "ای" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Pl> => khordh ++ bvdh ++ "اید" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Sg> => khordh ++ bvdh ++ "است" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Pl> => khordh ++ bvdh ++ "اند" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Sg> => mekhordh ++ "ام" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Pl> => mekhordh ++ "ایم" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Sg> => mekhordh ++ "ای" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Pl> => mekhordh ++ "اید" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Sg> => mekhordh ++ "است" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Pl> => mekhordh ++ "اند" ;
-- negatives
<Neg,PPresent2 PrPerf,PPers1,Sg> => addN khordh ++ "ام" ;
<Neg,PPresent2 PrPerf,PPers1,Pl> => addN khordh ++ "ایم" ;
<Neg,PPresent2 PrPerf,PPers2,Sg> => addN khordh ++ "ای" ;
<Neg,PPresent2 PrPerf,PPers2,Pl> => addN khordh ++ "اید" ;
<Neg,PPresent2 PrPerf,PPers3,Sg> => addN khordh ++ "است" ;
<Neg,PPresent2 PrPerf,PPers3,Pl> => addN khordh ++ "اند" ;
<Neg,PPresent2 PrImperf,PPers1,Sg> => nmekhor + "م" ;
<Neg,PPresent2 PrImperf,PPers1,Pl> => nmekhor + "یم" ;
<Neg,PPresent2 PrImperf,PPers2,Sg> => nmekhor + "ی" ;
<Neg,PPresent2 PrImperf,PPers2,Pl> => nmekhor + "ید" ;
<Neg,PPresent2 PrImperf,PPers3,Sg> => nmekhor + "د" ;
<Neg,PPresent2 PrImperf,PPers3,Pl> => nmekhor + "ند" ;
<Neg,PPast2 PstPerf,PPers1,Sg> => nkhordh ++ "بودم" ;
<Neg,PPast2 PstPerf,PPers1,Pl> => nkhordh ++ "بودیم" ;
<Neg,PPast2 PstPerf,PPers2,Sg> => nkhordh ++ "بودی" ;
<Neg,PPast2 PstPerf,PPers2,Pl> => nkhordh ++ "بودید" ;
<Neg,PPast2 PstPerf,PPers3,Sg> => nkhordh ++ "بود" ;
<Neg,PPast2 PstPerf,PPers3,Pl> => nkhordh ++ "بودند" ;
<Neg,PPast2 PstImperf,PPers1,Sg> => nmekhord + "م" ;
<Neg,PPast2 PstImperf,PPers1,Pl> => nmekhord + "یم" ;
<Neg,PPast2 PstImperf,PPers2,Sg> => nmekhord + "ی";
<Neg,PPast2 PstImperf,PPers2,Pl> => nmekhord + "ید" ;
<Neg,PPast2 PstImperf,PPers3,Sg> => nmekhord ;
<Neg,PPast2 PstImperf,PPers3,Pl> => nmekhord + "ند" ;
<Neg,PPast2 PstAorist,PPers1,Sg> => addN root1 + "م" ;
<Neg,PPast2 PstAorist,PPers1,Pl> => addN root1 + "یم" ;
<Neg,PPast2 PstAorist,PPers2,Sg> => addN root1 + "ی";
<Neg,PPast2 PstAorist,PPers2,Pl> => addN root1 + "ید" ;
<Neg,PPast2 PstAorist,PPers3,Sg> => addN root1 ;
<Neg,PPast2 PstAorist,PPers3,Pl> => addN root1 + "ند" ;
{-
<Neg,PFut2 FtImperf,PPers1,Sg> => nmekhah + "م" ++ addBh root2 + "م" ;
<Neg,PFut2 FtImperf,PPers1,Pl> => nmekhah + "یم" ++ addBh root2 + "یم" ;
<Neg,PFut2 FtImperf,PPers2,Sg> => nmekhah + "ی" ++ addBh root2 + "ی" ;
<Neg,PFut2 FtImperf,PPers2,Pl> => nmekhah + "ید" ++ addBh root2 + "ید" ;
<Neg,PFut2 FtImperf,PPers3,Sg> => nmekhah + "د" ++ addBh root2 + "د" ;
<Neg,PFut2 FtImperf,PPers3,Pl> => nmekhah + "ند" ++ addBh root2 + "ند" ;
-}
<Neg,PFut2 FtAorist,PPers1,Sg> => nkhah + "م" ++ root1 ;
<Neg,PFut2 FtAorist,PPers1,Pl> => nkhah + "یم" ++ root1 ;
<Neg,PFut2 Ftorist,PPers2,Sg> => nkhah + "ی" ++ root1 ;
<Neg,PFut2 FtAorist,PPers2,Pl> => nkhah + "ید" ++ root1 ;
<Neg,PFut2 FtAorist,PPers3,Sg> => nkhah + "د" ++ root1 ;
<Neg,PFut2 FtAorist,PPers3,Pl> => nkhah + "ند" ++ root1 ;
<Neg,Infr_Past2 InfrPerf,PPers1,Sg> => nkhordh ++ bvdh ++ "ام" ;
<Neg,Infr_Past2 InfrPerf,PPers1,Pl> => nkhordh ++ bvdh ++ "ایم" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Sg> => nkhordh ++ bvdh ++ "ای" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Pl> => nkhordh ++ bvdh ++ "اید" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Sg> => nkhordh ++ bvdh ++ "است" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Pl> => nkhordh ++ bvdh ++ "اند" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Sg> => nmekhordh ++ "ام" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Pl> => nmekhordh ++ "ایم" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Sg> => nmekhordh ++ "ای" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Pl> => nmekhordh ++ "اید" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Sg> => nmekhordh ++ "است" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Pl> => nmekhordh ++ "اند"
}
} ;
mkvVform : Str -> Number -> PPerson -> {s: Str} = \root2,n,p ->
{s =
case <n,p> of {
<Sg,PPers1> => addBh root2 + "م" ;
<Sg,PPers2> => addBh root2 + "ی" ;
<Sg,PPers3> => addBh root2 + "د" ;
<Pl,PPers1> => addBh root2 + "یم" ;
<Pl,PPers2> => addBh root2 + "ید" ;
<Pl,PPers3> => 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
};
}

140
lib/src/persian/NounPes.gf Normal file
View File

@@ -0,0 +1,140 @@
concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
flags optimize=all_subs ;
lin
DetCN det cn = {
s = \\_ => case <det.isNum,det.fromPron> of {
<False,True> => cn.s ! aEzafa ! det.n ++ det.s ; -- det.n ;
<False,False> => det.s ++ cn.s ! bEzafa ! det.n ; -- det.n ;
<True,True> => cn.s ! aEzafa ! Sg ++ det.s ;
<True,False> => 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
}

View File

@@ -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 + "هزار"+ "مین" )}
}};
}

View File

@@ -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 ;
-}
}

View File

@@ -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} ;
}

View File

@@ -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 } ;
}

9
lib/src/persian/README Normal file
View File

@@ -0,0 +1,9 @@
Some of the sources are transliterated, in
./src
Before compilation, do
gf -s <translit.gfs
to get unicode.

View File

@@ -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 => "که" ++ 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
} ;
}

863
lib/src/persian/ResPes.gf Normal file
View File

@@ -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 <b,vt> of {
<Pos,VPres> => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
<Neg,VPres> => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
<Pos,VPerfPres> => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ;
<Neg,VPerfPres> => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ;
<Pos,VPast> => vp.s ! VPTense Pos (VPPast Simul) (AgPes n p) ;
<Neg,VPast> => vp.s ! VPTense Neg (VPPast Simul) (AgPes n p) ;
<Pos,VPerfPast> => vp.s ! VPTense Pos (VPPast Anter) (AgPes n p) ;
<Pos,VFut> => case vp.wish of
{True => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Pos (VPFutr Simul) (AgPes n p) };
<Pos,VPerfFut> => 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
<Pos,VCondSimul> => vp.s ! VPTense Pos (VPCond Simul) (AgPes n p) ;
<Pos,VCondAnter> => vp.s ! VPTense Pos (VPCond Anter) (AgPes n p); -- verb form to be confirmed
<Neg,VPerfPast> => vp.s ! VPTense Neg (VPPast Anter) (AgPes n p) ;
<Neg,VFut> => case vp.wish of
{True => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Neg (VPFutr Simul) (AgPes n p) };
<Neg,VPerfFut> => 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
<Neg,VCondSimul> => vp.s ! VPTense Neg (VPCond Simul) (AgPes n p) ;
<Neg,VCondAnter> => 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 <b,vt> of {
<Pos,VPres> => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
<Neg,VPres> => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
<Pos,VPerfPres> => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ;
<Neg,VPerfPres> => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ;
<Pos,VPast> => vp.s ! VPTense Pos (VPPast Simul) (AgPes n p) ;
<Neg,VPast> => vp.s ! VPTense Neg (VPPast Simul) (AgPes n p) ;
<Pos,VPerfPast> => vp.s ! VPTense Pos (VPPast Anter) (AgPes n p) ;
<Pos,VFut> => case vp.wish of
{True => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Pos (VPFutr Simul) (AgPes n p) };
<Pos,VPerfFut> => 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
<Pos,VCondSimul> => vp.s ! VPTense Pos (VPCond Simul) (AgPes n p) ;
<Pos,VCondAnter> => vp.s ! VPTense Pos (VPCond Anter) (AgPes n p); -- verb form to be confirmed
<Neg,VPerfPast> => vp.s ! VPTense Neg (VPPast Anter) (AgPes n p) ;
<Neg,VFut> => case vp.wish of
{True => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Neg (VPFutr Simul) (AgPes n p) };
<Neg,VPerfFut> => 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
<Neg,VCondSimul> => vp.s ! VPTense Neg (VPCond Simul) (AgPes n p) ;
<Neg,VCondAnter> => 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 <pol,t,p,n> of {
<Pos,AuxPresent PrPerf,PPers1,Sg> => bodh ++ "ام" ;
<Pos,AuxPresent PrPerf,PPers1,Pl> => bodh ++ "ایم" ;
<Pos,AuxPresent PrPerf,PPers2,Sg> => bodh ++ "ای" ;
<Pos,AuxPresent PrPerf,PPers2,Pl> => bodh ++ "اید" ;
<Pos,AuxPresent PrPerf,PPers3,Sg> => bodh ++ "است" ;
<Pos,AuxPresent PrPerf,PPers3,Pl> => bodh ++ "اند" ;
<Pos,AuxPresent PrImperf,PPers1,Sg> => hast + "م" ;
<Pos,AuxPresent PrImperf,PPers1,Pl> => hast + "یم" ;
<Pos,AuxPresent PrImperf,PPers2,Sg> => hast + "ی" ;
<Pos,AuxPresent PrImperf,PPers2,Pl> => hast + "ید" ;
<Pos,AuxPresent PrImperf,PPers3,Sg> => "است" ;
<Pos,AuxPresent PrImperf,PPers3,Pl> => hast + "ند" ;
<Pos,AuxPast PstPerf,PPers1,Sg> => "";
<Pos,AuxPast PstPerf,PPers1,Pl> => "" ;
<Pos,AuxPast PstPerf,PPers2,Sg> => "" ;
<Pos,AuxPast PstPerf,PPers2,Pl> => "" ;
<Pos,AuxPast PstPerf,PPers3,Sg> => "" ;
<Pos,AuxPast PstPerf,PPers3,Pl> => "" ;
<Pos,AuxPast PstImperf,PPers1,Sg> => "می" ++ bod + "م" ;
<Pos,AuxPast PstImperf,PPers1,Pl> => "می" ++ bod + "یم" ;
<Pos,AuxPast PstImperf,PPers2,Sg> => "می" ++ bod + "ی";
<Pos,AuxPast PstImperf,PPers2,Pl> => "می" ++ bod + "ید" ;
<Pos,AuxPast PstImperf,PPers3,Sg> => "می" ++ bod ;
<Pos,AuxPast PstImperf,PPers3,Pl> => "می" ++ bod + "ند" ;
<Pos,AuxPast PstAorist,PPers1,Sg> => bod + "م" ;
<Pos,AuxPast PstAorist,PPers1,Pl> => bod + "یم" ;
<Pos,AuxPast PstAorist,PPers2,Sg> => bod + "ی";
<Pos,AuxPast PstAorist,PPers2,Pl> => bod + "ید" ;
<Pos,AuxPast PstAorist,PPers3,Sg> => bod ;
<Pos,AuxPast PstAorist,PPers3,Pl> => bod + "ند" ;
{-
<Pos,AuxFut FtImperf,PPers1,Sg> => mekhah + "م" ++ bash + "م" ;
<Pos,AuxFut FtImperf,PPers1,Pl> => mekhah + "یم" ++ bash + "یم" ;
<Pos,AuxFut FtImperf,PPers2,Sg> => mekhah + "ی" ++ bash + "ی" ;
<Pos,AuxFut FtImperf,PPers2,Pl> => mekhah + "ید" ++ bash + "ید" ;
<Pos,AuxFut FtImperf,PPers3,Sg> => mekhah + "د" ++ bash + "د" ;
<Pos,AuxFut FtImperf,PPers3,Pl> => mekhah + "ند" ++ bash + "ند" ;
-}
<Pos,AuxFut FtAorist,PPers1,Sg> => khah + "م" ++ bod ;
<Pos,AuxFut FtAorist,PPers1,Pl> => khah + "یم" ++ bod ;
<Pos,AuxFut Ftorist,PPers2,Sg> => khah + "ی" ++ bod ;
<Pos,AuxFut FtAorist,PPers2,Pl> => khah + "ید" ++ bod ;
<Pos,AuxFut FtAorist,PPers3,Sg> => khah + "د" ++ bod ;
<Pos,AuxFut FtAorist,PPers3,Pl> => khah + "ند" ++ bod ;
-- nagatives
<Neg,AuxPresent PrPerf,PPers1,Sg> => nbodh ++ "ام" ;
<Neg,AuxPresent PrPerf,PPers1,Pl> => nbodh ++ "ایم" ;
<Neg,AuxPresent PrPerf,PPers2,Sg> => nbodh ++ "ای" ;
<Neg,AuxPresent PrPerf,PPers2,Pl> => nbodh ++ "اید" ;
<Neg,AuxPresent PrPerf,PPers3,Sg> => nbodh ++ "است" ;
<Neg,AuxPresent PrPerf,PPers3,Pl> => nbodh ++ "اند" ;
<Neg,AuxPresent PrImperf,PPers1,Sg> => nhast + "م" ;
<Neg,AuxPresent PrImperf,PPers1,Pl> => nhast + "یم" ;
<Neg,AuxPresent PrImperf,PPers2,Sg> => nhast + "ی" ;
<Neg,AuxPresent PrImperf,PPers2,Pl> => nhast + "ید" ;
<Neg,AuxPresent PrImperf,PPers3,Sg> => "نیست" ;
<Neg,AuxPresent PrImperf,PPers3,Pl> => nhast + "ند" ;
<Neg,AuxPast PstPerf,PPers1,Sg> => "";
<Neg,AuxPast PstPerf,PPers1,Pl> => "" ;
<Neg,AuxPast PstPerf,PPers2,Sg> => "" ;
<Neg,AuxPast PstPerf,PPers2,Pl> => "" ;
<Neg,AuxPast PstPerf,PPers3,Sg> => "" ;
<Neg,AuxPast PstPerf,PPers3,Pl> => "" ;
<Neg,AuxPast PstImperf,PPers1,Sg> => "نمی" ++ bod + "م" ;
<Neg,AuxPast PstImperf,PPers1,Pl> => "نمی" ++ bod + "یم" ;
<Neg,AuxPast PstImperf,PPers2,Sg> => "نمی" ++ bod + "ی";
<Neg,AuxPast PstImperf,PPers2,Pl> => "نمی" ++ bod + "ید" ;
<Neg,AuxPast PstImperf,PPers3,Sg> => "نمی" ++ bod ;
<Neg,AuxPast PstImperf,PPers3,Pl> => "نمی" ++ bod + "ند" ;
<Neg,AuxPast PstAorist,PPers1,Sg> => nbod + "م" ;
<Neg,AuxPast PstAorist,PPers1,Pl> => nbod + "یم" ;
<Neg,AuxPast PstAorist,PPers2,Sg> => nbod + "ی";
<Neg,AuxPast PstAorist,PPers2,Pl> => nbod + "ید" ;
<Neg,AuxPast PstAorist,PPers3,Sg> => nbod ;
<Neg,AuxPast PstAorist,PPers3,Pl> => nbod + "ند" ;
{-
<Neg,AuxFut FtImperf,PPers1,Sg> => nmekhah + "م" ++ bash + "م" ;
<Neg,AuxFut FtImperf,PPers1,Pl> => nmekhah + "یم" ++ bash + "یم" ;
<Neg,AuxFut FtImperf,PPers2,Sg> => nmekhah + "ی" ++ bash + "ی" ;
<Neg,AuxFut FtImperf,PPers2,Pl> => nmekhah + "ید" ++ bash + "ید" ;
<Neg,AuxFut FtImperf,PPers3,Sg> => nmekhah + "د" ++ bash + "د" ;
<Neg,AuxFut FtImperf,PPers3,Pl> => nmekhah + "ند" ++ bash + "ند" ;
-}
<Neg,AuxFut FtAorist,PPers1,Sg> => nkhah + "م" ++ bod ;
<Neg,AuxFut FtAorist,PPers1,Pl> => nkhah + "یم" ++ bod ;
<Neg,AuxFut Ftorist,PPers2,Sg> => nkhah + "ی" ++ bod ;
<Neg,AuxFut FtAorist,PPers2,Pl> => nkhah + "ید" ++ bod ;
<Neg,AuxFut FtAorist,PPers3,Sg> => nkhah + "د" ++ bod ;
<Neg,AuxFut FtAorist,PPers3,Pl> => nkhah + "ند" ++ bod
{-
<Infr_Past2 InfrPerf,PPers1,Sg> => khordh ++ bvdh ++ "ام" ;
<Infr_Past2 InfrPerf,PPers1,Pl> => khordh ++ bvdh ++ "ایم" ;
<Infr_Past2 InfrPerf,PPers2,Sg> => khordh ++ bvdh ++ "ای" ;
<Infr_Past2 InfrPerf,PPers2,Pl> => khordh ++ bvdh ++ "اید" ;
<Infr_Past2 InfrPerf,PPers3,Sg> => khordh ++ bvdh ++ "است" ;
<Infr_Past2 InfrPerf,PPers3,Pl> => khordh ++ bvdh ++ "اند" ;
<Infr_Past2 InfrImperf,PPers1,Sg> => mekhordh ++ "ام" ;
<Infr_Past2 InfrImperf,PPers1,Pl> => mekhordh ++ "ایم" ;
<Infr_Past2 InfrImperf,PPers2,Sg> => mekhordh ++ "ای" ;
<Infr_Past2 InfrImperf,PPers2,Pl> => mekhordh ++ "اید" ;
<Infr_Past2 InfrImperf,PPers3,Sg> => mekhordh ++ "است" ;
<Infr_Past2 InfrImperf,PPers3,Pl> => 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 <pol,t,p,n> of {
<Pos,PPresent2 PrPerf,PPers1,Sg> => dashteh ++ "ام" ;
<Pos,PPresent2 PrPerf,PPers1,Pl> => dashteh ++ "ایم" ;
<Pos,PPresent2 PrPerf,PPers2,Sg> => dashteh ++ "ای" ;
<Pos,PPresent2 PrPerf,PPers2,Pl> => dashteh ++ "اید" ;
<Pos,PPresent2 PrPerf,PPers3,Sg> => dashteh ++ "است" ;
<Pos,PPresent2 PrPerf,PPers3,Pl> => dashteh ++ "اند" ;
<Pos,PPresent2 PrImperf,PPers1,Sg> => dar + "م" ;
<Pos,PPresent2 PrImperf,PPers1,Pl> => dar + "یم" ;
<Pos,PPresent2 PrImperf,PPers2,Sg> => dar + "ی" ;
<Pos,PPresent2 PrImperf,PPers2,Pl> => dar + "ید" ;
<Pos,PPresent2 PrImperf,PPers3,Sg> => dar + "د" ;
<Pos,PPresent2 PrImperf,PPers3,Pl> => dar + "ند" ;
<Pos,PPast2 PstPerf,PPers1,Sg> => dashteh ++ "بودم" ;
<Pos,PPast2 PstPerf,PPers1,Pl> => dashteh ++ "بودیم" ;
<Pos,PPast2 PstPerf,PPers2,Sg> => dashteh ++ "بودی" ;
<Pos,PPast2 PstPerf,PPers2,Pl> => dashteh ++ "بودید" ;
<Pos,PPast2 PstPerf,PPers3,Sg> => dashteh ++ "بود" ;
<Pos,PPast2 PstPerf,PPers3,Pl> => dashteh ++ "بودند" ;
<Pos,PPast2 PstImperf,PPers1,Sg> => dasht + "م" ;
<Pos,PPast2 PstImperf,PPers1,Pl> => dasht + "یم" ;
<Pos,PPast2 PstImperf,PPers2,Sg> => dasht + "ی";
<Pos,PPast2 PstImperf,PPers2,Pl> => dasht + "ید" ;
<Pos,PPast2 PstImperf,PPers3,Sg> => dasht ;
<Pos,PPast2 PstImperf,PPers3,Pl> => dasht + "ند" ;
<Pos,PPast2 PstAorist,PPers1,Sg> => dasht + "م" ;
<Pos,PPast2 PstAorist,PPers1,Pl> => dasht + "یم" ;
<Pos,PPast2 PstAorist,PPers2,Sg> => dasht + "ی";
<Pos,PPast2 PstAorist,PPers2,Pl> => dasht + "ید" ;
<Pos,PPast2 PstAorist,PPers3,Sg> => dasht ;
<Pos,PPast2 PstAorist,PPers3,Pl> => dasht + "ند" ;
<Pos,PFut2 FtAorist,PPers1,Sg> => khah + "م" ++ dasht ;
<Pos,PFut2 FtAorist,PPers1,Pl> => khah + "یم" ++ dasht ;
<Pos,PFut2 Ftorist,PPers2,Sg> => khah + "ی" ++ dasht ;
<Pos,PFut2 FtAorist,PPers2,Pl> => khah + "ید" ++ dasht ;
<Pos,PFut2 FtAorist,PPers3,Sg> => khah + "د" ++ dasht ;
<Pos,PFut2 FtAorist,PPers3,Pl> => khah + "ند" ++ dasht ;
<Pos,Infr_Past2 InfrPerf,PPers1,Sg> => dashteh ++ bvdh ++ "ام" ;
<Pos,Infr_Past2 InfrPerf,PPers1,Pl> => dashteh ++ bvdh ++ "ایم" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Sg> => dashteh ++ bvdh ++ "ای" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Pl> => dashteh ++ bvdh ++ "اید" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Sg> => dashteh ++ bvdh ++ "است" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Pl> => dashteh ++ bvdh ++ "اند" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Sg> => dashteh ++ "ام" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Pl> => dashteh ++ "ایم" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Sg> => dashteh ++ "ای" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Pl> => dashteh ++ "اید" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Sg> => dashteh ++ "است" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Pl> => dashteh ++ "اند" ;
-- negatives
<Neg,PPresent2 PrPerf,PPers1,Sg> => ndashteh ++ "ام" ;
<Neg,PPresent2 PrPerf,PPers1,Pl> => ndashteh ++ "ایم" ;
<Neg,PPresent2 PrPerf,PPers2,Sg> => ndashteh ++ "ای" ;
<Neg,PPresent2 PrPerf,PPers2,Pl> => ndashteh ++ "اید" ;
<Neg,PPresent2 PrPerf,PPers3,Sg> => ndashteh ++ "است" ;
<Neg,PPresent2 PrPerf,PPers3,Pl> => ndashteh ++ "اند" ;
<Neg,PPresent2 PrImperf,PPers1,Sg> => ndar + "م" ;
<Neg,PPresent2 PrImperf,PPers1,Pl> => ndar + "یم" ;
<Neg,PPresent2 PrImperf,PPers2,Sg> => ndar + "ی" ;
<Neg,PPresent2 PrImperf,PPers2,Pl> => ndar + "ید" ;
<Neg,PPresent2 PrImperf,PPers3,Sg> => ndar + "د" ;
<Neg,PPresent2 PrImperf,PPers3,Pl> => ndar + "ند" ;
<Neg,PPast2 PstPerf,PPers1,Sg> => ndashteh ++ "بودم" ;
<Neg,PPast2 PstPerf,PPers1,Pl> => ndashteh ++ "بودیم" ;
<Neg,PPast2 PstPerf,PPers2,Sg> => ndashteh ++ "بودی" ;
<Neg,PPast2 PstPerf,PPers2,Pl> => ndashteh ++ "بودید" ;
<Neg,PPast2 PstPerf,PPers3,Sg> => ndashteh ++ "بود" ;
<Neg,PPast2 PstPerf,PPers3,Pl> => ndashteh ++ "بودند" ;
<Neg,PPast2 PstImperf,PPers1,Sg> => ndasht + "م" ;
<Neg,PPast2 PstImperf,PPers1,Pl> => ndasht + "یم" ;
<Neg,PPast2 PstImperf,PPers2,Sg> => ndasht + "ی";
<Neg,PPast2 PstImperf,PPers2,Pl> => ndasht + "ید" ;
<Neg,PPast2 PstImperf,PPers3,Sg> => ndasht ;
<Neg,PPast2 PstImperf,PPers3,Pl> => ndasht + "ند" ;
<Neg,PPast2 PstAorist,PPers1,Sg> => ndasht + "م" ;
<Neg,PPast2 PstAorist,PPers1,Pl> => ndasht + "یم" ;
<Neg,PPast2 PstAorist,PPers2,Sg> => ndasht + "ی";
<Neg,PPast2 PstAorist,PPers2,Pl> => ndasht + "ید" ;
<Neg,PPast2 PstAorist,PPers3,Sg> => ndasht ;
<Neg,PPast2 PstAorist,PPers3,Pl> => ndasht + "ند" ;
<Neg,PFut2 FtAorist,PPers1,Sg> => nkhah + "م" ++ dasht ;
<Neg,PFut2 FtAorist,PPers1,Pl> => nkhah + "یم" ++ dasht ;
<Neg,PFut2 Ftorist,PPers2,Sg> => nkhah + "ی" ++ dasht ;
<Neg,PFut2 FtAorist,PPers2,Pl> => nkhah + "ید" ++ dasht ;
<Neg,PFut2 FtAorist,PPers3,Sg> => nkhah + "د" ++ dasht ;
<Neg,PFut2 FtAorist,PPers3,Pl> => nkhah + "ند" ++ dasht ;
<Neg,Infr_Past2 InfrPerf,PPers1,Sg> => ndashteh ++ bvdh ++ "ام" ;
<Neg,Infr_Past2 InfrPerf,PPers1,Pl> => ndashteh ++ bvdh ++ "ایم" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Sg> => ndashteh ++ bvdh ++ "ای" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Pl> => ndashteh ++ bvdh ++ "اید" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Sg> => ndashteh ++ bvdh ++ "است" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Pl> => ndashteh ++ bvdh ++ "اند" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Sg> => ndashteh ++ "ام" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Pl> => ndashteh ++ "ایم" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Sg> => ndashteh ++ "ای" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Pl> => ndashteh ++ "اید" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Sg> => ndashteh ++ "است" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Pl> => 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 <ani,number> of {
<Animate,Sg> => "او" ;
<Animate,Pl> => ["آن ها"] ;
<Inanimate,Sg> => "آن" ;
<Inanimate,Pl> => ["آن ها"]
};
}

View File

@@ -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 <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! ODir;
<Pres,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! ODir;
<Past,Simul> => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! ODir;
<Past,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! ODir;
<Fut,Simul> => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! ODir;
<Fut,Anter> => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! ODir;
<Cond,Simul> => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! ODir;
<Cond,Anter> => 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 <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! q;
<Pres,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! q;
<Past,Simul> => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! q;
<Past,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! q;
<Fut,Simul> => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! q;
<Fut,Anter> => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! q;
<Cond,Simul> => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! q;
<Cond,Anter> => temp.s ++ p.s ++ cl.s ! VCondAnter ! p.p ! q
};
} ;
UseRCl temp p rcl = {
s = \\q => case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ rcl.s ! VPres ! p.p ! ODir ! q;
<Pres,Anter> => temp.s ++ p.s ++ rcl.s ! VPerfPres ! p.p ! ODir ! q;
<Past,Simul> => temp.s ++ p.s ++ rcl.s ! VPast ! p.p ! ODir ! q;
<Past,Anter> => temp.s ++ p.s ++ rcl.s ! VPerfPast ! p.p ! ODir ! q;
<Fut,Simul> => temp.s ++ p.s ++ rcl.s ! VFut ! p.p ! ODir ! q;
<Fut,Anter> => temp.s ++ p.s ++ rcl.s ! VPerfFut ! p.p ! ODir ! q;
<Cond,Simul> => temp.s ++ p.s ++ rcl.s ! VCondSimul ! p.p ! ODir ! q;
<Cond,Anter> => temp.s ++ p.s ++ rcl.s ! VCondAnter ! p.p ! ODir ! q
};
c = rcl.c
} ;
UseSlash temp p clslash = {
s = case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ clslash.s ! VPres ! p.p ! ODir;
<Pres,Anter> => temp.s ++ p.s ++ clslash.s ! VPerfPres ! p.p ! ODir;
<Past,Simul> => temp.s ++ p.s ++ clslash.s ! VPast ! p.p ! ODir ;
<Past,Anter> => temp.s ++ p.s ++ clslash.s ! VPerfPast ! p.p ! ODir;
<Fut,Simul> => temp.s ++ p.s ++ clslash.s ! VFut ! p.p ! ODir;
<Fut,Anter> => temp.s ++ p.s ++ clslash.s ! VPerfFut ! p.p ! ODir;
<Cond,Simul> => temp.s ++ p.s ++ clslash.s ! VCondSimul ! p.p ! ODir;
<Cond,Anter> => 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};
}

View File

@@ -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رسن" ;
}

View File

@@ -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" } ;
-}
}

View File

@@ -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} ;
}

View File

@@ -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 } ;
}

View File

@@ -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};
}

View File

@@ -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"} ;
}

View File

@@ -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};
}

View File

@@ -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"];
}

View File

@@ -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 <t,a,p,n> of {
<PPresent,PPerf,PPers1,Sg> => khordh ++ "Am" ;
<PPresent,PPerf,PPers1,Pl> => khordh ++ "Aym" ;
<PPresent,PPerf,PPers2,Sg> => khordh ++ "Ay" ;
<PPresent,PPerf,PPers2,Pl> => khordh ++ "Ayd" ;
<PPresent,PPerf,PPers3,Sg> => khordh ++ "Ast" ;
<PPresent,PPerf,PPers3,Pl> => khordh ++ "And" ;
<PPresent,PImperf,PPers1,Sg> => mekhor + "m" ; -- toHave need to have khor instead of mekhor
<PPresent,PImperf,PPers1,Pl> => mekhor + "ym" ;
<PPresent,PImperf,PPers2,Sg> => mekhor + "y" ;
<PPresent,PImperf,PPers2,Pl> => mekhor + "yd" ;
<PPresent,PImperf,PPers3,Sg> => mekhor + "d" ;
<PPresent,PImperf,PPers3,Pl> => mekhor + "nd" ;
<PPresent,Aorist,PPers1,Sg> => "" ;
<PPresent,Aorist,PPers1,Pl> => "" ;
<PPresent,Aorist,PPers2,Sg> => "" ;
<PPresent,Aorist,PPers2,Pl> => "" ;
<PPresent,Aorist,PPers3,Sg> => "" ;
<PPresent,Aorist,PPers3,Pl> => "" ;
<PPast,PPerf,PPers1,Sg> => khordh ++ "bvdm" ;
<PPast,PPerf,PPers1,Pl> => khordh ++ "bvdym" ;
<PPast,PPerf,PPers2,Sg> => khordh ++ "bvdy" ;
<PPast,PPerf,PPers2,Pl> => khordh ++ "bvdyd" ;
<PPast,PPerf,PPers3,Sg> => khordh ++ "bvd" ;
<PPast,PPerf,PPers3,Pl> => khordh ++ "bvdnd" ;
<PPast,PImperf,PPers1,Sg> => mekhord + "m" ; -- toHave need to have khor instead of mekhor
<PPast,PImperf,PPers1,Pl> => mekhord + "ym" ;
<PPast,PImperf,PPers2,Sg> => mekhord + "y";
<PPast,PImperf,PPers2,Pl> => mekhord + "yd" ;
<PPast,PImperf,PPers3,Sg> => mekhord ;
<PPast,PImperf,PPers3,Pl> => mekhord + "nd" ;
<PPast,Aorist,PPers1,Sg> => root1 + "m" ;
<PPast,Aorist,PPers1,Pl> => root1 + "ym" ;
<PPast,Aorist,PPers2,Sg> => root1 + "y";
<PPast,Aorist,PPers2,Pl> => root1 + "yd" ;
<PPast,Aorist,PPers3,Sg> => root1 ;
<PPast,Aorist,PPers3,Pl> => root1 + "nd" ;
-- check this one
<PFut,PPerf,PPers1,Sg> => "" ;
<PFut,PPerf,PPers1,Pl> => "" ;
<PFut,PPerf,PPers2,Sg> => "" ;
<PFut,PPerf,PPers2,Pl> => "" ;
<PFut,PPerf,PPers3,Sg> => "" ;
<PFut,PPerf,PPers3,Pl> => "" ;
<PFut,PImperf,PPers1,Sg> => mekhah + "m" ++ addBh root2 + "m" ;
<PFut,PImperf,PPers1,Pl> => mekhah + "ym" ++ addBh root2 + "ym" ;
<PFut,PImperf,PPers2,Sg> => mekhah + "y" ++ addBh root2 + "y" ;
<PFut,PImperf,PPers2,Pl> => mekhah + "yd" ++ addBh root2 + "yd" ;
<PFut,PImperf,PPers3,Sg> => mekhah + "d" ++ addBh root2 + "d" ;
<PFut,PImperf,PPers3,Pl> => mekhah + "nd" ++ addBh root2 + "nd" ;
<PFut,Aorist,PPers1,Sg> => khah + "m" ++ root1 ;
<PFut,Aorist,PPers1,Pl> => khah + "ym" ++ root1 ;
<PFut,Aorist,PPers2,Sg> => khah + "y" ++ root1 ;
<PFut,Aorist,PPers2,Pl> => khah + "yd" ++ root1 ;
<PFut,Aorist,PPers3,Sg> => khah + "d" ++ root1 ;
<PFut,Aorist,PPers3,Pl> => khah + "nd" ++ root1 ;
<Infr_Past,PPerf,PPers1,Sg> => khordh ++ bvdh ++ "Am" ;
<Infr_Past,PPerf,PPers1,Pl> => khordh ++ bvdh ++ "Aym" ;
<Infr_Past,PPerf,PPers2,Sg> => khordh ++ bvdh ++ "Ay" ;
<Infr_Past,PPerf,PPers2,Pl> => khordh ++ bvdh ++ "Ayd" ;
<Infr_Past,PPerf,PPers3,Sg> => khordh ++ bvdh ++ "Ast" ;
<Infr_Past,PPerf,PPers3,Pl> => khordh ++ bvdh ++ "And" ;
<Infr_Past,PImperf,PPers1,Sg> => mekhordh ++ "Am" ; -- toHave need to have khordh instead of mekhor
<Infr_Past,PImperf,PPers1,Pl> => mekhordh ++ "Aym" ;
<Infr_Past,PImperf,PPers2,Sg> => mekhordh ++ "Ay" ;
<Infr_Past,PImperf,PPers2,Pl> => mekhordh ++ "Ayd" ;
<Infr_Past,PImperf,PPers3,Sg> => mekhordh ++ "Ast" ;
<Infr_Past,PImperf,PPers3,Pl> => mekhordh ++ "And" ;
-- check this one
<Infr_Past,Aorist,PPers1,Sg> => "" ;
<Infr_Past,Aorist,PPers1,Pl> => "" ;
<Infr_Past,Aorist,PPers2,Sg> => "" ;
<Infr_Past,Aorist,PPers2,Pl> => "" ;
<Infr_Past,Aorist,PPers3,Sg> => "" ;
<Infr_Past,Aorist,PPers3,Pl> => ""
}
} ;
-}
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 <pol,t,p,n> of {
<Pos,PPresent2 PrPerf,PPers1,Sg> => khordh ++ "Am" ;
<Pos,PPresent2 PrPerf,PPers1,Pl> => khordh ++ "Aym" ;
<Pos,PPresent2 PrPerf,PPers2,Sg> => khordh ++ "Ay" ;
<Pos,PPresent2 PrPerf,PPers2,Pl> => khordh ++ "Ayd" ;
<Pos,PPresent2 PrPerf,PPers3,Sg> => khordh ++ "Ast" ;
<Pos,PPresent2 PrPerf,PPers3,Pl> => khordh ++ "And" ;
<Pos,PPresent2 PrImperf,PPers1,Sg> => mekhor + "m" ;
<Pos,PPresent2 PrImperf,PPers1,Pl> => mekhor + "ym" ;
<Pos,PPresent2 PrImperf,PPers2,Sg> => mekhor + "y" ;
<Pos,PPresent2 PrImperf,PPers2,Pl> => mekhor + "yd" ;
<Pos,PPresent2 PrImperf,PPers3,Sg> => mekhor + "d" ;
<Pos,PPresent2 PrImperf,PPers3,Pl> => mekhor + "nd" ;
<Pos,PPast2 PstPerf,PPers1,Sg> => khordh ++ "bvdm" ;
<Pos,PPast2 PstPerf,PPers1,Pl> => khordh ++ "bvdym" ;
<Pos,PPast2 PstPerf,PPers2,Sg> => khordh ++ "bvdy" ;
<Pos,PPast2 PstPerf,PPers2,Pl> => khordh ++ "bvdyd" ;
<Pos,PPast2 PstPerf,PPers3,Sg> => khordh ++ "bvd" ;
<Pos,PPast2 PstPerf,PPers3,Pl> => khordh ++ "bvdnd" ;
<Pos,PPast2 PstImperf,PPers1,Sg> => mekhord + "m" ;
<Pos,PPast2 PstImperf,PPers1,Pl> => mekhord + "ym" ;
<Pos,PPast2 PstImperf,PPers2,Sg> => mekhord + "y";
<Pos,PPast2 PstImperf,PPers2,Pl> => mekhord + "yd" ;
<Pos,PPast2 PstImperf,PPers3,Sg> => mekhord ;
<Pos,PPast2 PstImperf,PPers3,Pl> => mekhord + "nd" ;
<Pos,PPast2 PstAorist,PPers1,Sg> => root1 + "m" ;
<Pos,PPast2 PstAorist,PPers1,Pl> => root1 + "ym" ;
<Pos,PPast2 PstAorist,PPers2,Sg> => root1 + "y";
<Pos,PPast2 PstAorist,PPers2,Pl> => root1 + "yd" ;
<Pos,PPast2 PstAorist,PPers3,Sg> => root1 ;
<Pos,PPast2 PstAorist,PPers3,Pl> => root1 + "nd" ;
{-
<Pos,PFut2 FtImperf,PPers1,Sg> => mekhah + "m" ++ addBh root2 + "m" ;
<Pos,PFut2 FtImperf,PPers1,Pl> => mekhah + "ym" ++ addBh root2 + "ym" ;
<Pos,PFut2 FtImperf,PPers2,Sg> => mekhah + "y" ++ addBh root2 + "y" ;
<Pos,PFut2 FtImperf,PPers2,Pl> => mekhah + "yd" ++ addBh root2 + "yd" ;
<Pos,PFut2 FtImperf,PPers3,Sg> => mekhah + "d" ++ addBh root2 + "d" ;
<Pos,PFut2 FtImperf,PPers3,Pl> => mekhah + "nd" ++ addBh root2 + "nd" ;
-}
<Pos,PFut2 FtAorist,PPers1,Sg> => khah + "m" ++ root1 ;
<Pos,PFut2 FtAorist,PPers1,Pl> => khah + "ym" ++ root1 ;
<Pos,PFut2 Ftorist,PPers2,Sg> => khah + "y" ++ root1 ;
<Pos,PFut2 FtAorist,PPers2,Pl> => khah + "yd" ++ root1 ;
<Pos,PFut2 FtAorist,PPers3,Sg> => khah + "d" ++ root1 ;
<Pos,PFut2 FtAorist,PPers3,Pl> => khah + "nd" ++ root1 ;
<Pos,Infr_Past2 InfrPerf,PPers1,Sg> => khordh ++ bvdh ++ "Am" ;
<Pos,Infr_Past2 InfrPerf,PPers1,Pl> => khordh ++ bvdh ++ "Aym" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Sg> => khordh ++ bvdh ++ "Ay" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Pl> => khordh ++ bvdh ++ "Ayd" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Sg> => khordh ++ bvdh ++ "Ast" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Pl> => khordh ++ bvdh ++ "And" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Sg> => mekhordh ++ "Am" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Pl> => mekhordh ++ "Aym" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Sg> => mekhordh ++ "Ay" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Pl> => mekhordh ++ "Ayd" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Sg> => mekhordh ++ "Ast" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Pl> => mekhordh ++ "And" ;
-- negatives
<Neg,PPresent2 PrPerf,PPers1,Sg> => addN khordh ++ "Am" ;
<Neg,PPresent2 PrPerf,PPers1,Pl> => addN khordh ++ "Aym" ;
<Neg,PPresent2 PrPerf,PPers2,Sg> => addN khordh ++ "Ay" ;
<Neg,PPresent2 PrPerf,PPers2,Pl> => addN khordh ++ "Ayd" ;
<Neg,PPresent2 PrPerf,PPers3,Sg> => addN khordh ++ "Ast" ;
<Neg,PPresent2 PrPerf,PPers3,Pl> => addN khordh ++ "And" ;
<Neg,PPresent2 PrImperf,PPers1,Sg> => nmekhor + "m" ;
<Neg,PPresent2 PrImperf,PPers1,Pl> => nmekhor + "ym" ;
<Neg,PPresent2 PrImperf,PPers2,Sg> => nmekhor + "y" ;
<Neg,PPresent2 PrImperf,PPers2,Pl> => nmekhor + "yd" ;
<Neg,PPresent2 PrImperf,PPers3,Sg> => nmekhor + "d" ;
<Neg,PPresent2 PrImperf,PPers3,Pl> => nmekhor + "nd" ;
<Neg,PPast2 PstPerf,PPers1,Sg> => nkhordh ++ "bvdm" ;
<Neg,PPast2 PstPerf,PPers1,Pl> => nkhordh ++ "bvdym" ;
<Neg,PPast2 PstPerf,PPers2,Sg> => nkhordh ++ "bvdy" ;
<Neg,PPast2 PstPerf,PPers2,Pl> => nkhordh ++ "bvdyd" ;
<Neg,PPast2 PstPerf,PPers3,Sg> => nkhordh ++ "bvd" ;
<Neg,PPast2 PstPerf,PPers3,Pl> => nkhordh ++ "bvdnd" ;
<Neg,PPast2 PstImperf,PPers1,Sg> => nmekhord + "m" ;
<Neg,PPast2 PstImperf,PPers1,Pl> => nmekhord + "ym" ;
<Neg,PPast2 PstImperf,PPers2,Sg> => nmekhord + "y";
<Neg,PPast2 PstImperf,PPers2,Pl> => nmekhord + "yd" ;
<Neg,PPast2 PstImperf,PPers3,Sg> => nmekhord ;
<Neg,PPast2 PstImperf,PPers3,Pl> => nmekhord + "nd" ;
<Neg,PPast2 PstAorist,PPers1,Sg> => addN root1 + "m" ;
<Neg,PPast2 PstAorist,PPers1,Pl> => addN root1 + "ym" ;
<Neg,PPast2 PstAorist,PPers2,Sg> => addN root1 + "y";
<Neg,PPast2 PstAorist,PPers2,Pl> => addN root1 + "yd" ;
<Neg,PPast2 PstAorist,PPers3,Sg> => addN root1 ;
<Neg,PPast2 PstAorist,PPers3,Pl> => addN root1 + "nd" ;
{-
<Neg,PFut2 FtImperf,PPers1,Sg> => nmekhah + "m" ++ addBh root2 + "m" ;
<Neg,PFut2 FtImperf,PPers1,Pl> => nmekhah + "ym" ++ addBh root2 + "ym" ;
<Neg,PFut2 FtImperf,PPers2,Sg> => nmekhah + "y" ++ addBh root2 + "y" ;
<Neg,PFut2 FtImperf,PPers2,Pl> => nmekhah + "yd" ++ addBh root2 + "yd" ;
<Neg,PFut2 FtImperf,PPers3,Sg> => nmekhah + "d" ++ addBh root2 + "d" ;
<Neg,PFut2 FtImperf,PPers3,Pl> => nmekhah + "nd" ++ addBh root2 + "nd" ;
-}
<Neg,PFut2 FtAorist,PPers1,Sg> => nkhah + "m" ++ root1 ;
<Neg,PFut2 FtAorist,PPers1,Pl> => nkhah + "ym" ++ root1 ;
<Neg,PFut2 Ftorist,PPers2,Sg> => nkhah + "y" ++ root1 ;
<Neg,PFut2 FtAorist,PPers2,Pl> => nkhah + "yd" ++ root1 ;
<Neg,PFut2 FtAorist,PPers3,Sg> => nkhah + "d" ++ root1 ;
<Neg,PFut2 FtAorist,PPers3,Pl> => nkhah + "nd" ++ root1 ;
<Neg,Infr_Past2 InfrPerf,PPers1,Sg> => nkhordh ++ bvdh ++ "Am" ;
<Neg,Infr_Past2 InfrPerf,PPers1,Pl> => nkhordh ++ bvdh ++ "Aym" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Sg> => nkhordh ++ bvdh ++ "Ay" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Pl> => nkhordh ++ bvdh ++ "Ayd" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Sg> => nkhordh ++ bvdh ++ "Ast" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Pl> => nkhordh ++ bvdh ++ "And" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Sg> => nmekhordh ++ "Am" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Pl> => nmekhordh ++ "Aym" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Sg> => nmekhordh ++ "Ay" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Pl> => nmekhordh ++ "Ayd" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Sg> => nmekhordh ++ "Ast" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Pl> => nmekhordh ++ "And"
}
} ;
mkvVform : Str -> Number -> PPerson -> {s: Str} = \root2,n,p ->
{s =
case <n,p> of {
<Sg,PPers1> => addBh root2 + "m" ;
<Sg,PPers2> => addBh root2 + "y" ;
<Sg,PPers3> => addBh root2 + "d" ;
<Pl,PPers1> => addBh root2 + "ym" ;
<Pl,PPers2> => addBh root2 + "yd" ;
<Pl,PPers3> => 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
};
}

View File

@@ -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" )}
}};
}

View File

@@ -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 ;
-}
}

View File

@@ -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
} ;
}

View File

@@ -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 <b,vt> of {
<Pos,VPres> => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
<Neg,VPres> => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
<Pos,VPerfPres> => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ;
<Neg,VPerfPres> => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ;
<Pos,VPast> => vp.s ! VPTense Pos (VPPast Simul) (AgPes n p) ;
<Neg,VPast> => vp.s ! VPTense Neg (VPPast Simul) (AgPes n p) ;
<Pos,VPerfPast> => vp.s ! VPTense Pos (VPPast Anter) (AgPes n p) ;
<Pos,VFut> => case vp.wish of
{True => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Pos (VPFutr Simul) (AgPes n p) };
<Pos,VPerfFut> => 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
<Pos,VCondSimul> => vp.s ! VPTense Pos (VPCond Simul) (AgPes n p) ;
<Pos,VCondAnter> => vp.s ! VPTense Pos (VPCond Anter) (AgPes n p); -- verb form to be confirmed
<Neg,VPerfPast> => vp.s ! VPTense Neg (VPPast Anter) (AgPes n p) ;
<Neg,VFut> => case vp.wish of
{True => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Neg (VPFutr Simul) (AgPes n p) };
<Neg,VPerfFut> => 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
<Neg,VCondSimul> => vp.s ! VPTense Neg (VPCond Simul) (AgPes n p) ;
<Neg,VCondAnter> => 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 <b,vt> of {
<Pos,VPres> => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
<Neg,VPres> => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
<Pos,VPerfPres> => vp.s ! VPTense Pos (VPPres Anter) (AgPes n p) ;
<Neg,VPerfPres> => vp.s ! VPTense Neg (VPPres Anter) (AgPes n p) ;
<Pos,VPast> => vp.s ! VPTense Pos (VPPast Simul) (AgPes n p) ;
<Neg,VPast> => vp.s ! VPTense Neg (VPPast Simul) (AgPes n p) ;
<Pos,VPerfPast> => vp.s ! VPTense Pos (VPPast Anter) (AgPes n p) ;
<Pos,VFut> => case vp.wish of
{True => vp.s ! VPTense Pos (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Pos (VPFutr Simul) (AgPes n p) };
<Pos,VPerfFut> => 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
<Pos,VCondSimul> => vp.s ! VPTense Pos (VPCond Simul) (AgPes n p) ;
<Pos,VCondAnter> => vp.s ! VPTense Pos (VPCond Anter) (AgPes n p); -- verb form to be confirmed
<Neg,VPerfPast> => vp.s ! VPTense Neg (VPPast Anter) (AgPes n p) ;
<Neg,VFut> => case vp.wish of
{True => vp.s ! VPTense Neg (VPPres Simul) (AgPes n p) ;
False => vp.s ! VPTense Neg (VPFutr Simul) (AgPes n p) };
<Neg,VPerfFut> => 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
<Neg,VCondSimul> => vp.s ! VPTense Neg (VPCond Simul) (AgPes n p) ;
<Neg,VCondAnter> => 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 <pol,t,p,n> of {
<Pos,AuxPresent PrPerf,PPers1,Sg> => bodh ++ "Am" ;
<Pos,AuxPresent PrPerf,PPers1,Pl> => bodh ++ "Aym" ;
<Pos,AuxPresent PrPerf,PPers2,Sg> => bodh ++ "Ay" ;
<Pos,AuxPresent PrPerf,PPers2,Pl> => bodh ++ "Ayd" ;
<Pos,AuxPresent PrPerf,PPers3,Sg> => bodh ++ "Ast" ;
<Pos,AuxPresent PrPerf,PPers3,Pl> => bodh ++ "And" ;
<Pos,AuxPresent PrImperf,PPers1,Sg> => hast + "m" ;
<Pos,AuxPresent PrImperf,PPers1,Pl> => hast + "ym" ;
<Pos,AuxPresent PrImperf,PPers2,Sg> => hast + "y" ;
<Pos,AuxPresent PrImperf,PPers2,Pl> => hast + "yd" ;
<Pos,AuxPresent PrImperf,PPers3,Sg> => "Ast" ;
<Pos,AuxPresent PrImperf,PPers3,Pl> => hast + "nd" ;
<Pos,AuxPast PstPerf,PPers1,Sg> => "";
<Pos,AuxPast PstPerf,PPers1,Pl> => "" ;
<Pos,AuxPast PstPerf,PPers2,Sg> => "" ;
<Pos,AuxPast PstPerf,PPers2,Pl> => "" ;
<Pos,AuxPast PstPerf,PPers3,Sg> => "" ;
<Pos,AuxPast PstPerf,PPers3,Pl> => "" ;
<Pos,AuxPast PstImperf,PPers1,Sg> => "my" ++ bod + "m" ;
<Pos,AuxPast PstImperf,PPers1,Pl> => "my" ++ bod + "ym" ;
<Pos,AuxPast PstImperf,PPers2,Sg> => "my" ++ bod + "y";
<Pos,AuxPast PstImperf,PPers2,Pl> => "my" ++ bod + "yd" ;
<Pos,AuxPast PstImperf,PPers3,Sg> => "my" ++ bod ;
<Pos,AuxPast PstImperf,PPers3,Pl> => "my" ++ bod + "nd" ;
<Pos,AuxPast PstAorist,PPers1,Sg> => bod + "m" ;
<Pos,AuxPast PstAorist,PPers1,Pl> => bod + "ym" ;
<Pos,AuxPast PstAorist,PPers2,Sg> => bod + "y";
<Pos,AuxPast PstAorist,PPers2,Pl> => bod + "yd" ;
<Pos,AuxPast PstAorist,PPers3,Sg> => bod ;
<Pos,AuxPast PstAorist,PPers3,Pl> => bod + "nd" ;
{-
<Pos,AuxFut FtImperf,PPers1,Sg> => mekhah + "m" ++ bash + "m" ;
<Pos,AuxFut FtImperf,PPers1,Pl> => mekhah + "ym" ++ bash + "ym" ;
<Pos,AuxFut FtImperf,PPers2,Sg> => mekhah + "y" ++ bash + "y" ;
<Pos,AuxFut FtImperf,PPers2,Pl> => mekhah + "yd" ++ bash + "yd" ;
<Pos,AuxFut FtImperf,PPers3,Sg> => mekhah + "d" ++ bash + "d" ;
<Pos,AuxFut FtImperf,PPers3,Pl> => mekhah + "nd" ++ bash + "nd" ;
-}
<Pos,AuxFut FtAorist,PPers1,Sg> => khah + "m" ++ bod ;
<Pos,AuxFut FtAorist,PPers1,Pl> => khah + "ym" ++ bod ;
<Pos,AuxFut Ftorist,PPers2,Sg> => khah + "y" ++ bod ;
<Pos,AuxFut FtAorist,PPers2,Pl> => khah + "yd" ++ bod ;
<Pos,AuxFut FtAorist,PPers3,Sg> => khah + "d" ++ bod ;
<Pos,AuxFut FtAorist,PPers3,Pl> => khah + "nd" ++ bod ;
-- nagatives
<Neg,AuxPresent PrPerf,PPers1,Sg> => nbodh ++ "Am" ;
<Neg,AuxPresent PrPerf,PPers1,Pl> => nbodh ++ "Aym" ;
<Neg,AuxPresent PrPerf,PPers2,Sg> => nbodh ++ "Ay" ;
<Neg,AuxPresent PrPerf,PPers2,Pl> => nbodh ++ "Ayd" ;
<Neg,AuxPresent PrPerf,PPers3,Sg> => nbodh ++ "Ast" ;
<Neg,AuxPresent PrPerf,PPers3,Pl> => nbodh ++ "And" ;
<Neg,AuxPresent PrImperf,PPers1,Sg> => nhast + "m" ;
<Neg,AuxPresent PrImperf,PPers1,Pl> => nhast + "ym" ;
<Neg,AuxPresent PrImperf,PPers2,Sg> => nhast + "y" ;
<Neg,AuxPresent PrImperf,PPers2,Pl> => nhast + "yd" ;
<Neg,AuxPresent PrImperf,PPers3,Sg> => "nyst" ;
<Neg,AuxPresent PrImperf,PPers3,Pl> => nhast + "nd" ;
<Neg,AuxPast PstPerf,PPers1,Sg> => "";
<Neg,AuxPast PstPerf,PPers1,Pl> => "" ;
<Neg,AuxPast PstPerf,PPers2,Sg> => "" ;
<Neg,AuxPast PstPerf,PPers2,Pl> => "" ;
<Neg,AuxPast PstPerf,PPers3,Sg> => "" ;
<Neg,AuxPast PstPerf,PPers3,Pl> => "" ;
<Neg,AuxPast PstImperf,PPers1,Sg> => "nmy" ++ bod + "m" ;
<Neg,AuxPast PstImperf,PPers1,Pl> => "nmy" ++ bod + "ym" ;
<Neg,AuxPast PstImperf,PPers2,Sg> => "nmy" ++ bod + "y";
<Neg,AuxPast PstImperf,PPers2,Pl> => "nmy" ++ bod + "yd" ;
<Neg,AuxPast PstImperf,PPers3,Sg> => "nmy" ++ bod ;
<Neg,AuxPast PstImperf,PPers3,Pl> => "nmy" ++ bod + "nd" ;
<Neg,AuxPast PstAorist,PPers1,Sg> => nbod + "m" ;
<Neg,AuxPast PstAorist,PPers1,Pl> => nbod + "ym" ;
<Neg,AuxPast PstAorist,PPers2,Sg> => nbod + "y";
<Neg,AuxPast PstAorist,PPers2,Pl> => nbod + "yd" ;
<Neg,AuxPast PstAorist,PPers3,Sg> => nbod ;
<Neg,AuxPast PstAorist,PPers3,Pl> => nbod + "nd" ;
{-
<Neg,AuxFut FtImperf,PPers1,Sg> => nmekhah + "m" ++ bash + "m" ;
<Neg,AuxFut FtImperf,PPers1,Pl> => nmekhah + "ym" ++ bash + "ym" ;
<Neg,AuxFut FtImperf,PPers2,Sg> => nmekhah + "y" ++ bash + "y" ;
<Neg,AuxFut FtImperf,PPers2,Pl> => nmekhah + "yd" ++ bash + "yd" ;
<Neg,AuxFut FtImperf,PPers3,Sg> => nmekhah + "d" ++ bash + "d" ;
<Neg,AuxFut FtImperf,PPers3,Pl> => nmekhah + "nd" ++ bash + "nd" ;
-}
<Neg,AuxFut FtAorist,PPers1,Sg> => nkhah + "m" ++ bod ;
<Neg,AuxFut FtAorist,PPers1,Pl> => nkhah + "ym" ++ bod ;
<Neg,AuxFut Ftorist,PPers2,Sg> => nkhah + "y" ++ bod ;
<Neg,AuxFut FtAorist,PPers2,Pl> => nkhah + "yd" ++ bod ;
<Neg,AuxFut FtAorist,PPers3,Sg> => nkhah + "d" ++ bod ;
<Neg,AuxFut FtAorist,PPers3,Pl> => nkhah + "nd" ++ bod
{-
<Infr_Past2 InfrPerf,PPers1,Sg> => khordh ++ bvdh ++ "Am" ;
<Infr_Past2 InfrPerf,PPers1,Pl> => khordh ++ bvdh ++ "Aym" ;
<Infr_Past2 InfrPerf,PPers2,Sg> => khordh ++ bvdh ++ "Ay" ;
<Infr_Past2 InfrPerf,PPers2,Pl> => khordh ++ bvdh ++ "Ayd" ;
<Infr_Past2 InfrPerf,PPers3,Sg> => khordh ++ bvdh ++ "Ast" ;
<Infr_Past2 InfrPerf,PPers3,Pl> => khordh ++ bvdh ++ "And" ;
<Infr_Past2 InfrImperf,PPers1,Sg> => mekhordh ++ "Am" ;
<Infr_Past2 InfrImperf,PPers1,Pl> => mekhordh ++ "Aym" ;
<Infr_Past2 InfrImperf,PPers2,Sg> => mekhordh ++ "Ay" ;
<Infr_Past2 InfrImperf,PPers2,Pl> => mekhordh ++ "Ayd" ;
<Infr_Past2 InfrImperf,PPers3,Sg> => mekhordh ++ "Ast" ;
<Infr_Past2 InfrImperf,PPers3,Pl> => 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 <pol,t,p,n> of {
<Pos,PPresent2 PrPerf,PPers1,Sg> => dashteh ++ "Am" ;
<Pos,PPresent2 PrPerf,PPers1,Pl> => dashteh ++ "Aym" ;
<Pos,PPresent2 PrPerf,PPers2,Sg> => dashteh ++ "Ay" ;
<Pos,PPresent2 PrPerf,PPers2,Pl> => dashteh ++ "Ayd" ;
<Pos,PPresent2 PrPerf,PPers3,Sg> => dashteh ++ "Ast" ;
<Pos,PPresent2 PrPerf,PPers3,Pl> => dashteh ++ "And" ;
<Pos,PPresent2 PrImperf,PPers1,Sg> => dar + "m" ;
<Pos,PPresent2 PrImperf,PPers1,Pl> => dar + "ym" ;
<Pos,PPresent2 PrImperf,PPers2,Sg> => dar + "y" ;
<Pos,PPresent2 PrImperf,PPers2,Pl> => dar + "yd" ;
<Pos,PPresent2 PrImperf,PPers3,Sg> => dar + "d" ;
<Pos,PPresent2 PrImperf,PPers3,Pl> => dar + "nd" ;
<Pos,PPast2 PstPerf,PPers1,Sg> => dashteh ++ "bvdm" ;
<Pos,PPast2 PstPerf,PPers1,Pl> => dashteh ++ "bvdym" ;
<Pos,PPast2 PstPerf,PPers2,Sg> => dashteh ++ "bvdy" ;
<Pos,PPast2 PstPerf,PPers2,Pl> => dashteh ++ "bvdyd" ;
<Pos,PPast2 PstPerf,PPers3,Sg> => dashteh ++ "bvd" ;
<Pos,PPast2 PstPerf,PPers3,Pl> => dashteh ++ "bvdnd" ;
<Pos,PPast2 PstImperf,PPers1,Sg> => dasht + "m" ;
<Pos,PPast2 PstImperf,PPers1,Pl> => dasht + "ym" ;
<Pos,PPast2 PstImperf,PPers2,Sg> => dasht + "y";
<Pos,PPast2 PstImperf,PPers2,Pl> => dasht + "yd" ;
<Pos,PPast2 PstImperf,PPers3,Sg> => dasht ;
<Pos,PPast2 PstImperf,PPers3,Pl> => dasht + "nd" ;
<Pos,PPast2 PstAorist,PPers1,Sg> => dasht + "m" ;
<Pos,PPast2 PstAorist,PPers1,Pl> => dasht + "ym" ;
<Pos,PPast2 PstAorist,PPers2,Sg> => dasht + "y";
<Pos,PPast2 PstAorist,PPers2,Pl> => dasht + "yd" ;
<Pos,PPast2 PstAorist,PPers3,Sg> => dasht ;
<Pos,PPast2 PstAorist,PPers3,Pl> => dasht + "nd" ;
<Pos,PFut2 FtAorist,PPers1,Sg> => khah + "m" ++ dasht ;
<Pos,PFut2 FtAorist,PPers1,Pl> => khah + "ym" ++ dasht ;
<Pos,PFut2 Ftorist,PPers2,Sg> => khah + "y" ++ dasht ;
<Pos,PFut2 FtAorist,PPers2,Pl> => khah + "yd" ++ dasht ;
<Pos,PFut2 FtAorist,PPers3,Sg> => khah + "d" ++ dasht ;
<Pos,PFut2 FtAorist,PPers3,Pl> => khah + "nd" ++ dasht ;
<Pos,Infr_Past2 InfrPerf,PPers1,Sg> => dashteh ++ bvdh ++ "Am" ;
<Pos,Infr_Past2 InfrPerf,PPers1,Pl> => dashteh ++ bvdh ++ "Aym" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Sg> => dashteh ++ bvdh ++ "Ay" ;
<Pos,Infr_Past2 InfrPerf,PPers2,Pl> => dashteh ++ bvdh ++ "Ayd" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Sg> => dashteh ++ bvdh ++ "Ast" ;
<Pos,Infr_Past2 InfrPerf,PPers3,Pl> => dashteh ++ bvdh ++ "And" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Sg> => dashteh ++ "Am" ;
<Pos,Infr_Past2 InfrImperf,PPers1,Pl> => dashteh ++ "Aym" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Sg> => dashteh ++ "Ay" ;
<Pos,Infr_Past2 InfrImperf,PPers2,Pl> => dashteh ++ "Ayd" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Sg> => dashteh ++ "Ast" ;
<Pos,Infr_Past2 InfrImperf,PPers3,Pl> => dashteh ++ "And" ;
-- negatives
<Neg,PPresent2 PrPerf,PPers1,Sg> => ndashteh ++ "Am" ;
<Neg,PPresent2 PrPerf,PPers1,Pl> => ndashteh ++ "Aym" ;
<Neg,PPresent2 PrPerf,PPers2,Sg> => ndashteh ++ "Ay" ;
<Neg,PPresent2 PrPerf,PPers2,Pl> => ndashteh ++ "Ayd" ;
<Neg,PPresent2 PrPerf,PPers3,Sg> => ndashteh ++ "Ast" ;
<Neg,PPresent2 PrPerf,PPers3,Pl> => ndashteh ++ "And" ;
<Neg,PPresent2 PrImperf,PPers1,Sg> => ndar + "m" ;
<Neg,PPresent2 PrImperf,PPers1,Pl> => ndar + "ym" ;
<Neg,PPresent2 PrImperf,PPers2,Sg> => ndar + "y" ;
<Neg,PPresent2 PrImperf,PPers2,Pl> => ndar + "yd" ;
<Neg,PPresent2 PrImperf,PPers3,Sg> => ndar + "d" ;
<Neg,PPresent2 PrImperf,PPers3,Pl> => ndar + "nd" ;
<Neg,PPast2 PstPerf,PPers1,Sg> => ndashteh ++ "bvdm" ;
<Neg,PPast2 PstPerf,PPers1,Pl> => ndashteh ++ "bvdym" ;
<Neg,PPast2 PstPerf,PPers2,Sg> => ndashteh ++ "bvdy" ;
<Neg,PPast2 PstPerf,PPers2,Pl> => ndashteh ++ "bvdyd" ;
<Neg,PPast2 PstPerf,PPers3,Sg> => ndashteh ++ "bvd" ;
<Neg,PPast2 PstPerf,PPers3,Pl> => ndashteh ++ "bvdnd" ;
<Neg,PPast2 PstImperf,PPers1,Sg> => ndasht + "m" ;
<Neg,PPast2 PstImperf,PPers1,Pl> => ndasht + "ym" ;
<Neg,PPast2 PstImperf,PPers2,Sg> => ndasht + "y";
<Neg,PPast2 PstImperf,PPers2,Pl> => ndasht + "yd" ;
<Neg,PPast2 PstImperf,PPers3,Sg> => ndasht ;
<Neg,PPast2 PstImperf,PPers3,Pl> => ndasht + "nd" ;
<Neg,PPast2 PstAorist,PPers1,Sg> => ndasht + "m" ;
<Neg,PPast2 PstAorist,PPers1,Pl> => ndasht + "ym" ;
<Neg,PPast2 PstAorist,PPers2,Sg> => ndasht + "y";
<Neg,PPast2 PstAorist,PPers2,Pl> => ndasht + "yd" ;
<Neg,PPast2 PstAorist,PPers3,Sg> => ndasht ;
<Neg,PPast2 PstAorist,PPers3,Pl> => ndasht + "nd" ;
<Neg,PFut2 FtAorist,PPers1,Sg> => nkhah + "m" ++ dasht ;
<Neg,PFut2 FtAorist,PPers1,Pl> => nkhah + "ym" ++ dasht ;
<Neg,PFut2 Ftorist,PPers2,Sg> => nkhah + "y" ++ dasht ;
<Neg,PFut2 FtAorist,PPers2,Pl> => nkhah + "yd" ++ dasht ;
<Neg,PFut2 FtAorist,PPers3,Sg> => nkhah + "d" ++ dasht ;
<Neg,PFut2 FtAorist,PPers3,Pl> => nkhah + "nd" ++ dasht ;
<Neg,Infr_Past2 InfrPerf,PPers1,Sg> => ndashteh ++ bvdh ++ "Am" ;
<Neg,Infr_Past2 InfrPerf,PPers1,Pl> => ndashteh ++ bvdh ++ "Aym" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Sg> => ndashteh ++ bvdh ++ "Ay" ;
<Neg,Infr_Past2 InfrPerf,PPers2,Pl> => ndashteh ++ bvdh ++ "Ayd" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Sg> => ndashteh ++ bvdh ++ "Ast" ;
<Neg,Infr_Past2 InfrPerf,PPers3,Pl> => ndashteh ++ bvdh ++ "And" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Sg> => ndashteh ++ "Am" ;
<Neg,Infr_Past2 InfrImperf,PPers1,Pl> => ndashteh ++ "Aym" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Sg> => ndashteh ++ "Ay" ;
<Neg,Infr_Past2 InfrImperf,PPers2,Pl> => ndashteh ++ "Ayd" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Sg> => ndashteh ++ "Ast" ;
<Neg,Infr_Past2 InfrImperf,PPers3,Pl> => 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 <ani,number> of {
<Animate,Sg> => "Av" ;
<Animate,Pl> => ["A:n hA"] ;
<Inanimate,Sg> => "A:n" ;
<Inanimate,Pl> => ["A:n hA"]
};
}

View File

@@ -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 <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! ODir;
<Pres,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! ODir;
<Past,Simul> => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! ODir;
<Past,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! ODir;
<Fut,Simul> => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! ODir;
<Fut,Anter> => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! ODir;
<Cond,Simul> => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! ODir;
<Cond,Anter> => 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 <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ cl.s ! VPres ! p.p ! q;
<Pres,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPres ! p.p ! q;
<Past,Simul> => temp.s ++ p.s ++ cl.s ! VPast ! p.p ! q;
<Past,Anter> => temp.s ++ p.s ++ cl.s ! VPerfPast ! p.p ! q;
<Fut,Simul> => temp.s ++ p.s ++ cl.s ! VFut ! p.p ! q;
<Fut,Anter> => temp.s ++ p.s ++ cl.s ! VPerfFut ! p.p ! q;
<Cond,Simul> => temp.s ++ p.s ++ cl.s ! VCondSimul ! p.p ! q;
<Cond,Anter> => temp.s ++ p.s ++ cl.s ! VCondAnter ! p.p ! q
};
} ;
UseRCl temp p rcl = {
s = \\q => case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ rcl.s ! VPres ! p.p ! ODir ! q;
<Pres,Anter> => temp.s ++ p.s ++ rcl.s ! VPerfPres ! p.p ! ODir ! q;
<Past,Simul> => temp.s ++ p.s ++ rcl.s ! VPast ! p.p ! ODir ! q;
<Past,Anter> => temp.s ++ p.s ++ rcl.s ! VPerfPast ! p.p ! ODir ! q;
<Fut,Simul> => temp.s ++ p.s ++ rcl.s ! VFut ! p.p ! ODir ! q;
<Fut,Anter> => temp.s ++ p.s ++ rcl.s ! VPerfFut ! p.p ! ODir ! q;
<Cond,Simul> => temp.s ++ p.s ++ rcl.s ! VCondSimul ! p.p ! ODir ! q;
<Cond,Anter> => temp.s ++ p.s ++ rcl.s ! VCondAnter ! p.p ! ODir ! q
};
c = rcl.c
} ;
UseSlash temp p clslash = {
s = case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ clslash.s ! VPres ! p.p ! ODir;
<Pres,Anter> => temp.s ++ p.s ++ clslash.s ! VPerfPres ! p.p ! ODir;
<Past,Simul> => temp.s ++ p.s ++ clslash.s ! VPast ! p.p ! ODir ;
<Past,Anter> => temp.s ++ p.s ++ clslash.s ! VPerfPast ! p.p ! ODir;
<Fut,Simul> => temp.s ++ p.s ++ clslash.s ! VFut ! p.p ! ODir;
<Fut,Anter> => temp.s ++ p.s ++ clslash.s ! VPerfFut ! p.p ! ODir;
<Cond,Simul> => temp.s ++ p.s ++ clslash.s ! VCondSimul ! p.p ! ODir;
<Cond,Anter> => 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};
}

View File

@@ -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" ;
}

View File

@@ -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