1
0
forked from GitHub/gf-rgl

Merge pull request #197 from inariksit/persian

Persian
This commit is contained in:
Inari Listenmaa
2019-03-14 16:59:48 +01:00
committed by GitHub
15 changed files with 91 additions and 95 deletions

View File

@@ -3,46 +3,51 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
flags coding = utf8; flags coding = utf8;
lin lin
PositA a = a ; PositA a = a ;
UseComparA a = a; UseComparA a = a ;
ComparA a np = { ComparA a np = a ** {
s =\\ez => a.s ! ez ++ "تر" ++ "از" ++ np.s ! Bare ; s = \\m => a.s ! m ++ "تر" ++ "از" ++ np.s ! Bare ;
adv = a.adv adv = a.adv ++ "تر" ++ "از" ++ np.s ! Bare ;
} ; } ;
---- $SuperlA$ belongs to determiner syntax in $Noun$. ---- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = { ComplA2 a np = a ** {
s =\\ez => np.s ! Bare ++ a.c2 ++ a.s ! ez ; s = \\m => np.s ! Bare ++ a.c2 ++ a.s ! m ;
adv = a.adv adv = np.s ! Bare ++ a.c2 ++ a.adv
} ; } ;
ReflA2 a = { ReflA2 a = a ** {
s =\\ez => a.s ! ez ++ "" ; -- need to be fixed s = \\m => a.s ! m ++ reflPron ! defaultAgr ; ---- need to be fixed
adv = a.adv adv = a.adv ++ reflPron ! defaultAgr
} ; } ;
SentAP ap sc = { SentAP ap sc = ap ** {
s =\\ez => ap.s! ez ++ sc.s ; s = \\m => ap.s ! m ++ sc.s ;
adv = ap.adv adv = ap.adv ++ sc.s
} ; } ;
AdAP ada ap = { AdAP ada ap = ap ** {
s =\\ez => ada.s ++ ap.s ! ez ; s = \\m => ada.s ++ ap.s ! m ;
adv = ap.adv adv = ada.s ++ ap.adv ;
} ; } ;
UseA2 a = a ; UseA2 a = a ;
CAdvAP cadv ap np = { CAdvAP cadv ap np = ap ** {
s =\\ez => cadv.s ++ np.s ! Bare ++ ap.s ! ez ; s = \\m => cadv.s ++ np.s ! Bare ++ ap.s ! m ;
adv = ap.adv adv = cadv.s ++ ap.adv
}; } ;
AdjOrd ord = { s =\\_ => ord.s ; adv = ""}; AdjOrd ord = {
s = \\_ => ord.s ;
adv = ord.s ;
isPre = ord.isPre
} ;
AdvAP ap adv = ap ** {
s = \\m => ap.s ! m ++ adv.s ;
AdvAP ap adv = {s =\\ez => ap.s ! ez ++ adv.s ; adv = ap.adv}; adv = ap.adv ++ adv.s
} ;
} }

View File

@@ -6,8 +6,8 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
------ Tensed/Untensed ------ Tensed/Untensed
S = {s : VVForm => Str} ; -- as a complement to Subj S = {s : VVForm => Str} ; -- as a complement to Subj
QS = {s : QForm => Str} ; QS = {s : Str} ;
RS = {s : Agr => Str } ; -- c for it clefts RS = {s : Agr => Str } ;
SSlash = {s : VVForm => Str ; c2 : ResPes.Compl} ; SSlash = {s : VVForm => Str ; c2 : ResPes.Compl} ;
---- Sentence ---- Sentence
@@ -21,7 +21,7 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
Imp = {s : Polarity => ImpForm => Str} ; Imp = {s : Polarity => ImpForm => Str} ;
---- Question ---- Question
QCl = {s : ResPes.TAnt => Polarity => QForm => Str} ; QCl = {s : ResPes.TAnt => Polarity => Str} ;
IP = {s: Str ; n : Number}; IP = {s: Str ; n : Number};
@@ -58,7 +58,7 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
Predet = {s : Str} ; Predet = {s : Str} ;
Num = {s : Str ; n : Number ; isNum : Bool} ; Num = {s : Str ; n : Number ; isNum : Bool} ;
Card = {s : Str; n : Number} ; Card = {s : Str; n : Number} ;
Ord = {s : Str; n : Number ; isNum : Bool} ; Ord = {s : Str; n : Number ; isNum,isPre : Bool} ;
Quant = ResPes.Quant ; Quant = ResPes.Quant ;
---- Numeral ---- Numeral

View File

@@ -17,7 +17,7 @@ concrete ConjunctionPes of Conjunction =
animacy = ss.animacy ; animacy = ss.animacy ;
} ; } ;
ConjAP conj ss = conjunctDistrTable Mod conj ss ** {adv = ss.adv}; ConjAP conj ss = ss ** conjunctDistrTable Mod conj ss ; -- Adv isn't changed
ConjRS conj rs = conjunctDistrTable Agr conj rs ** { c = rs.c}; ConjRS conj rs = conjunctDistrTable Agr conj rs ** { c = rs.c};
---- These fun's are generated from the list cat's. ---- These fun's are generated from the list cat's.
@@ -32,15 +32,14 @@ concrete ConjunctionPes of Conjunction =
BaseRS x y = twoTable Agr x y ** {c = x.c}; BaseRS x y = twoTable Agr x y ** {c = x.c};
ConsNP xs x = xs ** consrTable Mod 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}; 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 = y ** twoTable Mod x y ;
BaseAP x y = twoTable Mod x y ** {adv = x.adv}; ConsAP xs x = xs ** consrTable Mod comma xs x ; -- Table3 Number Gender Case comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ;
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 lincat
[S] = {s1,s2 : VVForm => Str} ; [S] = {s1,s2 : VVForm => Str} ;
[Adv] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool; compl:Str} ; [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 ; isPre : Bool} ;
[RS] = {s1,s2 : Agr => Str }; [RS] = {s1,s2 : Agr => Str };
} }

View File

@@ -3,7 +3,7 @@
concrete ExtendPes of Extend = concrete ExtendPes of Extend =
CatPes ** ExtendFunctor - [ CatPes ** ExtendFunctor - [
GenNP, ApposNP, ICompAP GenNP, ApposNP, ICompAP
,GerundNP,GerundCN,GerundAdv ,GerundNP,GerundCN,GerundAdv,EmbedPresPart
] ]
with (Grammar=GrammarPes) with (Grammar=GrammarPes)
** open Prelude, ResPes in { ** open Prelude, ResPes in {
@@ -30,4 +30,6 @@ lin
-- : VP -> Adv ; -- publishing the document (prepositionless adverb) -- : VP -> Adv ; -- publishing the document (prepositionless adverb)
GerundAdv vp = lin Adv {s = showVPH Inf defaultAgr vp} ; GerundAdv vp = lin Adv {s = showVPH Inf defaultAgr vp} ;
-- : VP -> SC ;
EmbedPresPart vp = lin SC {s = showVPH Inf defaultAgr vp} ;
} }

View File

@@ -16,16 +16,12 @@ lin
CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s ! Indic}; CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s ! Indic};
ExistNP np = ExistNP np =
mkSClause " " (agrP3 (fromAgr np.a).n) mkSClause [] (agrP3 (fromAgr np.a).n)
(insertComp (\\_ => np.s ! Bare) (predV beVerb)) ; (insertComp (\\_ => np.s ! Bare) (predV beVerb)) ;
ExistIP ip = ExistIP ip =
let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predV beVerb); let cl = mkSClause ip.s (agrP3 ip.n) (predV beVerb);
in {s = \\t,p,qf => case qf of { in {s = \\t,p => cl.s ! t ! p ! ODir};
QDir => cl.s ! t ! p ! ODir;
QIndir => cl.s ! t! p ! ODir
}
};
ProgrVP vp = predProg vp ; ProgrVP vp = predProg vp ;

View File

@@ -132,7 +132,7 @@ concrete LexiconPes of Lexicon = CatPes **
new_A = mkA "نو" "تازه"; new_A = mkA "نو" "تازه";
newspaper_N = mkN01 "روزنامه" inanimate; newspaper_N = mkN01 "روزنامه" inanimate;
oil_N = mkN "نفت" "نفت" inanimate; -- also "روغن" oil_N = mkN "نفت" "نفت" inanimate; -- also "روغن"
old_A = mkA "پیر" "پیرانه"; old_A = preA "پیر" "پیرانه" ;
open_V2 = mkV2 (compoundV "باز" doVerb) "را"; open_V2 = mkV2 (compoundV "باز" doVerb) "را";
paint_V2A = mkV2 (compoundV "رنگ" doVerb) "را" ; paint_V2A = mkV2 (compoundV "رنگ" doVerb) "را" ;
paper_N = mkN01 "کاغذ" inanimate; paper_N = mkN01 "کاغذ" inanimate;

View File

@@ -147,7 +147,11 @@ oper
--------------------------- ---------------------------
-- Adjectives -- Adjectives
-------------------------- --------------------------
Adjective : Type = {s : Mod => Str ; adv : Str} ; Adjective : Type = {
s : Mod => Str ;
adv : Str ;
isPre : Bool
} ;
mkAdj : Str -> Str -> Adjective = \adj,adv -> { mkAdj : Str -> Str -> Adjective = \adj,adv -> {
s = table { Bare => adj; s = table { Bare => adj;
@@ -155,7 +159,7 @@ oper
Clitic => mkEnclic adj ; Clitic => mkEnclic adj ;
Poss => mkPossStem adj Poss => mkPossStem adj
} ; } ;
adv = adv adv = adv ; isPre = False
}; };
------------------------------------------------------------------ ------------------------------------------------------------------

View File

@@ -77,14 +77,14 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
NumCard n = n ** {isNum = True} ; NumCard n = n ** {isNum = True} ;
NumDigits n = n ** {s = n.s ! NCard; isNum = True} ; NumDigits n = n ** {s = n.s ! NCard; isNum = True} ;
OrdDigits n = n ** {s = n.s ! NOrd ; isNum = True} ; OrdDigits n = n ** {s = n.s ! NOrd ; isNum = True ; isPre=False} ;
NumNumeral n = n ** {s = n.s ! NCard; isNum = True} ; NumNumeral n = n ** {s = n.s ! NCard; isNum = True} ;
OrdNumeral n = n ** {s = n.s ! NOrd ; isNum = True} ; OrdNumeral n = n ** {s = n.s ! NOrd ; isNum = True ; isPre=False} ;
-- to here -- to here
AdNum adn num = num ** {s = adn.s ++ num.s} ; AdNum adn num = num ** {s = adn.s ++ num.s} ;
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 ; isPre = True} ; -- check the form of adjective
DefArt = {s = \\_,_ => [] ; mod = Bare} ; DefArt = {s = \\_,_ => [] ; mod = Bare} ;
IndefArt = {s = table {Sg => \\_ => IndefArticle ; Pl => \\_ => []} ; mod = Bare} ; IndefArt = {s = table {Sg => \\_ => IndefArticle ; Pl => \\_ => []} ; mod = Bare} ;
@@ -121,7 +121,9 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
} ; } ;
AdjCN ap cn = cn ** { AdjCN ap cn = cn ** {
s = \\n,ez => cn.s ! n ! Ezafe ++ ap.s ! ez ; s = \\n,m => case ap.isPre of {
True => ap.s ! Bare ++ cn.s ! n ! m ; -- TODO check mod of ap
False => cn.s ! n ! Ezafe ++ ap.s ! m } ;
hasAdj = True hasAdj = True
} ; } ;

View File

@@ -282,6 +282,8 @@ oper
= \a,c -> lin A2 (mkAdj a a ** {c2 = c}) = \a,c -> lin A2 (mkAdj a a ** {c2 = c})
} ; } ;
preA : (adj,adv : Str) -> A = \adj,adv ->
lin A ((mkAdj adj adv) ** {isPre=True}) ;
{- {-
-- Demonstrative Pronouns -- Demonstrative Pronouns

View File

@@ -3,12 +3,12 @@ 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 = s.s ! Indic} ; UttS s = {s = s.s ! Indic} ;
UttQS qs = {s = qs.s ! QDir} ;
UttImpSg pol imp = {s = pol.s ++ imp.s ! 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 ! 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 ! pol.p ! ImpF Sg True} ; UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True} ;
UttIP, --- Acc also UttIP, --- Acc also
UttQS,
UttAdv, UttAdv,
UttIAdv, UttIAdv,
UttCard = \ss -> ss ; UttCard = \ss -> ss ;

View File

@@ -4,41 +4,26 @@ concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in {
lin lin
QuestCl cl = { QuestCl cl = {
s = \\t,p,qf => case qf of { s = \\t,p => cl.s ! t ! p ! OQuest
QDir => cl.s ! t ! p ! OQuest; };
QIndir => cl.s ! t! p ! ODir
}
};
QuestVP qp vp = QuestVP qp vp =
let cl = mkSClause ("") (Ag qp.n P3) vp; let cl = mkSClause [] (Ag qp.n P3) vp;
-- qp1 = qp.s; in {s = \\t,p => qp.s ++ cl.s ! t ! p ! ODir} ;
-- 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 = { QuestSlash ip slash = {
s = \\t,p,o => s = \\t,p => slash.subj ++ slash.c2.s ++ ip.s ++ slash.c2.ra
slash.subj ++ slash.c2.s ++ ip.s ++ slash.c2.ra ++ ++ slash.vp ! t ! p ! ODir
slash.vp ! t ! p ! ODir; };
-- order of whome and john needs to be changed
-- AR 18/9/2017 now changed by making ClSlash discontinuous
};
QuestIAdv iadv cl = { QuestIAdv iadv cl = {
s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! ODir; s = \\t,p => iadv.s ++ cl.s ! t ! p ! ODir
}; };
QuestIComp icomp np = QuestIComp icomp np =
let cl = mkSClause (np.s ! Bare ++ icomp.s) np.a (predV beVerb); let cl = mkSClause (np.s ! Bare ++ icomp.s) np.a (predV beVerb)
in { in {s = \\t,p => cl.s ! t ! p ! ODir};
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 } ; PrepIP p ip = {s = p.s ++ ip.s } ;

View File

@@ -99,7 +99,7 @@ oper
-- A hack: we reuse the obj field for the VP complement in -- A hack: we reuse the obj field for the VP complement in
-- SlashV2V and this is needed to get the right word order for complVV. -- SlashV2V and this is needed to get the right word order for complVV.
showVPHvv : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp -> showVPHvv : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp ->
vp.ad ++ vp.comp ! agr ++ vp.prefix ++ vp.s ! vf vp.comp ! agr ++ vp.prefix ++ vp.s ! vf -- vp.ad is missing on purpose! we add it in insertVV.
++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ; ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ;
Compl : Type = {s : Str ; ra : Str} ; Compl : Type = {s : Str ; ra : Str} ;
@@ -140,6 +140,7 @@ oper
insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** { insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** {
vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ; vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ;
vvType = case vv.isDef of {True => DefVV ; _ => FullVV} ; vvType = case vv.isDef of {True => DefVV ; _ => FullVV} ;
ad = vp.ad -- because complVV doesn't include ad! for word order.
} ; } ;
embComp : Str -> VPH -> VPH = \str,vp -> vp ** { embComp : Str -> VPH -> VPH = \str,vp -> vp ** {
@@ -221,7 +222,7 @@ oper
quest = table quest = table
{ ODir => []; { ODir => [];
OQuest => "آیا" } ; OQuest => "آیا" } ;
subj = np.s ! Bare ; subj = np2str np ;
vp = \\ta,p,ord => vp = \\ta,p,ord =>
let vps = clTable vp ! np.a ! ta ! p ; let vps = clTable vp ! np.a ! ta ! p ;
vvt = ta2vvt ta ; vvt = ta2vvt ta ;

View File

@@ -37,7 +37,7 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
{c2 = slash.c2} ; {c2 = slash.c2} ;
EmbedS s = {s = conjThat ++ s.s ! Indic} ; EmbedS s = {s = conjThat ++ s.s ! Indic} ;
EmbedQS qs = {s = qs.s ! QIndir} ; EmbedQS qs = qs ;
EmbedVP vp = {s = showVPH Inf defaultAgr vp} ; --- agr EmbedVP vp = {s = showVPH Inf defaultAgr vp} ; --- agr
@@ -48,7 +48,7 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
} ; } ;
UseQCl temp p qcl = let vt = TA temp.t temp.a in { UseQCl temp p qcl = let vt = TA temp.t temp.a in {
s = \\q => temp.s ++ p.s ++ qcl.s ! vt ! p.p ! q; s = temp.s ++ p.s ++ qcl.s ! vt ! p.p ;
} ; } ;
UseRCl temp p rcl = let vt = TA temp.t temp.a in rcl ** { UseRCl temp p rcl = let vt = TA temp.t temp.a in rcl ** {

View File

@@ -28,7 +28,7 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in {
SymbS sy = {s = \\_ => sy.s} ; SymbS sy = {s = \\_ => sy.s} ;
SymbNum sy = { s = sy.s ; n = Pl } ; SymbNum sy = { s = sy.s ; n = Pl } ;
SymbOrd sy = { s = sy.s ++ "wN" ; n = Pl; isNum=False} ; SymbOrd sy = { s = sy.s ++ "wN" ; n = Pl; isNum,isPre=False} ;
lincat lincat

View File

@@ -14,12 +14,12 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
ComplVV = insertVV ; ComplVV = insertVV ;
ComplVS v s = embComp (conjThat ++ s.s ! Indic) (predV v) ; ComplVS v s = embComp (conjThat ++ s.s ! Indic) (predV v) ;
ComplVQ v q = embComp (conjThat ++ q.s ! QIndir) (predV v) ; ComplVQ v q = embComp (conjThat ++ q.s) (predV v) ;
ComplVA v ap = insertObj (appComp v.c2 (ap.s ! Bare)) (predV v) ; -- check form of adjective ComplVA v ap = insertObj (appComp v.c2 (ap.s ! Bare)) (predV v) ; -- check form of adjective
SlashVV vv vps = vps ** ComplVV vv vps ; SlashVV vv vps = vps ** ComplVV vv vps ;
SlashV2S v s = predVc v ** embComp (conjThat ++ s.s ! Indic) (predV v) ; SlashV2S v s = predVc v ** embComp (conjThat ++ s.s ! Indic) (predV v) ;
SlashV2Q v q = predVc v ** embComp (q.s ! QIndir) (predV v) ; SlashV2Q v q = predVc v ** embComp q.s (predV v) ;
SlashV2A v ap = predVc v ** insertObj (appComp v.c2 (ap.s ! Bare)) (predV v) ; ---- paint it red , check form of adjective SlashV2A v ap = predVc v ** insertObj (appComp v.c2 (ap.s ! Bare)) (predV v) ; ---- paint it red , check form of adjective
-- : V2V -> VP -> VPSlash ; -- beg (her) to go -- : V2V -> VP -> VPSlash ; -- beg (her) to go