1
0
forked from GitHub/gf-rgl

Merge pull request #183 from inariksit/persian-nasrin

(Pes) Add possessive suffixes + cleanup
This commit is contained in:
Inari Listenmaa
2019-02-21 08:35:52 +01:00
committed by GitHub
26 changed files with 192 additions and 173 deletions

View File

@@ -7,14 +7,14 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseComparA a = a;
ComparA a np = {
s =\\ez => a.s ! ez ++ "تر" ++ "از" ++ np.s ! NPC bEzafa ;
s =\\ez => a.s ! ez ++ "تر" ++ "از" ++ np.s ! Bare ;
adv = a.adv
} ;
---- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s =\\ez => np.s ! NPC bEzafa ++ a.c2 ++ a.s ! ez ;
s =\\ez => np.s ! Bare ++ a.c2 ++ a.s ! ez ;
adv = a.adv
} ;
@@ -34,15 +34,15 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
} ;
UseA2 a = a ;
CAdvAP cadv ap np = {
s =\\ez => cadv.s ++ np.s ! NPC bEzafa ++ ap.s ! ez ;
s =\\ez => cadv.s ++ np.s ! Bare ++ 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

@@ -2,16 +2,16 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in {
flags coding = utf8;
lin
-- PositAdvAdj a = {s = a.s ! bEzafa } ;
-- PositAdvAdj a = {s = a.s ! Bare } ;
PositAdvAdj a = {s = a.adv } ;
ComparAdvAdj cadv a np = {
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! NPC bEzafa ;
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! Bare ;
} ;
ComparAdvAdjS cadv a s = {
s = a.adv ++ cadv.p ++ cadv.s ++ s.s;
} ;
PrepNP prep np = {s = prep.s ++ np.s ! NPC bEzafa } ;
PrepNP prep np = {s = prep.s ++ np.s ! Bare } ;
AdAdv ada adv = { s = ada.s ++ adv.s} ;

View File

@@ -62,7 +62,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
Num = {s : Str ; n : Number ; isNum : Bool} ;
Card = {s : Str; n : Number} ;
Ord = {s : Str; n : Number ; isNum : Bool} ;
Quant = {s: Number => Str ; a:Agr ; fromPron : Bool};
Quant = {s: Number => Str ; a:Agr ; mod : Mod};
Art = {s : Str} ;
---- Numeral

View File

@@ -12,12 +12,12 @@ concrete ConjunctionPes of Conjunction =
ConjAdv = conjunctDistrSS ;
-- ConjAdv conj advs = conjunctDistrTable Gender conj advs ;
ConjNP conj ss = ss ** conjunctDistrTable NPCase conj ss ** {
ConjNP conj ss = ss ** conjunctDistrTable Mod conj ss ** {
a = conjAgr (agrP3 conj.n) ss.a ;
animacy = ss.animacy ;
} ;
ConjAP conj ss = conjunctDistrTable Ezafa conj ss ** {adv = ss.adv};
ConjAP conj ss = conjunctDistrTable Mod conj ss ** {adv = ss.adv};
ConjRS conj rs = conjunctDistrTable Agr conj rs ** { c = rs.c};
---- These fun's are generated from the list cat's.
@@ -28,19 +28,19 @@ concrete ConjunctionPes of Conjunction =
-- BaseAdv x y = twoTable Gender x y ;
ConsAdv = consrSS comma ;
-- ConsAdv xs x = consrTable Gender comma xs x ;
BaseNP x y = y ** twoTable NPCase x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy
BaseNP x y = y ** twoTable Mod x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy
BaseRS x y = twoTable Agr x y ** {c = x.c};
ConsNP xs x = xs ** consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ;
ConsNP xs x = xs ** consrTable Mod comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ;
ConsRS xs x = consrTable Agr 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} ;
BaseAP x y = twoTable Mod x y ** {adv = x.adv};
ConsAP xs x = consrTable Mod 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 : Agr ; animacy : Animacy ; hasAdj : Bool} ;
[AP] = {s1,s2 : Ezafa => Str ; adv : Str} ;
[NP] = {s1,s2 : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
[AP] = {s1,s2 : Mod => Str ; adv : Str} ;
[RS] = {s1,s2 : Agr => Str };
}

View File

@@ -52,10 +52,19 @@ lin
InLanguage l = S.mkAdv in_Prep (mkNP l) ;
-- arabic_Language,
english_Language = mkLanguage "انگلیسی" ;
finnish_Language = mkLanguage "فنلاند" ;
swedish_Language = mkLanguage "سوئدی" ;
arabicLanguage = mkLanguage "عربی" ;
finnishLanguage = mkLanguage "فنلاندی" ;
frenchLanguage = mkLanguage "فرانسوی" ;
persianLanguage = mkLanguage "فارسی" ;
romanianLanguage = mkLanguage "رومانیایی" ;
polishLanguage = mkLanguage "لهستانی" ;
bulgarianLanguage = mkLanguage "بلغاری" ;
somaliLanguage = mkLanguage "سومالیایی" ;
turkishLanguage = mkLanguage "ترکی" ;
kurdishLanguage = mkLanguage "کردی" ;
-- : Card -> CN -> A -> AP
n_units_AP card cn a =

View File

@@ -9,9 +9,9 @@ concrete ExtendPes of Extend =
lin
-- NP -> Quant ; -- this man's
GenNP np = np ** {
s = \\num => np.s ! NPC bEzafa ; -- the possessed will get aEzafa, possesser is just unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/
fromPron = True -- not necessarily from Pron, but it should come after the noun, and if fromPron=True, then DetCN places determiner after cn.
GenNP np = np ** {
mod = Ezafe ; -- the possessed will get Ezafe
s = \\num => np.s ! Bare -- possesser is unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/
} ;
}
}

View File

@@ -1,19 +1,19 @@
concrete ExtraPes of ExtraPesAbs = CatPes **
concrete ExtraPes of ExtraPesAbs = CatPes **
open ResPes, Coordination, Prelude, MorphoPes, ParadigmsPes in {
flags coding = utf8;
lin
GenNP np = {s = \\_ => np.s ! NPC aEzafa ; a = np.a ; fromPron = True} ; -- changed from fromPron=False for Phrasebook
GenNP np = {s = \\_ => np.s ! Ezafe ; a = np.a ; mod = Ezafe} ; -- changed from mod=False for Phrasebook
-- each_Det = mkDet "هر کwی" "هر کwی" "هر کwی" "هر کwی" Sg ;
-- have_V = mkV "رکh-ن";
IAdvAdv adv = {s = "تا چه" ++ adv.s} ;
-- ICompAP ap = {s = "کتنE" ++ ap.s ! Sg ! Masc ! Dir ! Posit} ;
-- cost_V = mkV "قیمت" ;
-- added for causitives
-- make_CV = mkVerb "نْتهنگ" ** {c2 = "" };
-- for VP conjunction
}
}

View File

@@ -9,7 +9,7 @@ lin
GenericCl vp = mkSClause "آدم" (agrP3 Sg) vp ;
CleftNP np rs =
let cl = mkSClause (np.s ! NPC bEzafa) (np.a) (predAux auxBe);
let cl = mkSClause (np.s ! Bare) (np.a) (predAux auxBe);
in
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a };
@@ -17,7 +17,7 @@ lin
ExistNP np =
mkSClause " " (agrP3 (fromAgr np.a).n)
(insertObj (\\_ => np.s ! NPC bEzafa) (predAux auxBe)) ;
(insertObj (\\_ => np.s ! Bare) (predAux auxBe)) ;
ExistIP ip =
let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predAux auxBe);
@@ -32,7 +32,7 @@ lin
ProgrVP vp = predProg vp ;
ImpPl1 vp = {s = "بیایید" ++ vp.s ! VVForm (agrP1 Pl)} ;
ImpP3 np vp = {s = "بگذارید" ++ np.s!NPC bEzafa ++ vp.s ! VVForm np.a};
ImpP3 np vp = {s = "بگذارید" ++ np.s!Bare ++ vp.s ! VVForm np.a};
}

View File

@@ -24,7 +24,7 @@ oper
---- Nouns
param
Animacy = Animate | Inanimate ;
Ezafa = bEzafa | aEzafa | enClic ;
Mod = Bare | Ezafe | Clitic | Poss ;
Agr = Ag Number Person ;
------------------------------------------
@@ -50,12 +50,25 @@ oper
agrP1 : Number -> Agr = \n -> Ag n P1 ;
-------------------------
-- Ezafa construction
-- Ezafe construction
------------------------
oper
mkEzafa : Str -> Str = \str ->
--let kasre = "ِ" in -- TODO: Eventually use this
mkPossStem : Str -> Str = \str ->
case str of {
_+ "اه" => str ;
_+ "او" => str ;
_+ "وه" => str ;
_+ ("ا"|"و") => str + "ی" ;
_+ "ه" => zwnj str "ا" ;
_ => str } ;
mkEzafe : Str -> Str = \str ->
--let kasre = "ِ" in -- TODO: Eventually use this
let kasre = "" in
case str of {
st + "اه" => str + kasre ;
@@ -71,28 +84,25 @@ oper
mkEnclic : Str -> Str ;
mkEnclic str = case str of {
st + ("ا"|"و") => zwnj str "یی" ; -- ی after a long vowel to help pronunciation
st + "اه" => zwnj str "ی" ; -- here ه is a consonant, so single ی
-- st + "اه" => str + "ی" ; -- old version, no ZWNJ
st + "اه" => str + "ی" ; -- here ه is a consonant, so single ی
st + ("ی"|"ه") => zwnj str "ای" ; -- after ی or ه as a vowel, add an alif to help pronunciation
_ => str + "ی" -- any other case: just a single ی
} ;
Noun = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool } ;
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
} ;
Noun = {s : Number => Mod => Str ; animacy : Animacy} ;
mkN : (x1,x2 : Str) -> Animacy -> Noun = \sg,pl,ani -> {
s = table {
Sg => table {Bare => sg ;
Ezafe => mkEzafe sg ;
Clitic => mkEnclic sg ;
Poss => mkPossStem sg } ;
Pl => table {Bare => pl ;
Ezafe => mkEzafe pl ;
Clitic => mkEnclic pl ;
Poss => mkPossStem pl }
} ;
animacy = ani
} ;
-- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e)
-- Arabic nouns ends with h. also taken as Masc
@@ -100,29 +110,30 @@ oper
---------------------
--Determiners
--------------------
Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; fromPron : Bool} ;
Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; mod : Mod} ;
makeDet : Str -> Number -> Bool -> Determiner = \str,n,b -> {
s = str;
isNum = b;
fromPron = False ;
mod = Bare ;
n = n
};
makeQuant : Str -> Str -> {s : Number => Str ; a : Agr; fromPron : Bool } = \sg,pl -> {
makeQuant : Str -> Str -> {s : Number => Str ; a : Agr; mod : Mod } = \sg,pl -> {
s = table {Sg => sg ; Pl => pl} ;
fromPron = False ;
mod = Bare ;
a = agrP3 Sg
};
---------------------------
-- Adjectives
--------------------------
Adjective : Type = {s : Ezafa => Str ; adv : Str} ;
Adjective : Type = {s : Mod => Str ; adv : Str} ;
mkAdj : Str -> Str -> Adjective = \adj,adv -> {
s = table { bEzafa => adj;
aEzafa => mkEzafa adj ;
enClic => mkEnclic adj
s = table { Bare => adj;
Ezafe => mkEzafe adj ;
Clitic => mkEnclic adj ;
Poss => mkPossStem adj
} ;
adv = adv
};

View File

@@ -3,12 +3,12 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
flags optimize=all_subs ;
lin
DetCN det cn = cn ** {s = \\npc =>
case <det.isNum,det.fromPron,npc> of {
<False,False,NPC ez> => det.s ++ cn.s ! ez ! det.n ; -- det is not from Pron, retain NPForm.
<False,True> => cn.s ! aEzafa ! det.n ++ det.s ; -- det is from Pron, cn is in aEzafa.
<True,False,NPC ez> => det.s ++ cn.s ! ez ! Sg ; -- noun modified by a number is invariably singular
<True,True> => cn.s ! aEzafa ! Sg ++ det.s
DetCN det cn = cn ** {s = \\mod =>
case <det.isNum,det.mod> of {
<False,Bare> => det.s ++ cn.s ! det.n ! mod ; -- det is not from Pron, retain NPForm.
<False,X> => cn.s ! det.n ! X ++ det.s ; -- det is from Pron, cn is in Ezafe.
<True,Bare> => det.s ++ cn.s ! Sg ! mod ; -- noun modified by a number is invariably singular
<True,X> => cn.s ! Sg ! X ++ det.s
} ;
a = agrP3 det.n ;
} ;
@@ -29,20 +29,20 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
} ;
AdvNP np adv = np ** {
s = \\ez => np.s ! NPC aEzafa ++ adv.s
s = \\ez => np.s ! Ezafe ++ adv.s
} ;
DetQuantOrd quant num ord = {
s = quant.s ! num.n ++ num.s ++ ord.s ;
isNum = orB num.isNum ord.isNum ;
fromPron = quant.fromPron ;
mod = quant.mod ;
n = num.n
} ;
DetQuant quant num = {
s = quant.s ! num.n ++ num.s;
isNum = num.isNum;
fromPron = quant.fromPron ;
mod = quant.mod ;
n = num.n
} ;
@@ -53,7 +53,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
animacy = Inanimate
} ;
PossPron p = {s = \\_ => p.ps ; a = p.a ; fromPron = True} ;
PossPron p = {s = \\_ => BIND ++ p.ps ; a = p.a ; mod = Poss} ;
NumSg = {s = [] ; n = Sg ; isNum = False} ;
NumPl = {s = [] ; n = Pl ; isNum = False} ;
@@ -68,17 +68,14 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
-- to here
AdNum adn num = num ** {s = adn.s ++ num.s} ;
OrdSuperl a = {s = a.s ! bEzafa ++ 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 ; fromPron = False} ;
IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgr ; fromPron = False} ;
DefArt = {s = \\_ => [] ; a = defaultAgr ; mod = Bare} ;
IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgr ; mod = Bare} ;
MassNP cn = 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 = agrP3 Sg ;
MassNP cn = cn ** {
s = cn.s ! Sg ;
a = agrP3 Sg
} ;
UseN n = n ** {hasAdj=False};
@@ -95,29 +92,29 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
} ;
ComplN2 f x = f ** {
s = \\ez,n => f.s ! ez ! n ++ f.c ++ x.s ! NPC ez ;
s = \\n,ez => f.s ! n ! Ezafe ++ f.c ++ x.s ! ez ;
definitness = True ;
hasAdj = False ;
};
ComplN3 f x = f ** {
s = \\ez,n => f.s ! ez ! n ++ f.c2 ++ x.s ! NPC ez ;
s = \\n,ez => f.s ! n ! Ezafe ++ f.c2 ++ x.s ! ez ;
c = f.c3;
definitness = True;
} ;
AdjCN ap cn = 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
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
hasAdj = True
} ;
RelCN cn rs = cn ** {
s = \\ez,n => cn.s ! enClic ! n ++ rs.s ! agrP3 n ;
s = \\n,ez => cn.s ! n! Clitic ++ rs.s ! agrP3 n ;
} ;
AdvCN cn ad = cn ** {s = \\ez,n => cn.s ! aEzafa ! n ++ ad.s} ;
AdvCN cn ad = cn ** {s = \\n,ez => cn.s ! n ! Ezafe ++ ad.s} ;
SentCN cn sc = cn ** {s = \\ez,n => cn.s ! ez ! n ++ sc.s} ;
SentCN cn sc = cn ** {s = \\n,ez => cn.s ! n ! ez ++ sc.s} ;
ApposCN cn np = cn ** {s = \\ez,n => cn.s ! ez ! n ++ np.s ! NPC aEzafa ; definitness = True} ; -- ezafa form of city to be used
ApposCN cn np = cn ** {s = \\n,ez => cn.s ! n ! ez ++ np.s ! Ezafe ; definitness = True} ; -- ezafa form of city to be used
}

View File

@@ -197,8 +197,8 @@ oper
-- Personal Pronouns
personalPN : Str -> Number -> Person -> Pron -- Hidden from public API, confusing naming. /IL
= \str,nn,p -> lin Pron {s = str ; a = Ag nn p ; ps = str};
personalPron : (nom:Str) -> (poss:Str) -> Number -> Person -> Pron -- Hidden from public API, confusing naming. /IL
= \nom,poss,nn,p -> lin Pron {s = nom ; a = Ag nn p ; ps = poss};
{-
-- Demonstrative Pronouns
demoPN : Str -> Str -> Str -> Quant =

View File

@@ -11,17 +11,17 @@ concrete PhrasePes of Phrase = CatPes ** open Prelude, ResPes in {
UttIP ip = {s = ip.s } ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! NPC bEzafa} ;
UttNP np = {s = np.s ! Bare} ;
UttVP vp = {s = vp.ad ++ vp.comp ! Ag Sg P3 ++ vp.obj.s ++ vp.inf ++ vp.vComp ! Ag Sg P3 ++ vp.embComp} ;
UttAdv adv = {s = adv.s } ;
UttCN cn = {s = cn.s ! bEzafa ! Sg };
UttCN cn = {s = cn.s ! Sg ! Bare };
UttCard n = n ;
UttAP ap = {s = ap.s ! bEzafa} ;
UttAP ap = {s = ap.s ! Bare} ;
NoPConj = {s = []} ;
PConjConj conj = {s = conj.s2} ; ---
NoVoc = {s = []} ;
VocNP np = {s = np.s ! NPC bEzafa} ;
VocNP np = {s = np.s ! Bare} ;
}

View File

@@ -32,7 +32,7 @@ concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in {
};
QuestIComp icomp np =
let cl = mkSClause (np.s ! NPC bEzafa ++ icomp.s) np.a (predAux auxBe);
let cl = mkSClause (np.s ! Bare ++ icomp.s) np.a (predAux auxBe);
in {
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! ODir;
@@ -48,7 +48,9 @@ concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in {
} ;
IdetCN idet cn = {
s = case idet.isNum of {False => idet.s ++ cn.s ! bEzafa ! idet.n ; True => idet.s ++ cn.s ! bEzafa ! Sg} ;
s = case idet.isNum of {
False => idet.s ++ cn.s ! idet.n ! Bare ;
True => idet.s ++ cn.s ! Sg ! Bare} ;
n = idet.n;
} ;

View File

@@ -6,19 +6,19 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
lin
RelCl cl = {
s = \\t,p,o,agr => "که" ++ cl.s ! t ! p ! o ;
};
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
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
@@ -27,22 +27,22 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
cl.s ! t ! p ! ODir ;
-- c = Dir
} ;
---- Pied piping: "ت wهعه we رe لْْکنگ". Stranding and empty
---- relative are defined in $ExtraHin.gf$ ("تهت we رe لْْکنگ ت",
---- relative are defined in $ExtraHin.gf$ ("تهت we رe لْْکنگ ت",
---- "we رe لْْکنگ ت").
--
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?
-- 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
-- _ => 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
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
} ;
@@ -50,5 +50,5 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
s = "که" ;
a = RNoAg
} ;
}

View File

@@ -14,7 +14,6 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
Order = ODir | OQuest ;
PMood = Del | Imper | PCond ;
NPCase = NPC Ezafa ;
CardOrd = NCard | NOrd ;
RAgr = RNoAg | RAg Agr ;
-- RCase = RC Number Case ;
@@ -26,7 +25,7 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
Compl : Type = {s : Str ; ra : Str ; c : VType} ;
CN : Type = Noun ** {hasAdj : Bool} ; -- for getting the right form when NP/CN is a predicate
NP : Type = {s : NPCase => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
NP : Type = {s : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
VPHSlash : Type = VPH ** {c2 : Compl} ;
oper
@@ -191,8 +190,8 @@ oper
conjThat : Str = "که" ;
{- checkPron : NP -> Str -> Str = \np,str -> case (np.isPron) of {
True => np.s ! NPC Obl;
False => np.s ! NPC Obl ++ str} ;
True => np.s ! Obl;
False => np.s ! Obl ++ str} ;
insertEmbCompl : VPH -> Str -> VPH = \vp,emb -> vp ** {
embComp = vp.embComp ++ emb;
@@ -248,7 +247,7 @@ oper
quest = table
{ ODir => [];
OQuest => "آیا" } ;
subj = np.s ! NPC bEzafa ;
subj = np.s ! Bare ;
vp = \\vt,b,ord =>
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
@@ -361,8 +360,8 @@ taryn = "ترین" ;
-----------------------------
-- Noun Phrase
-----------------------------
{-toNP : Str -> Str = \pn, npc -> case npc of {
NPC c => pn ! c ;
{-toNP : Str -> Str = \pn, -> case of {
c => pn ! c ;
NPObj => pn ! Dir ;
NPErg => pn ! Obl
} ;

View File

@@ -32,7 +32,7 @@ concrete StructuralPes of Structural = CatPes **
-- first_Ord = {s = "اولین" ; n = Sg} ; --DEPRECATED
for_Prep = ss "برای" ;
from_Prep = ss "از" ;
he_Pron = personalPN "او" Sg P3 ;
he_Pron = personalPron "او" "ش" Sg P3 ;
here_Adv = ss "اینجا" ;
here7to_Adv = ss "اینجا" ;
here7from_Adv = ss "اینجا" ;
@@ -41,9 +41,9 @@ concrete StructuralPes of Structural = CatPes **
how8much_IAdv = ss "چقدر" ;
if_Subj = ss "اگر" ;
in8front_Prep = ss "جلوی" ;
i_Pron = personalPN "من" Sg P1;
i_Pron = personalPron "من" "م" Sg P1;
in_Prep = ss "در" ;
it_Pron = personalPN "آن" Sg P3;
it_Pron = personalPron "آن" "ش" Sg P3;
less_CAdv = {s = "کمتر" ; p = ""} ;
many_Det = mkDet ["تعداد زیادی"] Pl True; -- check
more_CAdv = {s = "بیشتر" ; p = "" } ;
@@ -75,7 +75,7 @@ concrete StructuralPes of Structural = CatPes **
please_Voc = ss "لطفاً" ;
possess_Prep = ss "" ; -- will be handeled in Ezafeh
quite_Adv = ss "کاملاً" ;
she_Pron = personalPN "او" Sg P3 ;
she_Pron = personalPron "او" "ش" Sg P3 ;
so_AdA = ss "بسیار" ;
-- somebody_NP = MassNP (UseN (MorphoPnb.mkN11 "کwی" ));
someSg_Det = mkDet "مقداری" Sg True ;
@@ -88,7 +88,7 @@ concrete StructuralPes of Structural = CatPes **
there7to_Adv = ss "آنجا" ;
there7from_Adv = ss "آنجا" ;
therefore_PConj = ss ["به همین دلیل"] ;
they_Pron = personalPN ["آن ها"] Pl P3 ;
they_Pron = personalPron "آن ها" "شان" Pl P3 ;
this_Quant = mkQuant "این" "این" ;
through_Prep = ss ["از طریق"] ;
too_AdA = ss "خیلی" ;
@@ -96,7 +96,7 @@ concrete StructuralPes of Structural = CatPes **
under_Prep = ss "زیر" ** {lock_Prep = <>};
very_AdA = ss "خیلی" ;
want_VV = mkV "خواستن" "خواه" ** { isAux = False} ;
we_Pron = personalPN "ما" Pl P1 ;
we_Pron = personalPron "ما" "مان" Pl P1 ;
whatSg_IP = {s = ["چه چیزی"] ; n = Sg } ;
whatPl_IP = {s = ["چه چیزهایی"] ; n = Pl } ;
when_IAdv = ss "کی" ;
@@ -112,9 +112,9 @@ concrete StructuralPes of Structural = CatPes **
with_Prep = ss "با";
-- yes_Phr = ss "بله" ;
yes_Utt = ss "بله" ;
youSg_Pron = personalPN "تو" Sg P2 ;
youPl_Pron = personalPN "شما" Pl P2 ;
youPol_Pron = personalPN "شما" Pl P2 ;
youSg_Pron = personalPron "تو" "ت" Sg P2 ;
youPl_Pron = personalPron "شما" "تان" Pl P2 ;
youPol_Pron = personalPron "شما" "تان" Pl P2 ;
-- no_Quant = demoPN "هیچ" ;
not_Predet = {s="نه"} ;
if_then_Conj = sd2 "اگر" "آنگاه" ** {n = Sg} ;

View File

@@ -11,15 +11,15 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in {
FloatPN i = {s = i.s ; animacy = Inanimate} ;
NumPN i = {s = i.s ; animacy = Inanimate} ;
CNIntNP cn i = cn ** {
s = \\ez => cn.s ! aEzafa ! Sg ++ i.s ;
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
a = agrP3 Sg
} ;
CNSymbNP det cn xs = cn ** {
s = \\ez => det.s ++ cn.s ! aEzafa ! det.n ++ xs.s ;
s = \\ez => det.s ++ cn.s ! det.n ! Ezafe ++ xs.s ;
a = agrP3 det.n
} ;
CNNumNP cn i = cn ** {
s = \\ez => cn.s ! aEzafa ! Sg ++ i.s ;
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
a = agrP3 Sg
} ;

View File

@@ -7,28 +7,28 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
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}}) ;
insertObjc (\\_ => np.s ! Bare ++ 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}}) ;
insertObjc (\\_ => v.c3 ++ np.s ! Bare) (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
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}}) ;
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
SlashV2A v ap = insertObjc3 ( ap.s ! Bare) (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 ;
ComplSlash vp np = insertObjPre (\\_ => np.s ! Bare ) 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 )
insertObjPre (\\_ => np.s ! Bare )
-- (insertObjc (infVV vv.isAux vp).s (predVc vv)) **
(insertVVc (infVV vv.isAux vp).s (predVc vv)) **
{c2 = vp.c2} ;
@@ -40,21 +40,22 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
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
CompAP ap ={s = \\_ => ap.s ! Bare} ; -- check form of adjective
CompAdv adv = {s = \\_ => adv.s } ;
-- see https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/
CompCN cn = {
s = \\a =>
case cn.hasAdj of {
False => cn.s ! bEzafa ! Sg ;
True => cn.s ! enClic ! giveNumber a }
s = \\a => cn.s ! giveNumber a
! case cn.hasAdj of {
False => Bare ;
True => Clitic }
} ;
CompNP np = {
s = \\a => np.s ! case np.hasAdj of {
False => NPC bEzafa ;
True => NPC enClic }
False => Bare ;
True => Clitic }
} ;
}

View File

@@ -7,14 +7,14 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseComparA a = a;
ComparA a np = {
s =\\ez => a.s ! ez ++ "tr" ++ "Az" ++ np.s ! NPC bEzafa ;
s =\\ez => a.s ! ez ++ "tr" ++ "Az" ++ np.s ! Bare ;
adv = a.adv
} ;
---- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s =\\ez => np.s ! NPC bEzafa ++ a.c2 ++ a.s ! ez ;
s =\\ez => np.s ! Bare ++ a.c2 ++ a.s ! ez ;
adv = a.adv
} ;
@@ -36,7 +36,7 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseA2 a = a ;
CAdvAP cadv ap np = {
s =\\ez => cadv.s ++ np.s ! NPC bEzafa ++ ap.s ! ez ;
s =\\ez => cadv.s ++ np.s ! Bare ++ ap.s ! ez ;
adv = ap.adv
};

View File

@@ -2,16 +2,16 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in {
flags coding = utf8;
lin
-- PositAdvAdj a = {s = a.s ! bEzafa } ;
-- PositAdvAdj a = {s = a.s ! Bare } ;
PositAdvAdj a = {s = a.adv } ;
ComparAdvAdj cadv a np = {
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! NPC bEzafa ;
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! Bare ;
} ;
ComparAdvAdjS cadv a s = {
s = a.adv ++ cadv.p ++ cadv.s ++ s.s;
} ;
PrepNP prep np = {s = prep.s ++ np.s ! NPC bEzafa } ;
PrepNP prep np = {s = prep.s ++ np.s ! Bare } ;
AdAdv ada adv = { s = ada.s ++ adv.s} ;

View File

@@ -9,7 +9,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
GenericCl vp = mkSClause "A:dm" (agrPesP3 Sg) vp ;
CleftNP np rs =
let cl = mkSClause (np.s ! NPC bEzafa) (np.a) (predAux auxBe);
let cl = mkSClause (np.s ! Bare) (np.a) (predAux auxBe);
in
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a };
@@ -17,7 +17,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
ExistNP np =
mkSClause " " (agrPesP3 (fromAgr np.a).n)
(insertObj (\\_ => np.s ! NPC bEzafa) (predAux auxBe)) ;
(insertObj (\\_ => np.s ! Bare) (predAux auxBe)) ;
ExistIP ip =
let cl = mkSClause ( ip.s ) (agrPesP3 ip.n) (predAux auxBe);
@@ -33,7 +33,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
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};
ImpP3 np vp = {s = "bgWAryd" ++ np.s!Bare ++ (vp.s ! VVForm (AgPes (fromAgr np.a).n (fromAgr np.a).p)).inf};
}

View File

@@ -20,10 +20,10 @@ oper
mkN : (x1,x2 : Str) -> Animacy -> Noun =
\sg,pl,ani -> {
s = table {
bEzafa => table { Sg => sg ;
Bare => table { Sg => sg ;
Pl => pl
} ;
aEzafa => table { Sg => mkEzafa sg ;
Ezafe => table { Sg => mkEzafa sg ;
Pl => mkEzafa pl
} ;
enClic => table { Sg => mkEnclic sg ;
@@ -483,23 +483,23 @@ addBh str =
--Determiners
--------------------
makeDet : Str -> Number -> Bool -> {s: Str ; n : Number ; isNum : Bool ; fromPron : Bool} =\str,n,b -> {
makeDet : Str -> Number -> Bool -> {s: Str ; n : Number ; isNum : Bool ; mod : Bool} =\str,n,b -> {
s = str;
isNum = b;
fromPron = False ;
mod = False ;
n = n
};
makeQuant : Str -> Str -> {s : Number => Str ; a : AgrPes ; fromPron : Bool } = \sg,pl -> {
makeQuant : Str -> Str -> {s : Number => Str ; a : AgrPes ; mod : Bool } = \sg,pl -> {
s = table {Sg => sg ; Pl => pl} ;
fromPron = False ;
mod = False ;
a = agrPesP3 Sg
};
---------------------------
-- Adjectives
--------------------------
mkAdj : Str -> Str -> Adjective = \adj,adv -> {
s = table { bEzafa => adj;
aEzafa => mkEzafa adj ;
s = table { Bare => adj;
Ezafe => mkEzafa adj ;
enClic => mkEnclic adj
} ;
adv = adv

View File

@@ -57,7 +57,7 @@ oper
-- Personal Pronouns
personalPN : Str -> Number -> PPerson -> Pron =
personalPron : Str -> Number -> PPerson -> Pron =
\str,nn,p -> {s = str ; a = AgPes nn p ; ps = str ; lock_Pron = <>};
{-
-- Demonstration Pronouns

View File

@@ -42,7 +42,7 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
} ;
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
s = np.s ! 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
} ;

View File

@@ -32,8 +32,8 @@ resource ResPes = ParamX ** open Prelude,Predef in {
InfrAspect = InfrPerf | InfrImperf ;
AgrPes = AgPes Number PPerson;
Ezafa = bEzafa | aEzafa | enClic;
NPCase = NPC Ezafa ;
Ezafa = Bare | Ezafe | enClic;
NPCase = Ezafa ;
CardOrd = NCard | NOrd ;
RAgr = RNoAg | RAg AgrPes ;
-- RCase = RC Number Case ;
@@ -53,7 +53,7 @@ resource ResPes = ParamX ** open Prelude,Predef in {
Adjective = {s:Ezafa => Str ; adv : Str} ;
NP : Type = {s : NPCase => Str ; a : AgrPes ; animacy : Animacy } ;
Determiner = {s : Str ; n :Number ; isNum : Bool ; fromPron : Bool} ;
Determiner = {s : Str ; n :Number ; isNum : Bool ; mod : Bool} ;
VPHSlash = VPH ** {c2 : Compl} ;
oper
@@ -260,8 +260,8 @@ oper
conjThat : Str = "kh" ;
{- checkPron : NP -> Str -> Str = \np,str -> case (np.isPron) of {
True => np.s ! NPC Obl;
False => np.s ! NPC Obl ++ str} ;
True => np.s ! Obl;
False => np.s ! Obl ++ str} ;
insertEmbCompl : VPH -> Str -> VPH = \vp,emb -> {
s = vp.s ;
@@ -292,7 +292,7 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
mkClause : NP -> VPH -> Clause = \np,vp -> {
s = \\vt,b,ord =>
let
subj = np.s ! NPC bEzafa;
subj = np.s ! Bare;
agr = np.a ;
n = (fromAgr agr).n;
p = (fromAgr agr).p;
@@ -795,7 +795,7 @@ addBh2 str1 =
-- Noun Phrase
-----------------------------
{-toNP : Str -> Str = \pn, npc -> case npc of {
NPC c => pn ! c ;
c => pn ! c ;
NPObj => pn ! Dir ;
NPErg => pn ! Obl
} ;

View File

@@ -31,7 +31,7 @@ concrete StructuralPes of Structural = CatPes **
-- first_Ord = {s = "Avlyn" ; n = Sg} ; --DEPRECATED
for_Prep = ss "brAy" ;
from_Prep = ss "Az" ;
he_Pron = personalPN "Av" Sg PPers3 ;
he_Pron = personalPron "Av" Sg PPers3 ;
here_Adv = ss "AynjA" ;
here7to_Adv = ss "AynjA" ;
here7from_Adv = ss "AynjA" ;
@@ -40,9 +40,9 @@ concrete StructuralPes of Structural = CatPes **
how8much_IAdv = ss "c^qdr" ;
if_Subj = ss "Agr" ;
in8front_Prep = ss "jlvy" ;
i_Pron = personalPN "mn" Sg PPers1;
i_Pron = personalPron "mn" Sg PPers1;
in_Prep = ss "dr" ;
it_Pron = personalPN "A:n" Sg PPers3;
it_Pron = personalPron "A:n" Sg PPers3;
less_CAdv = {s = "kmtr" ; p = ""} ;
many_Det = mkDet ["tcdAd zyAdy"] Pl True; -- check
more_CAdv = {s = "byCtr" ; p = "" } ;
@@ -73,7 +73,7 @@ concrete StructuralPes of Structural = CatPes **
please_Voc = ss "lTfAa." ;
possess_Prep = ss "" ; -- will be handeled in Ezafeh
quite_Adv = ss "kAmlAa." ;
she_Pron = personalPN "Av" Sg PPers3 ;
she_Pron = personalPron "Av" Sg PPers3 ;
so_AdA = ss "bsyAr" ;
-- somebody_NP = MassNP (UseN (MorphoPnb.mkN11 "kwy" ));
someSg_Det = mkDet "mqdAry" Sg True ;
@@ -86,7 +86,7 @@ concrete StructuralPes of Structural = CatPes **
there7to_Adv = ss "A:njA" ;
there7from_Adv = ss "A:njA" ;
therefore_PConj = ss ["bh hmyn dlyl"] ;
they_Pron = personalPN ["A:n hA"] Pl PPers3 ;
they_Pron = personalPron ["A:n hA"] Pl PPers3 ;
this_Quant = mkQuant "Ayn" "Ayn" ;
through_Prep = ss ["Az Tryq"] ;
too_AdA = ss "Kyly" ;
@@ -94,7 +94,7 @@ concrete StructuralPes of Structural = CatPes **
under_Prep = ss "zyr" ** {lock_Prep = <>};
very_AdA = ss "Kyly" ;
want_VV = mkV "KvAstn" "KvAh" ** { isAux = False} ;
we_Pron = personalPN "mA" Pl PPers1 ;
we_Pron = personalPron "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" ;
@@ -110,9 +110,9 @@ concrete StructuralPes of Structural = CatPes **
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" Pl PPers2 ;
youSg_Pron = personalPron "tv" Sg PPers2 ;
youPl_Pron = personalPron "CmA" Pl PPers2 ;
youPol_Pron = personalPron "CmA" Pl PPers2 ;
-- no_Quant = demoPN "hyc^" ;
not_Predet = {s="nh"} ;
if_then_Conj = sd2 "Agr" "A:ngAh" ** {n = Sg} ;