forked from GitHub/gf-rgl
Merge pull request #186 from inariksit/persian
(Pes) fix poss. suff, word order, copula + cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
|
|||||||
vp : ResPes.VPHTense => Polarity => Order => Str ;
|
vp : ResPes.VPHTense => Polarity => Order => Str ;
|
||||||
c2 : ResPes.Compl
|
c2 : ResPes.Compl
|
||||||
} ;
|
} ;
|
||||||
Imp = {s : CPolarity => ImpForm => Str} ;
|
Imp = {s : Polarity => ImpForm => Str} ;
|
||||||
|
|
||||||
---- Question
|
---- Question
|
||||||
QCl = {s : ResPes.VPHTense => Polarity => QForm => Str} ;
|
QCl = {s : ResPes.VPHTense => Polarity => QForm => Str} ;
|
||||||
@@ -81,7 +81,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
|
|||||||
V, VS, VQ, VA = ResPes.Verb ;
|
V, VS, VQ, VA = ResPes.Verb ;
|
||||||
|
|
||||||
V2, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ;
|
V2, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ;
|
||||||
V3 = ResPes.Verb ** {c2, c3 : Str} ;
|
V3 = ResPes.Verb ** {c2, c3 : Compl} ;
|
||||||
VV = ResPes.Verb ** {isAux : Bool} ;
|
VV = ResPes.Verb ** {isAux : Bool} ;
|
||||||
V2V = ResPes.Verb ** {c1 : Str ; c2 : Str ; isAux : Bool} ;
|
V2V = ResPes.Verb ** {c1 : Str ; c2 : Str ; isAux : Bool} ;
|
||||||
A = ResPes.Adjective ;
|
A = ResPes.Adjective ;
|
||||||
@@ -89,7 +89,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
|
|||||||
|
|
||||||
N = ResPes.Noun ;
|
N = ResPes.Noun ;
|
||||||
|
|
||||||
N2 = ResPes.Noun ** {c : Str};
|
N2 = ResPes.Noun ** {c : Str ; compl : Str}; -- when N3 is made to N2, need to retain compl
|
||||||
N3 = ResPes.Noun ** {c2 : Str ; c3 : Str} ;
|
N3 = ResPes.Noun ** {c2 : Str ; c3 : Str} ;
|
||||||
PN = {s : Str ; animacy : Animacy} ;
|
PN = {s : Str ; animacy : Animacy} ;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ concrete ConjunctionPes of Conjunction =
|
|||||||
lincat
|
lincat
|
||||||
[S] = {s1,s2 : Str} ;
|
[S] = {s1,s2 : Str} ;
|
||||||
[Adv] = {s1,s2 : Str} ;
|
[Adv] = {s1,s2 : Str} ;
|
||||||
[NP] = {s1,s2 : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
|
[NP] = {s1,s2 : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool; compl:Str} ;
|
||||||
[AP] = {s1,s2 : Mod => Str ; adv : Str} ;
|
[AP] = {s1,s2 : Mod => Str ; adv : Str} ;
|
||||||
[RS] = {s1,s2 : Agr => Str };
|
[RS] = {s1,s2 : Agr => Str };
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,15 @@ lin
|
|||||||
|
|
||||||
ExistNP np =
|
ExistNP np =
|
||||||
mkSClause " " (agrP3 (fromAgr np.a).n)
|
mkSClause " " (agrP3 (fromAgr np.a).n)
|
||||||
(insertObj (\\_ => np.s ! Bare) (predAux auxBe)) ;
|
(insertComp (\\_ => np.s ! Bare) (predAux auxBe)) ;
|
||||||
|
|
||||||
ExistIP ip =
|
ExistIP ip =
|
||||||
let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predAux auxBe);
|
let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predAux auxBe);
|
||||||
in {
|
in {s = \\t,p,qf => case qf of {
|
||||||
s = \\t,p,qf => case qf of {
|
QDir => cl.s ! t ! p ! ODir;
|
||||||
QDir => cl.s ! t ! p ! ODir;
|
|
||||||
QIndir => cl.s ! t! p ! ODir
|
QIndir => cl.s ! t! p ! ODir
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ProgrVP vp = predProg vp ;
|
ProgrVP vp = predProg vp ;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ concrete LexiconPes of Lexicon = CatPes **
|
|||||||
bread_N = mkN01 "نان" inanimate;
|
bread_N = mkN01 "نان" inanimate;
|
||||||
break_V2 = mkV2 (mkV "شکستن" "شکن") "را";
|
break_V2 = mkV2 (mkV "شکستن" "شکن") "را";
|
||||||
broad_A = mkA "وسیع" ;
|
broad_A = mkA "وسیع" ;
|
||||||
brother_N2 = (mkN01 "برادر" animate) ** {c=""};
|
brother_N2 = mkN2 (mkN01 "برادر" animate) [];
|
||||||
brown_A = mkA ["قهوه ای"] ;
|
brown_A = mkA ["قهوه ای"] ;
|
||||||
butter_N = mkN01 "کره" inanimate;
|
butter_N = mkN01 "کره" inanimate;
|
||||||
buy_V2 = mkV2 (mkV_1 "خریدن") "را";
|
buy_V2 = mkV2 (mkV_1 "خریدن") "را";
|
||||||
@@ -75,7 +75,7 @@ concrete LexiconPes of Lexicon = CatPes **
|
|||||||
empty_A = mkA "خالی" ;
|
empty_A = mkA "خالی" ;
|
||||||
enemy_N = mkN02 "دشمن" animate;
|
enemy_N = mkN02 "دشمن" animate;
|
||||||
factory_N = mkN01 "کارخانه" inanimate;
|
factory_N = mkN01 "کارخانه" inanimate;
|
||||||
father_N2 = (mkN02 "پدر" animate) ** {c=""};
|
father_N2 = mkN2 (mkN02 "پدر" animate) [];
|
||||||
fear_VS = mkV_1 "ترسیدن";
|
fear_VS = mkV_1 "ترسیدن";
|
||||||
find_V2 = mkV2 (compoundV "پیدا" doVerb) "را";
|
find_V2 = mkV2 (compoundV "پیدا" doVerb) "را";
|
||||||
fish_N = mkN01 "ماهی" animate;
|
fish_N = mkN01 "ماهی" animate;
|
||||||
@@ -125,7 +125,7 @@ concrete LexiconPes of Lexicon = CatPes **
|
|||||||
meat_N = mkN01 "گوشت" inanimate;
|
meat_N = mkN01 "گوشت" inanimate;
|
||||||
milk_N = mkN01 "شیر" inanimate;
|
milk_N = mkN01 "شیر" inanimate;
|
||||||
moon_N = mkN01 "ماه" inanimate; -- is this not a proper noun?
|
moon_N = mkN01 "ماه" inanimate; -- is this not a proper noun?
|
||||||
mother_N2 = (mkN02 "مادر" animate) ** {c=""};
|
mother_N2 = mkN2 (mkN02 "مادر" animate) [] ;
|
||||||
mountain_N = mkN01 "کوه" inanimate;
|
mountain_N = mkN01 "کوه" inanimate;
|
||||||
music_N = mkN "موسیقی" "موسیقی" animate;
|
music_N = mkN "موسیقی" "موسیقی" animate;
|
||||||
narrow_A = mkA "باریک" ;
|
narrow_A = mkA "باریک" ;
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ oper
|
|||||||
_ => mkCmnVF dasht dar pol t ag
|
_ => mkCmnVF dasht dar pol t ag
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
-- TODO: merge with auxBe in ResPes
|
||||||
beVerb : Verb = { s = table {
|
beVerb : Verb = { s = table {
|
||||||
Vvform agr => imperfectSuffixD agr "باش" ;
|
Vvform agr => imperfectSuffixD agr "باش" ;
|
||||||
Imp Pos Sg => "باش" ;
|
Imp Pos Sg => "باش" ;
|
||||||
@@ -338,7 +339,18 @@ oper
|
|||||||
Inf => "بودن" ;
|
Inf => "بودن" ;
|
||||||
Root1 => "بود" ;
|
Root1 => "بود" ;
|
||||||
Root2 => "باش" ;
|
Root2 => "باش" ;
|
||||||
VF pol tense agr => mkCmnVF "بود" "باش" pol tense agr
|
VF pol tense agr =>
|
||||||
}
|
let impfSuff = imperfectSuffix agr ;
|
||||||
|
perfSuff = perfectSuffix agr
|
||||||
|
in case <pol,tense,agr> of {
|
||||||
|
<Pos,PPresent2 PrImperf,Ag Sg P3> => "است" ;
|
||||||
|
<Pos,PPresent2 PrImperf> => impfSuff "هست" ;
|
||||||
|
<Pos,PPresent2 PrPerf> => perfSuff "بوده" ;
|
||||||
|
<Neg,PPresent2 PrImperf,Ag Sg P3> => "نیست" ;
|
||||||
|
<Neg,PPresent2 PrImperf> => impfSuff "نیست" ;
|
||||||
|
<Neg,PPresent2 PrPerf> => perfSuff "نبوده" ;
|
||||||
|
_ => mkCmnVF "بود" "باش" pol tense agr
|
||||||
|
}
|
||||||
|
}
|
||||||
} ;
|
} ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,20 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
|||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
DetCN det cn = cn ** {s = \\mod =>
|
DetCN det cn = cn ** {
|
||||||
case <det.isNum,det.mod> of {
|
s = \\m =>
|
||||||
<False,Bare> => det.s ++ cn.s ! det.n ! mod ; -- det is not from Pron, retain NPForm.
|
let num : Number = case det.isNum of {
|
||||||
<False,X> => cn.s ! det.n ! X ++ det.s ; -- det is from Pron, cn is in Ezafe.
|
True => Sg ; -- noun modified by a number is invariably singular
|
||||||
<True,Bare> => det.s ++ cn.s ! Sg ! mod ; -- noun modified by a number is invariably singular
|
False => det.n } ;
|
||||||
<True,X> => cn.s ! Sg ! X ++ det.s
|
in case det.mod of {
|
||||||
} ;
|
Bare => det.s ++ cn.s ! num ! m ; -- det doesn't require a special form, keep the Mod=>Str table
|
||||||
|
x => cn.s ! num ! x ++ det.s } ; -- det requires a special form
|
||||||
a = agrP3 det.n ;
|
a = agrP3 det.n ;
|
||||||
|
compl = cn.compl ! det.n
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
UsePN pn = pn ** {s = \\_ => pn.s ; a = agrP3 Sg ; hasAdj = False} ;
|
UsePN pn = emptyNP ** pn ** {s = \\_ => pn.s} ;
|
||||||
UsePron p = p ** {s = \\_ => p.s ; animacy = Animate ; hasAdj = False} ;
|
UsePron p = emptyNP ** p ** {s = \\_ => p.s ; animacy = Animate} ;
|
||||||
|
|
||||||
PredetNP pred np = np ** {
|
PredetNP pred np = np ** {
|
||||||
s = \\ez => pred.s ++ np.s ! ez
|
s = \\ez => pred.s ++ np.s ! ez
|
||||||
@@ -29,7 +31,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
AdvNP np adv = np ** {
|
AdvNP np adv = np ** {
|
||||||
s = \\ez => np.s ! Ezafe ++ adv.s
|
s = \\ez => np.s ! Ezafe ++ adv.s
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
DetQuantOrd quant num ord = {
|
DetQuantOrd quant num ord = {
|
||||||
@@ -50,7 +52,8 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
|||||||
s = \\_ => det.s ; ---- case
|
s = \\_ => det.s ; ---- case
|
||||||
a = agrP3 det.n ;
|
a = agrP3 det.n ;
|
||||||
hasAdj = False ;
|
hasAdj = False ;
|
||||||
animacy = Inanimate
|
animacy = Inanimate ;
|
||||||
|
compl = []
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
PossPron p = {s = \\_ => BIND ++ p.ps ; a = p.a ; mod = Poss} ;
|
PossPron p = {s = \\_ => BIND ++ p.ps ; a = p.a ; mod = Poss} ;
|
||||||
@@ -71,50 +74,55 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
|||||||
OrdSuperl a = {s = a.s ! Bare ++ taryn; n = Sg ; isNum=False} ; -- check the form of adjective
|
OrdSuperl a = {s = a.s ! Bare ++ taryn; n = Sg ; isNum=False} ; -- check the form of adjective
|
||||||
|
|
||||||
DefArt = {s = \\_ => [] ; a = defaultAgr ; mod = Bare} ;
|
DefArt = {s = \\_ => [] ; a = defaultAgr ; mod = Bare} ;
|
||||||
IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgr ; mod = Bare} ;
|
IndefArt = {s = table {Sg => IndefArticle ; Pl => []} ; a = defaultAgr ; mod = Bare} ;
|
||||||
|
|
||||||
MassNP cn = cn ** {
|
MassNP cn = cn ** {
|
||||||
s = cn.s ! Sg ;
|
s = cn.s ! Sg ;
|
||||||
a = agrP3 Sg
|
a = agrP3 Sg ;
|
||||||
|
compl = cn.compl ! Sg
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
UseN n = n ** {hasAdj=False};
|
UseN,
|
||||||
UseN2 n = n ** {hasAdj=False};
|
UseN2 = useN ;
|
||||||
|
|
||||||
Use2N3 f = f ** {
|
Use2N3 n3 = useN n3 ** {
|
||||||
c = f.c2;
|
c = n3.c2 ;
|
||||||
definitness = True
|
compl = []
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
Use3N3 f = f ** {
|
Use3N3 n3 = useN n3 ** {
|
||||||
c = f.c3;
|
c = n3.c3 ;
|
||||||
definitness = True
|
compl = []
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
ComplN2 n2 np = n2 ** {
|
ComplN2 n2 np = n2 ** {
|
||||||
s = \\n,m => n2.s ! n ! Ezafe ++ n2.c ++ np.s ! m ;
|
s = \\n,m => n2.s ! n ! Ezafe ;
|
||||||
|
compl = \\_ => n2.compl ++ n2.c ++ np.s ! Bare ;
|
||||||
hasAdj = False
|
hasAdj = False
|
||||||
};
|
};
|
||||||
|
|
||||||
ComplN3 f x = f ** {
|
ComplN3 n3 np = n3 ** {
|
||||||
s = \\n,ez => f.s ! n ! Ezafe ++ f.c2 ++ x.s ! ez ;
|
s = \\n,m => n3.s ! n ! Ezafe ;
|
||||||
c = f.c3;
|
compl = n3.c2 ++ np.s ! Bare ;
|
||||||
definitness = True;
|
c = n3.c3;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
AdjCN ap cn = cn ** {
|
AdjCN ap cn = cn ** {
|
||||||
s = \\n,ez => cn.s ! n ! Ezafe ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!Ezafe!n to have correct enclicitic form other wise it creats wrong enclictic form of old man
|
s = \\n,ez => cn.s ! n ! Ezafe ++ ap.s ! ez ;
|
||||||
hasAdj = True
|
hasAdj = True
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
RelCN cn rs = cn ** {
|
RelCN cn rs = cn ** {
|
||||||
s = \\n,ez => cn.s ! n ! Clitic ++ rs.s ! agrP3 n ;
|
s = \\n,ez => cn.s ! n ! Clitic ;
|
||||||
|
compl = \\n => rs.s ! agrP3 n ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
AdvCN cn ad = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ ad.s} ;
|
AdvCN cn ad = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ ad.s} ;
|
||||||
|
|
||||||
SentCN cn sc = cn ** {s = \\n,m => cn.s ! n ! m ++ sc.s} ;
|
SentCN cn sc = cn ** {compl = \\n => sc.s} ;
|
||||||
|
|
||||||
ApposCN cn np = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ np.s ! m ; definitness = True} ;
|
-- correct for /city Paris/, incorrect for /king John/
|
||||||
|
-- ApposNP in ExtendPes works for /king John/ (no ezafe).
|
||||||
|
ApposCN cn np = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ np.s ! m} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ oper
|
|||||||
= lin V M.haveVerb ;
|
= lin V M.haveVerb ;
|
||||||
beVerb : V -- The verb "be", to be used for light verb constructions: e.g. compoundV "عاشق" beVerb.
|
beVerb : V -- The verb "be", to be used for light verb constructions: e.g. compoundV "عاشق" beVerb.
|
||||||
= lin V M.beVerb ;
|
= lin V M.beVerb ;
|
||||||
|
|
||||||
mkV2 : overload {
|
mkV2 : overload {
|
||||||
mkV2 : Str -> V2 ; -- Predictable V2 out of string. No preposition, را for direct object.
|
mkV2 : Str -> V2 ; -- Predictable V2 out of string. No preposition, را for direct object.
|
||||||
mkV2 : V -> V2 ; -- V2 out of V. No preposition, را for direct object.
|
mkV2 : V -> V2 ; -- V2 out of V. No preposition, را for direct object.
|
||||||
@@ -100,7 +101,7 @@ oper
|
|||||||
|
|
||||||
|
|
||||||
mkV3 : V -> (dir,indir : Str) -> V3 ; -- Takes a verb and two prepositions as strings (can be empty). If the verb takes را for direct object, it's the first Str argument. e.g. talk, با, دربارۀ
|
mkV3 : V -> (dir,indir : Str) -> V3 ; -- Takes a verb and two prepositions as strings (can be empty). If the verb takes را for direct object, it's the first Str argument. e.g. talk, با, دربارۀ
|
||||||
mkV3 v p q = lin V3 (v ** {c2 = p ; c3 = q}) ;
|
mkV3 v p q = lin V3 (v ** {c2 = prepOrRa p ; c3 = prepOrRa q}) ;
|
||||||
|
|
||||||
mkV2V : V -> (cV, cN : Str) -> (isAux : Bool) -> V2V ; -- Verb, complementiser for the verb, complementiser for the noun, whether it's auxiliary.
|
mkV2V : V -> (cV, cN : Str) -> (isAux : Bool) -> V2V ; -- Verb, complementiser for the verb, complementiser for the noun, whether it's auxiliary.
|
||||||
mkV2V v s1 s2 b = lin V2V (v ** {isAux = b ; c1 = s1 ; c2 = s2}) ;
|
mkV2V v s1 s2 b = lin V2V (v ** {isAux = b ; c1 = s1 ; c2 = s2}) ;
|
||||||
@@ -252,31 +253,37 @@ oper
|
|||||||
|
|
||||||
mkV2 = overload {
|
mkV2 = overload {
|
||||||
mkV2 : Str -> V2 -- Predictable V2 with
|
mkV2 : Str -> V2 -- Predictable V2 with
|
||||||
= \s -> lin V2 (regV s ** {c2 = {s = [] ; ra = "را" ; c = VTrans}}) ;
|
= \s -> lin V2 (regV s ** {c2 = prepOrRa "را"}) ;
|
||||||
mkV2 : V -> V2
|
mkV2 : V -> V2
|
||||||
= \v -> lin V2 (v ** {c2 = {s = [] ; ra = "را" ; c = VTrans}}) ;
|
= \v -> lin V2 (v ** {c2 = prepOrRa "را"}) ;
|
||||||
mkV2 : V -> Prep -> V2
|
mkV2 : V -> Prep -> V2
|
||||||
= \v,p -> lin V2 (v ** {c2 = {ra = [] ; s = p.s ; c = VTrans}}) ;
|
= \v,p -> lin V2 (v ** {c2 = prepOrRa p.s}) ;
|
||||||
mkV2 : V -> Str -> V2
|
mkV2 : V -> Str -> V2
|
||||||
= \v,ra -> lin V2 (v ** {c2 = {ra = ra ; s = [] ; c = VTrans}}) ;
|
= \v,ra -> lin V2 (v ** {c2 = prepOrRa ra}) ;
|
||||||
mkV2 : V -> Str -> Bool -> V2
|
mkV2 : V -> Str -> Bool -> V2
|
||||||
= \v,p,b -> lin V2 (v ** {c2 = {ra = [] ; s = p ; c = VTrans}}) ;
|
= \v,p,b -> lin V2 (v ** {c2 = {ra = [] ; s = p}}) ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
prepOrRa : Str -> Compl = \s -> case s of {
|
||||||
|
"را" => {s = [] ; ra = "را"} ;
|
||||||
|
prep => {s = prep ; ra = []}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkN2 = overload {
|
mkN2 = overload {
|
||||||
mkN2 : N -> Str -> N2
|
mkN2 : N -> Str -> N2
|
||||||
= \n,c -> lin N2 (n ** {c = c}) ;
|
= \n,c -> lin N2 (n ** {c = c ; compl=[]}) ;
|
||||||
mkN2 : N -> Prep -> Str -> N2 -- hidden from puclic API
|
mkN2 : N -> Prep -> Str -> N2 -- hidden from puclic API
|
||||||
= \n,p,c -> lin N2 (n ** {c = p.s ; c2 = c}) -- there is no c2
|
= \n,p,c -> lin N2 (n ** {c = p.s ; c2 = c; compl=[]}) -- there is no c2
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkN3 = overload {
|
mkN3 = overload {
|
||||||
mkN3 : N -> Str -> Str -> N3
|
mkN3 : N -> Str -> Str -> N3
|
||||||
= \n,p,q -> lin N3 (n ** {c2=p ; c3=q}) ;
|
= \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ;
|
||||||
mkN3 : N -> Prep -> Str -> Str -> N3 -- hidden from public API
|
mkN3 : N -> Prep -> Str -> Str -> N3 -- hidden from public API
|
||||||
= \n,p,q,r -> lin N3 (n ** {c2 = p.s ; c3 = q ; c4 = r}) -- there is no c4
|
= \n,p,q,r -> lin N3 (n ** {c2 = p.s ; c3 = q ; c4 = r}) -- there is no c4
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
mkQuant = overload {
|
mkQuant = overload {
|
||||||
-- mkQuant : Pron -> Quant = \p -> {s = \\_,_,c => p.s!c ;a = p.a ; lock_Quant = <>};
|
-- mkQuant : Pron -> Quant = \p -> {s = \\_,_,c => p.s!c ;a = p.a ; lock_Quant = <>};
|
||||||
mkQuant : Str -> Str -> Quant -- hidden from public API
|
mkQuant : Str -> Str -> Quant -- hidden from public API
|
||||||
|
|||||||
@@ -3,25 +3,25 @@ concrete PhrasePes of Phrase = CatPes ** open Prelude, ResPes in {
|
|||||||
lin
|
lin
|
||||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||||
|
|
||||||
UttS s = s ;
|
|
||||||
UttQS qs = {s = qs.s ! QDir} ;
|
UttQS qs = {s = qs.s ! QDir} ;
|
||||||
UttImpSg pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg False} ;
|
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg False} ;
|
||||||
UttImpPl pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Pl False} ;
|
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False} ;
|
||||||
UttImpPol pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg True} ;
|
UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True} ;
|
||||||
|
|
||||||
UttIP ip = {s = ip.s } ; --- Acc also
|
UttS,
|
||||||
UttIAdv iadv = iadv ;
|
UttIP, --- Acc also
|
||||||
UttNP np = {s = np.s ! Bare} ;
|
UttAdv,
|
||||||
UttVP vp = {s = vp.ad ++ vp.comp ! Ag Sg P3 ++ vp.obj.s ++ vp.inf ++ vp.vComp ! Ag Sg P3 ++ vp.embComp} ;
|
UttIAdv,
|
||||||
UttAdv adv = {s = adv.s } ;
|
UttCard = \ss -> ss ;
|
||||||
UttCN cn = {s = cn.s ! Sg ! Bare };
|
|
||||||
UttCard n = n ;
|
UttNP np = {s = np2str np} ;
|
||||||
|
UttCN cn = {s = cn2str cn};
|
||||||
UttAP ap = {s = ap.s ! Bare} ;
|
UttAP ap = {s = ap.s ! Bare} ;
|
||||||
|
UttVP vp = {s = showVPH VPInf defaultAgr vp} ;
|
||||||
|
|
||||||
|
PConjConj conj = {s = conj.s2} ;
|
||||||
|
|
||||||
|
NoVoc,
|
||||||
NoPConj = {s = []} ;
|
NoPConj = {s = []} ;
|
||||||
PConjConj conj = {s = conj.s2} ; ---
|
VocNP = UttNP ;
|
||||||
|
|
||||||
NoVoc = {s = []} ;
|
|
||||||
VocNP np = {s = np.s ! Bare} ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
|
|||||||
cl.s ! t ! p ! ODir ;
|
cl.s ! t ! p ! ODir ;
|
||||||
-- c = Dir
|
-- c = Dir
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
---- Pied piping: "ت wهعه we رe لْْکنگ". Stranding and empty
|
|
||||||
---- relative are defined in $ExtraHin.gf$ ("تهت we رe لْْکنگ ت",
|
|
||||||
---- "we رe لْْکنگ ت").
|
|
||||||
--
|
--
|
||||||
RelSlash rp slash = {
|
RelSlash rp slash = {
|
||||||
s = \\t,p,o,agr => rp.s ++ slash.c2.s ++ slash.subj ++ slash.vp ! t ! p ! o ;--case t of { ---- AR 18/8/2017 is this the right place of subj?
|
s = \\t,p,o,agr => rp.s ++ slash.c2.s ++ slash.subj ++ slash.vp ! t ! p ! o ;--case t of { ---- AR 18/8/2017 is this the right place of subj?
|
||||||
@@ -42,7 +37,7 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
FunRP p np rp = {
|
FunRP p np rp = {
|
||||||
s = np.s ! Clitic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY
|
s = np.s ! Clitic ++ 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
|
a = RAg np.a
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|||||||
@@ -16,28 +16,41 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
|||||||
|
|
||||||
CardOrd = NCard | NOrd ;
|
CardOrd = NCard | NOrd ;
|
||||||
RAgr = RNoAg | RAg Agr ;
|
RAgr = RNoAg | RAg Agr ;
|
||||||
-- RCase = RC Number Case ;
|
|
||||||
|
|
||||||
CPolarity = CPos
|
|
||||||
| CNeg Bool; -- contracted or not
|
|
||||||
|
|
||||||
oper
|
oper
|
||||||
|
CN : Type = Noun ** {
|
||||||
|
hasAdj : Bool ; -- to get the right form when CN is a predicate
|
||||||
|
compl : Number => Str -- to make possessive suffix attach to the right word
|
||||||
|
-- dep. on Number because of RelCN
|
||||||
|
} ;
|
||||||
|
|
||||||
Compl : Type = {s : Str ; ra : Str ; c : VType} ;
|
NP : Type = {
|
||||||
CN : Type = Noun ** {hasAdj : Bool} ; -- for getting the right form when NP/CN is a predicate
|
s : Mod => Str ; -- NP can appear with a clitic, need to keep Mod open
|
||||||
NP : Type = {s : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
|
a : Agr ;
|
||||||
VPHSlash : Type = VPH ** {c2 : Compl} ;
|
hasAdj : Bool ; -- to get the right form when NP is a predicate
|
||||||
|
compl : Str ; -- to make possessive suffix attach to the right word
|
||||||
|
animacy : Animacy -- to get the right relative pronoun
|
||||||
|
} ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
contrNeg : Bool -> Polarity -> CPolarity = \b,p -> case p of {
|
emptyNP : NP = {
|
||||||
Pos => CPos ;
|
s = \\_ => [] ;
|
||||||
Neg => CNeg b
|
a = defaultAgr ;
|
||||||
|
hasAdj = False ;
|
||||||
|
animacy = Inanimate ;
|
||||||
|
compl = []
|
||||||
|
} ;
|
||||||
|
|
||||||
|
useN : Noun -> CN = \n -> n ** {
|
||||||
|
hasAdj = False ;
|
||||||
|
compl = \\_ => []
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
cpol2pol : CPolarity -> Polarity = \cp -> case cp of {
|
np2str : NP -> Str = \np ->
|
||||||
CPos => Pos ;
|
np.s ! Bare ++ np.compl ;
|
||||||
_ => Neg
|
|
||||||
} ;
|
cn2str : CN -> Str = \cn ->
|
||||||
|
cn.s ! Sg ! Bare ++ cn.compl ! Sg ;
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
--- Verb Phrase
|
--- Verb Phrase
|
||||||
@@ -45,17 +58,24 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
|||||||
|
|
||||||
oper
|
oper
|
||||||
|
|
||||||
VPH : Type = {
|
VPH : Type = {
|
||||||
s : VPHForm => Str ; -- {inf : Str} ;
|
s : VPHForm => Str ;
|
||||||
obj : {s : Str ; a : Agr} ;
|
comp : Agr => Str; -- complements of a verb, agr for e.g. CompCN "I am human/we are humans"
|
||||||
subj : VType ;
|
vComp : Agr => Str; -- when a verb is used as a complement of an auxiliary verb. Unlike ‘comp’ or ‘obj’, this type of complement follows the auxiliary verb.
|
||||||
comp : Agr => Str;
|
obj : Str ; -- object of a verb; so far only used for A ("paint it black")
|
||||||
vComp : Agr => Str;
|
subj : VType ;
|
||||||
inf : Str;
|
ad : Str ;
|
||||||
ad : Str;
|
embComp : Str ; -- when a declarative or interrogative sentence is used as a complement of a verb.
|
||||||
embComp : Str ;
|
wish : Bool ; -- whether a VV has been added
|
||||||
wish : Bool ;
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
showVPH : VPHForm -> Agr -> VPH -> Str = \vf,agr,vp ->
|
||||||
|
vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.s ! vf ++ vp.vComp ! agr ++ vp.embComp ;
|
||||||
|
|
||||||
|
Compl : Type = {s : Str ; ra : Str} ;
|
||||||
|
|
||||||
|
VPHSlash : Type = VPH ** {c2 : Compl} ;
|
||||||
|
|
||||||
param
|
param
|
||||||
|
|
||||||
VPHForm =
|
VPHForm =
|
||||||
@@ -66,6 +86,7 @@ oper
|
|||||||
| VVForm Agr
|
| VVForm Agr
|
||||||
| VPStem1
|
| VPStem1
|
||||||
| VPStem2
|
| VPStem2
|
||||||
|
| VPInf
|
||||||
;
|
;
|
||||||
|
|
||||||
VPHTense =
|
VPHTense =
|
||||||
@@ -81,7 +102,6 @@ oper
|
|||||||
| VRoot1 -- AR 22/3/2018 for mustCl past after Nasrin
|
| VRoot1 -- AR 22/3/2018 for mustCl past after Nasrin
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
VType = VIntrans | VTrans | VTransPost ;
|
VType = VIntrans | VTrans | VTransPost ;
|
||||||
|
|
||||||
VPPTense =
|
VPPTense =
|
||||||
@@ -90,8 +110,6 @@ oper
|
|||||||
|VPFutr Anteriority
|
|VPFutr Anteriority
|
||||||
|VPCond Anteriority ;
|
|VPCond Anteriority ;
|
||||||
oper
|
oper
|
||||||
--s (Vvform (Ag Sg P1)) : بخوانم
|
|
||||||
|
|
||||||
|
|
||||||
predV : Verb -> VPH = \verb -> {
|
predV : Verb -> VPH = \verb -> {
|
||||||
s = \\vh =>
|
s = \\vh =>
|
||||||
@@ -107,100 +125,64 @@ oper
|
|||||||
VVForm agr => verb.s ! Vvform agr ;
|
VVForm agr => verb.s ! Vvform agr ;
|
||||||
VPStem1 => verb.s ! Root1 ;
|
VPStem1 => verb.s ! Root1 ;
|
||||||
VPStem2 => verb.s ! Root2 ;
|
VPStem2 => verb.s ! Root2 ;
|
||||||
|
VPInf => verb.s ! Inf;
|
||||||
VPImp pol n =>verb.s ! Imp pol n };
|
VPImp pol n =>verb.s ! Imp pol n };
|
||||||
obj = {s = [] ; a = defaultAgr} ;
|
|
||||||
subj = VIntrans ;
|
subj = VIntrans ;
|
||||||
inf = verb.s ! Inf;
|
ad,
|
||||||
ad = [];
|
obj,
|
||||||
embComp = [];
|
embComp = [];
|
||||||
wish = False ;
|
wish = False ;
|
||||||
|
comp,
|
||||||
vComp = \\_ => [] ;
|
vComp = \\_ => [] ;
|
||||||
comp = \\_ => []
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb ->
|
predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb ->
|
||||||
predV verb ** {c2 = {s = verb.c1 ; ra = [] ; c = VTrans} } ;
|
predV verb ** {c2 = {s = verb.c1 ; ra = []} } ;
|
||||||
----------------------
|
|
||||||
-- Verb Phrase complimantation
|
|
||||||
------------------------
|
|
||||||
{-
|
|
||||||
insertObject : NP -> VPHSlash -> VPH = \np,vps -> vps ** {
|
|
||||||
-- 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 ;
|
|
||||||
} ;
|
|
||||||
-}
|
|
||||||
insertObjc : (Agr => Str) -> VPHSlash -> VPHSlash = \obj,vp ->
|
|
||||||
insertObj obj vp ** {c2 = vp.c2} ;
|
|
||||||
insertVVc : (Agr => Str) -> VPHSlash -> VPHSlash = \obj,vp ->
|
|
||||||
insertVV obj vp ** {c2 = vp.c2} ;
|
|
||||||
|
|
||||||
{-
|
|
||||||
insertSubj : Person -> Str -> Str = \p,s ->
|
|
||||||
case p of { Pers1 => s ++ "wN" ; _ => s ++ "E"};
|
---------------------
|
||||||
-}
|
-- VP complementation
|
||||||
insertObj : (Agr => Str) -> VPH -> VPH = \obj1,vp -> vp ** {
|
---------------------
|
||||||
comp = \\a => vp.comp ! a ++ obj1 ! a
|
appComp : Compl -> Str -> Str = \c2,obj ->
|
||||||
} ;
|
c2.s ++ obj ++ c2.ra ;
|
||||||
|
|
||||||
|
insertComp : (Agr => Str) -> VPH -> VPH = \obj,vp -> vp ** {
|
||||||
|
comp = \\a => vp.comp ! a ++ obj ! a
|
||||||
|
} ;
|
||||||
|
|
||||||
|
insertCompPre : (Agr=>Str) -> VPHSlash -> VPH = \obj,vp -> vp ** {
|
||||||
|
comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a
|
||||||
|
} ;
|
||||||
|
|
||||||
insertVV : (Agr => Str) -> VPH -> VPH = \obj1,vp -> vp ** {
|
insertVV : (Agr => Str) -> VPH -> VPH = \obj1,vp -> vp ** {
|
||||||
wish = True ;
|
wish = True ;
|
||||||
-- vComp = \\a => vp.comp ! a ++ conjThat ++ obj1 ! a ; -- TODO: do we insert conjThat here or in infVV? /IL
|
vComp = \\a => vp.comp ! a ++ obj1 ! a ; -- IL why this is vp.comp and not vp.vComp??
|
||||||
vComp = \\a => vp.comp ! a ++ obj1 ! a ;
|
} ;
|
||||||
|
|
||||||
|
embComp : Str -> VPH -> VPH = \str,vp -> vp ** {
|
||||||
|
embComp = vp.embComp ++ str ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
insertObj : Str -> VPH -> VPH = \str,vp -> vp ** {
|
||||||
|
obj = vp.obj ++ str
|
||||||
|
} ;
|
||||||
|
|
||||||
|
complSlash : VPHSlash -> NP -> VPH = \vp,np -> vp ** {
|
||||||
|
comp = \\a => appComp vp.c2 (np.s ! Bare) ++ np.compl ++ vp.comp ! a
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
insertObj2 : (Str) -> VPH -> VPH = \obj1,vp -> vp ** {
|
|
||||||
embComp = vp.embComp ++ obj1;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
insertObj3 : (Str) -> VPH -> VPH = \obj1,vp -> vp ** {
|
|
||||||
obj = {s = obj1 ++ vp.obj.s ; a = vp.obj.a };
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
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 ;
|
|
||||||
-}
|
|
||||||
|
|
||||||
---- AR 14/9/2017 trying to fix isAux = True case by inserting conjThat
|
---- AR 14/9/2017 trying to fix isAux = True case by inserting conjThat
|
||||||
---- but don't know yet how False should be affect
|
---- but don't know yet how False should be affect
|
||||||
infVV : Bool -> VPH -> {s : Agr => Str} = \isAux,vp -> {
|
infVV : Bool -> VPH -> (Agr => Str) = \isAux,vp ->
|
||||||
s = \\agr => case isAux of {
|
\\agr => if_then_Str isAux conjThat [] ++ showVPH (VVForm agr) agr vp ;
|
||||||
True => conjThat ++ vp.ad ++ vp.comp ! agr ++ vp.s ! VVForm agr ;
|
|
||||||
False => vp.ad ++ vp.comp ! agr ++ vp.s ! VVForm agr }
|
|
||||||
} ;
|
|
||||||
|
|
||||||
insertObjPre : (Agr => Str) -> VPHSlash -> VPH = \obj,vp -> vp ** {
|
insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** {
|
||||||
-- 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
|
ad = vp.ad ++ ad ;
|
||||||
comp = \\a => vp.c2.s ++ obj ! a ++ vp.c2.ra ++ vp.comp ! a
|
} ;
|
||||||
} ;
|
|
||||||
|
|
||||||
insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** {
|
conjThat : Str = "که" ;
|
||||||
ad = vp.ad ++ ad ;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
conjThat : Str = "که" ;
|
|
||||||
{- checkPron : NP -> Str -> Str = \np,str -> case (np.isPron) of {
|
|
||||||
True => np.s ! Obl;
|
|
||||||
False => np.s ! Obl ++ str} ;
|
|
||||||
|
|
||||||
insertEmbCompl : VPH -> Str -> VPH = \vp,emb -> vp ** {
|
|
||||||
embComp = vp.embComp ++ emb;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
insertTrans : VPH -> VType -> VPH = \vp,vtype -> vp ** {
|
|
||||||
subj = case vtype of {VIntrans => VTransPost ; VTrans => VTrans ; _ => vtype} ; -- still some problem not working properly
|
|
||||||
} ;
|
|
||||||
-}
|
|
||||||
---------------------------
|
---------------------------
|
||||||
--- Clauses
|
--- Clauses
|
||||||
---------------------------
|
---------------------------
|
||||||
@@ -250,7 +232,7 @@ oper
|
|||||||
subj = np.s ! Bare ;
|
subj = np.s ! Bare ;
|
||||||
vp = \\vt,b,ord =>
|
vp = \\vt,b,ord =>
|
||||||
let vps = clTable vp ! np.a ! vt ! b
|
let vps = clTable vp ! np.a ! vt ! b
|
||||||
in vp.ad ++ vp.comp ! np.a ++ vp.obj.s ++ vps ++ vp.vComp ! np.a ++ vp.embComp
|
in vp.ad ++ vp.comp ! np.a ++ vp.obj ++ vps ++ vp.vComp ! np.a ++ vp.embComp
|
||||||
};
|
};
|
||||||
|
|
||||||
--Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
|
--Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
|
||||||
@@ -258,9 +240,19 @@ oper
|
|||||||
s = \\vt,b,ord =>
|
s = \\vt,b,ord =>
|
||||||
let vps = clTable vp ! agr ! vt ! b ;
|
let vps = clTable vp ! agr ! vt ! b ;
|
||||||
quest = case ord of { ODir => [] ; OQuest => "آیا" }
|
quest = case ord of { ODir => [] ; OQuest => "آیا" }
|
||||||
in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vps ++ vp.vComp ! agr ++ vp.embComp
|
in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vps ++ vp.vComp ! agr ++ vp.embComp
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ta2vt : Tense -> Anteriority -> VPHTense = \t,a -> case <t,a> of {
|
||||||
|
<Pres,Simul> => VPres ;
|
||||||
|
<Pres,Anter> => VPerfPres ;
|
||||||
|
<Past,Simul> => VPast ;
|
||||||
|
<Past,Anter> => VPerfPast ;
|
||||||
|
<Fut,Simul> => VFut ;
|
||||||
|
<Fut,Anter> => VPerfFut ;
|
||||||
|
<Cond,Simul> => VCondSimul ;
|
||||||
|
<Cond,Anter> => VCondSimul } ;
|
||||||
|
|
||||||
predAux : Aux -> VPH = \verb -> {
|
predAux : Aux -> VPH = \verb -> {
|
||||||
s = \\vh => case vh of {
|
s = \\vh => case vh of {
|
||||||
VPTense pol (VPPres Simul) agr => verb.inf ! AX pol (AuxPresent PrImperf) agr ;
|
VPTense pol (VPPres Simul) agr => verb.inf ! AX pol (AuxPresent PrImperf) agr ;
|
||||||
@@ -274,12 +266,11 @@ oper
|
|||||||
VVForm agr => []; -- to be checked => verb.s ! Vvform agr ;
|
VVForm agr => []; -- to be checked => verb.s ! Vvform agr ;
|
||||||
VPStem1 => [];
|
VPStem1 => [];
|
||||||
VPStem2 => "بود" ;
|
VPStem2 => "بود" ;
|
||||||
|
VPInf => "بودن";
|
||||||
VPImp _ _ => [] -- need to be confirmed
|
VPImp _ _ => [] -- need to be confirmed
|
||||||
-- _ => []
|
|
||||||
};
|
};
|
||||||
obj = {s = [] ; a = defaultAgr} ;
|
obj = [] ;
|
||||||
subj = VIntrans ;
|
subj = VIntrans ;
|
||||||
inf = "بودن";
|
|
||||||
ad = [];
|
ad = [];
|
||||||
embComp = [];
|
embComp = [];
|
||||||
wish = False ;
|
wish = False ;
|
||||||
@@ -360,16 +351,8 @@ taryn = "ترین" ;
|
|||||||
-----------------------------
|
-----------------------------
|
||||||
-- Noun Phrase
|
-- Noun Phrase
|
||||||
-----------------------------
|
-----------------------------
|
||||||
{-toNP : Str -> Str = \pn, -> case of {
|
|
||||||
c => pn ! c ;
|
|
||||||
NPObj => pn ! Dir ;
|
|
||||||
NPErg => pn ! Obl
|
|
||||||
} ;
|
|
||||||
-}
|
|
||||||
|
|
||||||
partNP : Str -> Str = \str -> (Prelude.glue str "ه") ++ "شده" ;
|
partNP : Str -> Str = \str -> (Prelude.glue str "ه") ++ "شده" ;
|
||||||
-- partNP : Str -> Str = \str -> str + "ه" ++ "شده" ;
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
-- Reflexive Pronouns
|
-- Reflexive Pronouns
|
||||||
@@ -393,5 +376,4 @@ taryn = "ترین" ;
|
|||||||
<Inanimate,Pl> => zwnj "آن" "ها"
|
<Inanimate,Pl> => zwnj "آن" "ها"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,15 +7,14 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
|||||||
|
|
||||||
PredVP np vp = mkClause np vp ;
|
PredVP np vp = mkClause np vp ;
|
||||||
|
|
||||||
PredSCVP sc vp = mkSClause ("این" ++ sc.s) (defaultAgr) vp ;
|
PredSCVP sc vp = mkSClause ("این" ++ sc.s) defaultAgr vp ;
|
||||||
|
|
||||||
ImpVP vp = {
|
ImpVP vp = {
|
||||||
s = \\cpol,n =>
|
s = \\pol,n =>
|
||||||
let agr = Ag (numImp n) P2 ;
|
let agr = Ag (numImp n) P2 ;
|
||||||
pol = cpol2pol cpol ;
|
|
||||||
in case vp.wish of {
|
in case vp.wish of {
|
||||||
True => vp.s ! VPImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ vp.embComp;
|
True => vp.s ! VPImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.embComp;
|
||||||
False => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ vp.s ! VPImp pol (numImp n) ++ vp.embComp }
|
False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.s ! VPImp pol (numImp n) ++ vp.embComp }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@@ -29,74 +28,34 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
|||||||
SlashPrep cl prep = {
|
SlashPrep cl prep = {
|
||||||
subj = [] ; ---- AR 18/9/2017 this can destroy SOV ; Cl should be made discont
|
subj = [] ; ---- AR 18/9/2017 this can destroy SOV ; Cl should be made discont
|
||||||
vp = cl.s ;
|
vp = cl.s ;
|
||||||
c2 = { s = prep.s ; ra = [] ; c = VIntrans}
|
c2 = prep ** {ra = []}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
SlashVS np vs slash =
|
SlashVS np vs slash =
|
||||||
mkSlClause np
|
mkSlClause np
|
||||||
(insertObj2 (conjThat ++ slash.s) (predV vs)) **
|
(embComp (conjThat ++ slash.s) (predV vs)) **
|
||||||
{c2 = slash.c2} ;
|
{c2 = slash.c2} ;
|
||||||
|
|
||||||
EmbedS s = {s = conjThat ++ s.s} ;
|
EmbedS s = {s = conjThat ++ s.s} ;
|
||||||
EmbedQS qs = {s = qs.s ! QIndir} ;
|
EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||||
EmbedVP vp = {s = vp.obj.s ++ vp.inf ++ vp.comp ! defaultAgr} ; --- agr
|
EmbedVP vp = {s = showVPH VPInf defaultAgr vp} ; --- agr
|
||||||
|
|
||||||
|
|
||||||
UseCl temp p cl =
|
UseCl temp p cl = let vt = ta2vt temp.t temp.a in {
|
||||||
{ s = case <temp.t,temp.a> of {
|
s = temp.s ++ p.s ++ cl.s ! vt ! p.p ! ODir
|
||||||
<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 qcl = let vt = ta2vt temp.t temp.a in {
|
||||||
} ;
|
s = \\q => temp.s ++ p.s ++ qcl.s ! vt ! p.p ! q;
|
||||||
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 = let vt = ta2vt temp.t temp.a in rcl ** {
|
||||||
} ;
|
s = \\q => temp.s ++ p.s ++ rcl.s ! vt ! p.p ! ODir ! q
|
||||||
|
} ;
|
||||||
|
|
||||||
UseRCl temp p rcl = {
|
UseSlash temp p cls = let vt = ta2vt temp.t temp.a in cls ** {
|
||||||
s = \\q => case <temp.t,temp.a> of {
|
s = temp.s ++ p.s ++ cls.subj ++ cls.vp ! vt ! p.p ! ODir
|
||||||
<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 = temp.s ++ p.s ++ clslash.subj ++
|
|
||||||
case <temp.t,temp.a> of {
|
|
||||||
<Pres,Simul> => clslash.vp ! VPres ! p.p ! ODir;
|
|
||||||
<Pres,Anter> => clslash.vp ! VPerfPres ! p.p ! ODir;
|
|
||||||
<Past,Simul> => clslash.vp ! VPast ! p.p ! ODir ;
|
|
||||||
<Past,Anter> => clslash.vp ! VPerfPast ! p.p ! ODir;
|
|
||||||
<Fut,Simul> => clslash.vp ! VFut ! p.p ! ODir;
|
|
||||||
<Fut,Anter> => clslash.vp ! VPerfFut ! p.p ! ODir;
|
|
||||||
<Cond,Simul> => clslash.vp ! VCondSimul ! p.p ! ODir;
|
|
||||||
<Cond,Anter> => clslash.vp ! VCondSimul ! p.p ! ODir
|
|
||||||
};
|
|
||||||
c2 = clslash.c2
|
|
||||||
} ;
|
|
||||||
|
|
||||||
AdvS a s = {s = a.s ++ s.s} ;
|
AdvS a s = {s = a.s ++ s.s} ;
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,18 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in {
|
|||||||
NumPN i = {s = i.s ; animacy = Inanimate} ;
|
NumPN i = {s = i.s ; animacy = Inanimate} ;
|
||||||
CNIntNP cn i = cn ** {
|
CNIntNP cn i = cn ** {
|
||||||
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
|
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
|
||||||
a = agrP3 Sg
|
a = agrP3 Sg ;
|
||||||
|
compl = cn.compl ! Sg
|
||||||
} ;
|
} ;
|
||||||
CNSymbNP det cn xs = cn ** {
|
CNSymbNP det cn xs = cn ** {
|
||||||
s = \\ez => det.s ++ cn.s ! det.n ! Ezafe ++ xs.s ;
|
s = \\ez => det.s ++ cn.s ! det.n ! Ezafe ++ xs.s ;
|
||||||
a = agrP3 det.n
|
a = agrP3 det.n ;
|
||||||
|
compl = cn.compl ! det.n
|
||||||
} ;
|
} ;
|
||||||
CNNumNP cn i = cn ** {
|
CNNumNP cn i = cn ** {
|
||||||
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
|
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
|
||||||
a = agrP3 Sg
|
a = agrP3 Sg ;
|
||||||
|
compl = cn.compl ! Sg
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
SymbS sy = sy ;
|
SymbS sy = sy ;
|
||||||
|
|||||||
@@ -4,43 +4,42 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
|
|||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
UseV v = predV v ;
|
UseV v = predV v ;
|
||||||
SlashV2a v = predV v ** {c2 = {s = v.c2.s ; ra = v.c2.ra ; c = VTrans}} ;
|
SlashV2a v = v ** predV v;
|
||||||
Slash2V3 v np =
|
Slash2V3 v np = {c2 = v.c3} **
|
||||||
insertObjc (\\_ => np.s ! Bare ++ v.c2 ) (predV v ** {c2 = {s = [] ; ra = v.c3 ; c = VTrans}}) ;
|
complSlash (predV v ** {c2 = v.c2}) np ;
|
||||||
|
|
||||||
Slash3V3 v np =
|
Slash3V3 v np = {c2 = v.c2} **
|
||||||
insertObjc (\\_ => v.c3 ++ np.s ! Bare) (predV v ** {c2 = {s = [] ; ra = v.c2 ; c = VTrans}}) ;
|
complSlash (predV v ** {c2 = v.c3}) np ;
|
||||||
|
|
||||||
ComplVV v vp = insertVV (infVV v.isAux vp).s (predV v) ;
|
ComplSlash = complSlash ;
|
||||||
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 ! Bare) (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}}) ;
|
ComplVV v vp = insertVV (infVV v.isAux vp) (predV v) ;
|
||||||
SlashV2Q v q = insertObjc2 ( q.s ! QIndir) (predV v ** {c2 = {s = v.c2.s ; ra = [] ;c = VTransPost}}) ;
|
ComplVS v s = embComp (conjThat ++ s.s) (predV v) ;
|
||||||
SlashV2A v ap = insertObjc3 ( ap.s ! Bare) (predV v ** {c2 = {s = [] ; ra = v.c2.ra ;c = VTransPost}}) ; ---- paint it red , check form of adjective
|
ComplVQ v q = embComp (conjThat ++ q.s ! QIndir) (predV v) ;
|
||||||
|
ComplVA v ap = insertObj (ap.s ! Bare) (predV v) ; -- check form of adjective
|
||||||
|
SlashV2V v vp = insertVV (infVV v.isAux vp) (predV v) **{c2 = {s = v.c1 ; ra = []}} ;
|
||||||
|
|
||||||
ComplSlash vp np = insertObjPre (\\_ => np.s ! Bare ) vp ;
|
SlashV2S v s = v ** embComp (conjThat ++ s.s) (predV v) ;
|
||||||
SlashVV vv vp =
|
SlashV2Q v q = v ** embComp (q.s ! QIndir) (predV v) ;
|
||||||
-- insertObj (infVV vv.isAux vp).s (predV vv) **
|
SlashV2A v ap = v ** insertObj (ap.s ! Bare) (predV v) ; ---- paint it red , check form of adjective
|
||||||
insertVV (infVV vv.isAux vp).s (predV vv) **
|
|
||||||
{c2 = vp.c2} ;
|
|
||||||
SlashV2VNP vv np vp =
|
|
||||||
insertObjPre (\\_ => np.s ! Bare )
|
|
||||||
-- (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) ;
|
SlashVV vv vps = vps ** insertVV (infVV vv.isAux vps) (predV vv) ;
|
||||||
|
|
||||||
|
SlashV2VNP v2v np vps =
|
||||||
|
let vvVP : VPH = insertVV (infVV v2v.isAux vps) (predV v2v) ;
|
||||||
|
vvVPS = vvVP ** {c2={s=v2v.c1 ; ra=v2v.c2}} ; -- TODO find out if it's a general rule; only one V2V in the lexicon /IL
|
||||||
|
in complSlash vvVPS np ** {c2 = vps.c2} ;
|
||||||
|
|
||||||
|
|
||||||
|
UseComp comp = insertComp comp.s (predAux auxBe) ;
|
||||||
|
|
||||||
AdvVP vp adv = insertAdV adv.s vp ;
|
AdvVP vp adv = insertAdV adv.s vp ;
|
||||||
|
|
||||||
AdVVP adv vp = insertAdV adv.s vp ;
|
AdVVP adv vp = insertAdV adv.s vp ;
|
||||||
ReflVP v = insertObjPre (\\a => reflPron ! a) v ;
|
ReflVP v = insertCompPre reflPron v ;
|
||||||
PassV2 v = predV v ; -- need to be fixed
|
PassV2 v = predV v ; -- need to be fixed
|
||||||
CompAP ap ={s = \\_ => ap.s ! Bare} ; -- check form of adjective
|
CompAP ap = {s = \\_ => ap.s ! Bare} ; -- check form of adjective
|
||||||
CompAdv adv = {s = \\_ => adv.s } ;
|
CompAdv adv = {s = \\_ => adv.s } ;
|
||||||
|
|
||||||
-- see https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/
|
-- see https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/
|
||||||
@@ -49,7 +48,6 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
|
|||||||
! case cn.hasAdj of {
|
! case cn.hasAdj of {
|
||||||
False => Bare ;
|
False => Bare ;
|
||||||
True => Clitic }
|
True => Clitic }
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
CompNP np = {
|
CompNP np = {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
|
|||||||
|
|
||||||
ExistNP np =
|
ExistNP np =
|
||||||
mkSClause " " (agrPesP3 (fromAgr np.a).n)
|
mkSClause " " (agrPesP3 (fromAgr np.a).n)
|
||||||
(insertObj (\\_ => np.s ! Bare) (predAux auxBe)) ;
|
(insertComp (\\_ => np.s ! Bare) (predAux auxBe)) ;
|
||||||
|
|
||||||
ExistIP ip =
|
ExistIP ip =
|
||||||
let cl = mkSClause ( ip.s ) (agrPesP3 ip.n) (predAux auxBe);
|
let cl = mkSClause ( ip.s ) (agrPesP3 ip.n) (predAux auxBe);
|
||||||
@@ -28,7 +28,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
-- 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 = insertComp (\\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) ;
|
ProgrVP vp = (predProg vp) ;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
-}
|
-}
|
||||||
insertObjc : (AgrPes => Str) -> VPHSlash -> VPHSlash = \obj,vp ->
|
insertObjc : (AgrPes => Str) -> VPHSlash -> VPHSlash = \obj,vp ->
|
||||||
insertObj obj vp ** {c2 = vp.c2} ;
|
insertComp obj vp ** {c2 = vp.c2} ;
|
||||||
insertVVc : (AgrPes => Str) -> VPHSlash -> VPHSlash = \obj,vp ->
|
insertVVc : (AgrPes => Str) -> VPHSlash -> VPHSlash = \obj,vp ->
|
||||||
insertVV obj vp ** {c2 = vp.c2} ;
|
insertVV obj vp ** {c2 = vp.c2} ;
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ oper
|
|||||||
insertSubj : PPerson -> Str -> Str = \p,s ->
|
insertSubj : PPerson -> Str -> Str = \p,s ->
|
||||||
case p of { Pers1 => s ++ "wN" ; _ => s ++ "E"};
|
case p of { Pers1 => s ++ "wN" ; _ => s ++ "E"};
|
||||||
-}
|
-}
|
||||||
insertObj : (AgrPes => Str) -> VPH -> VPH = \obj1,vp -> {
|
insertComp : (AgrPes => Str) -> VPH -> VPH = \obj1,vp -> {
|
||||||
s = vp.s ;
|
s = vp.s ;
|
||||||
obj = vp.obj ;
|
obj = vp.obj ;
|
||||||
subj = vp.subj ;
|
subj = vp.subj ;
|
||||||
@@ -195,7 +195,7 @@ oper
|
|||||||
comp = vp.comp
|
comp = vp.comp
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
insertObj2 : (Str) -> VPH -> VPH = \obj1,vp -> {
|
embComp : (Str) -> VPH -> VPH = \obj1,vp -> {
|
||||||
s = vp.s;
|
s = vp.s;
|
||||||
obj = vp.obj ;
|
obj = vp.obj ;
|
||||||
subj = vp.subj ;
|
subj = vp.subj ;
|
||||||
@@ -221,8 +221,8 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
insertObjc2 : Str -> VPHSlash -> VPHSlash = \obj,vp ->
|
embCompSlash : Str -> VPHSlash -> VPHSlash = \obj,vp ->
|
||||||
insertObj2 obj vp ** {c2 = vp.c2} ;
|
embComp obj vp ** {c2 = vp.c2} ;
|
||||||
insertObjc3 : Str -> VPHSlash -> VPHSlash = \obj,vp ->
|
insertObjc3 : Str -> VPHSlash -> VPHSlash = \obj,vp ->
|
||||||
insertObj3 obj vp ** {c2 = vp.c2} ;
|
insertObj3 obj vp ** {c2 = vp.c2} ;
|
||||||
{-
|
{-
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
|||||||
|
|
||||||
SlashVS np vs slash =
|
SlashVS np vs slash =
|
||||||
mkClause np
|
mkClause np
|
||||||
(insertObj2 (conjThat ++ slash.s) (predV vs)) **
|
(embComp (conjThat ++ slash.s) (predV vs)) **
|
||||||
{c2 = slash.c2} ;
|
{c2 = slash.c2} ;
|
||||||
|
|
||||||
EmbedS s = {s = conjThat ++ s.s} ;
|
EmbedS s = {s = conjThat ++ s.s} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user