mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
Merge pull request #188 from inariksit/persian
(Pes) restructuring V, VV, VP + WIP vowels for TTS
This commit is contained in:
@@ -82,8 +82,8 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
|
||||
|
||||
V2, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ;
|
||||
V3 = ResPes.Verb ** {c2, c3 : Compl} ;
|
||||
VV = ResPes.Verb ** {isAux : Bool} ;
|
||||
V2V = ResPes.Verb ** {c1 : Str ; c2 : Str ; isAux : Bool} ;
|
||||
VV = ResPes.VV ;
|
||||
V2V = ResPes.VV ** {c1 : Str ; c2 : Str} ;
|
||||
A = ResPes.Adjective ;
|
||||
A2 = ResPes.Adjective ** {c2 : Str} ;
|
||||
|
||||
|
||||
@@ -30,8 +30,10 @@ lin
|
||||
|
||||
ProgrVP vp = predProg vp ;
|
||||
|
||||
ImpPl1 vp = {s = "بیایید" ++ vp.s ! Vvform (agrP1 Pl)} ;
|
||||
ImpP3 np vp = {s = "بگذارید" ++ np.s!Bare ++ vp.s ! Vvform np.a};
|
||||
ImpPl1 vp = let a = agrP1 Pl in
|
||||
{s = "بیایید" ++ showVPH (VSubj Pos a) a vp } ;
|
||||
ImpP3 np vp =
|
||||
{s = "بگذارید" ++ np.s ! Bare ++ showVPH (VSubj Pos np.a) np.a vp};
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,11 @@ oper
|
||||
ZWNJ : Str = "" ;
|
||||
zwnj : Str -> Str -> Str = \s1,s2 -> s1 + ZWNJ + s2 ;
|
||||
|
||||
-- kasre : Str = "ِ" ; -- To enable vowels for TTS input
|
||||
-- fatha : Str = "َ" ;
|
||||
kasre,fatha : Str = [] ;
|
||||
|
||||
|
||||
---- Nouns
|
||||
param
|
||||
Animacy = Animate | Inanimate ;
|
||||
@@ -55,21 +60,17 @@ oper
|
||||
oper
|
||||
|
||||
|
||||
mkPossStem : Str -> Str = \str ->
|
||||
|
||||
case str of {
|
||||
_+ "اه" => str ;
|
||||
_+ "او" => str ;
|
||||
_+ "وه" => str ;
|
||||
_+ ("ا"|"و") => str + "ی" ;
|
||||
_+ "ه" => zwnj str "ا" ;
|
||||
_ => str } ;
|
||||
mkPossStem : Str -> Str = \str ->
|
||||
case str of {
|
||||
_ + ("اه"|"او"|"وه")
|
||||
=> str + fatha ;
|
||||
_ + ("ا"|"و") => str + fatha + "ی" ;
|
||||
_ + "ه" => zwnj str "ا" ;
|
||||
_ => str + fatha } ;
|
||||
|
||||
|
||||
|
||||
mkEzafe : Str -> Str = \str ->
|
||||
--let kasre = "ِ" in -- TODO: Eventually use this
|
||||
let kasre = "" in
|
||||
case str of {
|
||||
st + "اه" => str + kasre ;
|
||||
st + "وه" => str + kasre ;
|
||||
@@ -142,36 +143,67 @@ Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; mod : Mod} ;
|
||||
-- Verbs
|
||||
------------------------------------------------------------------
|
||||
param
|
||||
VerbForm = VF Polarity VTense Agr
|
||||
| Vvform Agr
|
||||
| Imp Polarity Number
|
||||
| Inf | Root1 | Root2 ;
|
||||
VTense = VFPres PrAspect
|
||||
| VFPast PstAspect
|
||||
| VFFut FtAspect
|
||||
| VFInfrPast InfrAspect;
|
||||
PrAspect = PrPerf | PrImperf ;
|
||||
PstAspect = PstPerf | PstImperf | PstAorist ;
|
||||
FtAspect = FtAorist ; -- just keep FtAorist
|
||||
InfrAspect = InfrPerf | InfrImperf ;
|
||||
VerbForm = Inf -- kardan
|
||||
| PastStem -- kard -- Also used for future stem
|
||||
| PresStem -- kon -- Also imperative stem
|
||||
| PerfStem -- kardeh -- Perfect, pluperfect
|
||||
| PastPart -- konandeh
|
||||
| ImpPrefix Polarity -- mi/nmi, except for be and have
|
||||
| VAor Polarity Agr -- konam
|
||||
| VPerf Polarity Agr -- kardeh am/nkardeh am
|
||||
| VPast Polarity Agr -- kardam/nkardam
|
||||
| VSubj Polarity Agr -- bekonam/nakonam
|
||||
| VImp Polarity Number -- bekon,bekonid/nakon,nakonid
|
||||
;
|
||||
|
||||
oper
|
||||
Verb = {s : VerbForm => Str} ;
|
||||
impRoot : Str -> Str = \root -> case root of {
|
||||
st + "ی" => st ;
|
||||
_ => root
|
||||
};
|
||||
|
||||
mkVerb : (x1,x2 : Str) -> Verb = \inf,root2 ->
|
||||
let root1 = tk 1 inf ;
|
||||
impRoot = impRoot root2
|
||||
in { s = table {
|
||||
Root1 => root1 ;
|
||||
Root2 => root2 ;
|
||||
Inf => inf ;
|
||||
Imp Pos Sg => addBh impRoot ;
|
||||
Imp Pos Pl => addBh impRoot + "ید" ;
|
||||
Imp Neg Sg => "ن" + impRoot ;
|
||||
Imp Neg Pl => "ن" + impRoot + "ید" ;
|
||||
Vvform ag => mkvVform root2 ag ;
|
||||
VF p t ag => mkCmnVF root1 root2 p t ag }
|
||||
} ;
|
||||
mkVerb : (inf,pres : Str) -> Verb = \kardan,kon -> {
|
||||
s = table {
|
||||
Inf => kardan ;
|
||||
PastStem => kard ;
|
||||
PresStem => kon ;
|
||||
PerfStem => kardeh ;
|
||||
PastPart => kon + "نده" ;
|
||||
ImpPrefix Pos => "می" + ZWNJ ++ BIND ;
|
||||
ImpPrefix Neg => "نمی" + ZWNJ ++ BIND ;
|
||||
VAor _ agr => imperfectSuffixD agr kon ; -- for reg verbs, negation comes from prefix
|
||||
VPerf pol agr => perfectSuffix agr (addN pol kardeh) ;
|
||||
VPast pol agr => imperfectSuffix agr (addN pol kard) ;
|
||||
VSubj Pos agr => addBh (imperfectSuffixD agr kon) ;
|
||||
VSubj Neg agr => addN (imperfectSuffixD agr kon) ;
|
||||
VImp Pos Sg => addBh imp ;
|
||||
VImp Pos Pl => addBh imp + "ید" ;
|
||||
VImp Neg Sg => addN imp ;
|
||||
VImp Neg Pl => addN imp + "ید" } ;
|
||||
prefix = [] -- For compound verbs
|
||||
} where {
|
||||
kard = tk 1 kardan ;
|
||||
kardeh = kard + "ه" ;
|
||||
imp = impRoot kon ;
|
||||
} ;
|
||||
|
||||
invarV : (inv : Str) -> Verb = \s -> -- truly invariable
|
||||
let invReg = defectiveVerb s s s in invReg **
|
||||
{s = table {ImpPrefix p => invReg.s ! ImpPrefix p ; _ => s}} ;
|
||||
|
||||
defectiveVerb : (inf,pres,past : Str) -> Verb = \bayestan,bayad,bayest ->
|
||||
let invReg = mkVerb bayestan bayad in invReg **
|
||||
{s = \\vf => case vf of {
|
||||
VAor pol _ => addN pol bayad ;
|
||||
VImp pol _ => addN pol bayad ;
|
||||
VSubj pol _ => addN pol bayad ;
|
||||
VPast pol _ => addN pol bayest ;
|
||||
VPerf pol _ => addN pol bayest ;
|
||||
_ => invReg.s ! vf }
|
||||
} ;
|
||||
--
|
||||
oper
|
||||
Verb = {s : VerbForm => Str ; prefix : Str} ;
|
||||
|
||||
-- Verbs that end in یدن, ادن or ودن
|
||||
-- Also some verbs that don't: دانستن with stem دان
|
||||
@@ -180,67 +212,16 @@ oper
|
||||
-- Most verbs that end in C+تن or C+دن
|
||||
mkVerb2 : (_: Str) -> Verb = \inf -> mkVerb inf (tk 2 inf) ;
|
||||
|
||||
mkCmnVF : Str -> Str -> Polarity -> VTense -> Agr -> Str = \root1,root2,pol,t,ag ->
|
||||
let khordh = root1 + "ه";
|
||||
nkhordh = addN khordh ;
|
||||
mekhor = zwnj "می" root2 ;
|
||||
nmekhor = zwnj "نمی" root2 ;
|
||||
mekhord = zwnj "می" root1 ;
|
||||
nmekhord = zwnj "نمی" root1 ;
|
||||
mekhordh = zwnj "می" khordh ;
|
||||
nmekhordh = zwnj "نمی" khordh ;
|
||||
khah = "خواه" ;
|
||||
nkhah = "نخواه" ;
|
||||
-- mekhah = zwnj "می" khah ;
|
||||
-- nmekhah = zwnj "نمی" khah ;
|
||||
bvdh = "بوده" ;
|
||||
impfSuff : Str -> Str = imperfectSuffix ag ;
|
||||
impfSuffD : Str -> Str = imperfectSuffixD ag ;
|
||||
perfSuff : Str -> Str = perfectSuffix ag ;
|
||||
pluperfSuff : Str -> Str = pluperfectSuffix ag
|
||||
in case <pol,t> of {
|
||||
<Pos,VFPres PrImperf> => impfSuffD mekhor ;
|
||||
<Pos,VFPres PrPerf> => perfSuff khordh ;
|
||||
|
||||
<Pos,VFPast PstPerf> => pluperfSuff khordh ;
|
||||
<Pos,VFPast PstImperf> => impfSuff mekhord ;
|
||||
<Pos,VFPast PstAorist> => impfSuff root1 ;
|
||||
|
||||
<Pos,VFFut FtAorist> => impfSuffD khah ++ root1;
|
||||
|
||||
<Pos,VFInfrPast InfrPerf> => khordh ++ perfSuff bvdh ;
|
||||
<Pos,VFInfrPast InfrImperf> => perfSuff khordh ;
|
||||
|
||||
-- negatives
|
||||
<Neg,VFPres PrImperf> => impfSuffD nmekhor ;
|
||||
<Neg,VFPres PrPerf> => perfSuff nkhordh ;
|
||||
|
||||
<Neg,VFPast PstPerf> => pluperfSuff nkhordh ;
|
||||
<Neg,VFPast PstImperf> => impfSuff nmekhord ;
|
||||
<Neg,VFPast PstAorist> => impfSuff (addN root1) ;
|
||||
|
||||
<Neg,VFFut FtAorist> => impfSuffD nkhah ++ root1 ;
|
||||
|
||||
<Neg,VFInfrPast InfrPerf> => nkhordh ++ perfSuff bvdh ;
|
||||
<Neg,VFInfrPast InfrImperf> => perfSuff nmekhordh
|
||||
|
||||
-- <Pos,VFFut FtImperf> => perfSuffD mekhah ++ addBh (perfSuffD root2) ;
|
||||
-- <Neg,VFFut FtImperf> => perfSuffD nmekhah ++ addBh (perfSuffD root2) ;
|
||||
} ;
|
||||
|
||||
mkvVform : Str -> Agr -> Str = \root2,ag ->
|
||||
addBh (imperfectSuffixD ag root2) ;
|
||||
|
||||
impRoot : Str -> Str = \root -> case root of {
|
||||
st + "ی" => st ;
|
||||
_ => root
|
||||
};
|
||||
|
||||
-------------------
|
||||
-- making negatives
|
||||
-------------------
|
||||
addN : Str -> Str ;
|
||||
addN str =
|
||||
addN = overload {
|
||||
addN : Str -> Str = addN' ;
|
||||
addN : Polarity -> Str -> Str = \p,s ->
|
||||
case p of {Pos => s ; Neg => addN' s}
|
||||
} ;
|
||||
|
||||
addN' : Str -> Str = \str ->
|
||||
case str of {
|
||||
"ا" + st => "نی" + str ;
|
||||
"آ" + st => "نیا" + st ;
|
||||
@@ -293,60 +274,34 @@ oper
|
||||
Ag Pl P2 => zwnj s "اید" ;
|
||||
Ag Pl P3 => zwnj s "اند" } ;
|
||||
|
||||
pluperfectSuffix : Agr -> Str -> Str = \ag,s -> s ++
|
||||
case ag of { -- not suffix, just using consistent naming scheme :-P /IL
|
||||
Ag Sg P1 => "بودم" ;
|
||||
Ag Sg P2 => "بودی" ;
|
||||
Ag Sg P3 => "بود" ;
|
||||
Ag Pl P1 => "بودیم" ;
|
||||
Ag Pl P2 => "بودید" ;
|
||||
Ag Pl P3 => "بودند" } ;
|
||||
pluperfAux : Polarity -> Agr -> Str = \pol,agr ->
|
||||
addN pol (imperfectSuffix agr "بود") ;
|
||||
|
||||
futAux : Polarity -> Agr -> Str = \pol,agr ->
|
||||
addN pol (imperfectSuffixD agr "خواه") ;
|
||||
|
||||
subjAux : Polarity -> Agr -> Str = \pol,agr ->
|
||||
addN pol (imperfectSuffixD agr "باش") ;
|
||||
----------------------------------
|
||||
-- Irregular verbs
|
||||
----------------------------------
|
||||
|
||||
haveVerb : Verb = {s = table {
|
||||
Root1 => "داشت" ;
|
||||
Root2 => "دار" ;
|
||||
Inf => "داشتن" ;
|
||||
Imp Pos Sg => "بدار" ;
|
||||
Imp Pos Pl => "بدارید" ;
|
||||
Imp Neg Sg => "ندار" ;
|
||||
Imp Neg Pl => "ندارید" ;
|
||||
Vvform agr => mkvVform "دار" agr ;
|
||||
VF pol tense agr => case <pol,tense> of {
|
||||
<Pos,VFPres PrImperf> => imperfectSuffixD agr "دار" ;
|
||||
<Neg,VFPres PrImperf> => imperfectSuffixD agr (addN "دار") ;
|
||||
_ => mkCmnVF "داشت" "دار" pol tense agr
|
||||
}
|
||||
}
|
||||
} ;
|
||||
haveVerb : Verb = haveRegV ** {s = table {
|
||||
ImpPrefix _ => [] ;
|
||||
vf => haveRegV.s ! vf }
|
||||
} where { haveRegV = mkVerb "داشتن" "دار" } ;
|
||||
|
||||
beVerb : Verb = beRegV ** {s = table {
|
||||
ImpPrefix _ => [] ;
|
||||
VAor Pos (Ag Sg P3) => "است" ;
|
||||
VAor Pos agr => imperfectSuffix agr "هست" ;
|
||||
VAor Neg agr => imperfectSuffix agr "نیست" ;
|
||||
VSubj pol agr => addN pol (imperfectSuffixD agr "باش") ;
|
||||
VImp Pos Sg => "باش" ;
|
||||
VImp Pos Pl => "باشید" ;
|
||||
VImp Neg Sg => "نباش" ;
|
||||
VImp Neg Pl => "نباشید" ;
|
||||
vf => beRegV.s ! vf }
|
||||
} where { beRegV = mkVerb "بودن" "باش" } ;
|
||||
|
||||
-- TODO: merge with auxBe in ResPes
|
||||
beVerb : Verb = { s = table {
|
||||
Vvform agr => imperfectSuffixD agr "باش" ;
|
||||
Imp Pos Sg => "باش" ;
|
||||
Imp Pos Pl => "باشید" ;
|
||||
Imp Neg Sg => "نباش" ;
|
||||
Imp Neg Pl => "نباشید" ;
|
||||
Inf => "بودن" ;
|
||||
Root1 => "بود" ;
|
||||
Root2 => "باش" ;
|
||||
VF pol tense agr =>
|
||||
let impfSuff = imperfectSuffix agr ;
|
||||
perfSuff = perfectSuffix agr
|
||||
in case <pol,tense,agr> of {
|
||||
<Pos,VFPres PrImperf,Ag Sg P3> => "است" ;
|
||||
<Neg,VFPres PrImperf,Ag Sg P3> => "نیست" ;
|
||||
<Pos,VFPres PrImperf> => impfSuff "هست" ;
|
||||
<Neg,VFPres PrImperf> => impfSuff "نیست" ;
|
||||
<Pos,VFPres PrPerf> => perfSuff "بوده" ;
|
||||
<Neg,VFPres PrPerf> => perfSuff "نبوده" ;
|
||||
<Pos,VFPast PstImperf> => impfSuff "بود" ;
|
||||
<Neg,VFPast PstImperf> => impfSuff "نبود" ;
|
||||
_ => mkCmnVF "بود" "باش" pol tense agr
|
||||
}
|
||||
}
|
||||
} ;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
||||
} ;
|
||||
|
||||
PPartNP np v2 = np ** {
|
||||
s = \\ez => np.s ! ez ++ partNP (v2.s ! Root1)
|
||||
s = \\ez => np.s ! ez ++ partNP v2
|
||||
} ;
|
||||
|
||||
RelNP np rs = np ** {
|
||||
|
||||
@@ -24,6 +24,10 @@ oper
|
||||
singular : Number ; -- e.g. mkConj "یا" singular
|
||||
plural : Number ; -- e.g. mkConj "و" plural
|
||||
|
||||
VVForm : Type ; -- Argument to mkVV
|
||||
subjunctive : VVForm ; -- The verbal complement of VV is in subjunctive
|
||||
indicative : VVForm ; -- The verbal complement of VV is in indicative
|
||||
|
||||
--2 Nouns
|
||||
|
||||
mkN : overload {
|
||||
@@ -88,6 +92,15 @@ oper
|
||||
= \s1, s2 -> lin V (mkVerb s1 s2)
|
||||
} ;
|
||||
|
||||
compoundV : overload {
|
||||
compoundV : Str -> V -> V -- Invariable prefix to a verb, e.g. compoundV "دوست" haveVerb
|
||||
} ;
|
||||
|
||||
invarV : Str -> V -- no inflection at all
|
||||
= \s -> lin V (M.invarV s);
|
||||
defV : (inf,pres,past : Str) -> V -- no personal forms, but past/present difference, like بایستن ('must'),
|
||||
= \i,pr,pa -> lin V (M.defectiveVerb i pr pa) ;
|
||||
|
||||
haveVerb : V -- The verb "have", to be used for light verb constructions: e.g. compoundV "دوست" haveVerb. NB. this has different imperative and VV forms from StructuralPes.have_V2.
|
||||
= lin V M.haveVerb ;
|
||||
beVerb : V -- The verb "be", to be used for light verb constructions: e.g. compoundV "عاشق" beVerb.
|
||||
@@ -99,20 +112,22 @@ oper
|
||||
mkV2 : (listen : V) -> (to : Prep) -> V2 -- V2 out of V. Use given preposition, no را for direct object.
|
||||
} ;
|
||||
|
||||
|
||||
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 = 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 s1 s2 b = lin V2V (v ** {isAux = b ; c1 = s1 ; c2 = s2}) ;
|
||||
|
||||
-- compund verbs
|
||||
compoundV : overload {
|
||||
compoundV : Str -> V -> V -- Invariable prefix to a verb, e.g. compoundV "دوست" haveVerb
|
||||
mkVV = overload {
|
||||
mkVV : V -> VV -- takes its VP complement in subjunctive. Is auxiliary.
|
||||
= \v -> v ** {isAux = True ; compl = subjunctive ; isDef = False} ;
|
||||
mkVV : VVForm -> V -> VV -- takes its VP complement in the given VVForm
|
||||
= \vvf,v -> v ** {isAux = True ; compl = vvf ; isDef = False} ;
|
||||
mkVV : (isAux : Bool) -> VVForm -> V -> VV -- takes its VP complement in the given VVForm. Whether it's auxiliary (T/F) given as the first argument.
|
||||
= \isAux,vvf,v -> v ** {isAux = isAux ; compl = vvf ; isDef = False}
|
||||
} ;
|
||||
|
||||
invarV : Str -> V -- for verbs like بایستن ('must'), which don't inflect
|
||||
= \s -> lin V {s = \\_ => s} ;
|
||||
mkV2V : V -> (cV, cN : Str) -> (isAux : Bool) -> V2V -- Verb, complementiser for the verb, complementiser for the noun, whether it's auxiliary.
|
||||
= \v,s1,s2,b -> let vv : VV = mkVV b subjunctive v in
|
||||
lin V2V (vv ** {c1 = s1 ; c2 = s2}) ;
|
||||
|
||||
|
||||
----2 Adverbs
|
||||
mkAdv : Str -> Adv -- Takes a string, returns an adverb.
|
||||
@@ -162,6 +177,10 @@ oper
|
||||
animate = human ;
|
||||
inanimate = nonhuman ;
|
||||
|
||||
VVForm = ResPes.VVForm ;
|
||||
subjunctive = ResPes.Subj ;
|
||||
indicative = Indic ;
|
||||
|
||||
-- Removed mkV_1, mkV_2, mkN01 and mkN02 from public API, still available for
|
||||
-- any applications that open ParadigmsPes. /IL 2019-02-08
|
||||
mkV_1 : Str -> V
|
||||
@@ -240,9 +259,9 @@ oper
|
||||
|
||||
compoundV = overload {
|
||||
compoundV : Str -> V -> V
|
||||
= \s,v -> v ** {s = \\vf => s ++ v.s ! vf} ;
|
||||
= \s,v -> v ** {prefix = s} ;
|
||||
compoundV : Str -> V2 -> V -- hidden from public API
|
||||
= \s,v -> lin V {s = \\vf => s ++ v.s ! vf} ;
|
||||
= \s,v -> lin V (v ** {prefix = s}) ;
|
||||
};
|
||||
|
||||
regV : Str -> V = \inf ->
|
||||
|
||||
@@ -55,22 +55,36 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
||||
-----------------------
|
||||
--- Verb Phrase
|
||||
-----------------------
|
||||
param
|
||||
VVForm = Indic | Subj ;
|
||||
|
||||
oper
|
||||
|
||||
VPH : Type = {
|
||||
s : VerbForm => Str ;
|
||||
VV : Type = Verb ** {
|
||||
isAux : Bool ;
|
||||
compl : VVForm ; -- indicative or subjunctive
|
||||
isDef : Bool -- defective verb forms don't get same inflection
|
||||
} ;
|
||||
|
||||
VPH : Type = Verb ** {
|
||||
comp : Agr => Str; -- complements of a verb, agr for e.g. CompCN "I am human/we are humans"
|
||||
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.
|
||||
vComp : Agr => Anteriority => 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.
|
||||
obj : Str ; -- object of a verb; so far only used for A ("paint it black")
|
||||
subj : VType ;
|
||||
ad : Str ;
|
||||
embComp : Str ; -- when a declarative or interrogative sentence is used as a complement of a verb.
|
||||
wish : Bool ; -- whether a VV has been added
|
||||
defVV : Bool ; -- whether a defective VV has been added
|
||||
} ;
|
||||
|
||||
showVPH : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp ->
|
||||
vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.s ! vf ++ vp.vComp ! agr ++ vp.embComp ;
|
||||
showVPH = overload {
|
||||
showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' Simul ;
|
||||
showVPH : Anteriority -> VerbForm -> Agr -> VPH -> Str = showVPH'
|
||||
} ;
|
||||
|
||||
showVPH' : Anteriority -> VerbForm -> Agr -> VPH -> Str =
|
||||
\ant,vf,agr,vp -> vp.ad ++ vp.comp ! agr ++ vp.obj
|
||||
++ vp.prefix ++ vp.s ! vf
|
||||
++ vp.vComp ! agr ! ant ++ vp.embComp ;
|
||||
|
||||
Compl : Type = {s : Str ; ra : Str} ;
|
||||
|
||||
@@ -93,9 +107,9 @@ oper
|
||||
ad,
|
||||
obj,
|
||||
embComp = [];
|
||||
wish = False ;
|
||||
comp,
|
||||
vComp = \\_ => [] } ;
|
||||
defVV = False ;
|
||||
comp = \\_ => [] ;
|
||||
vComp = \\_,_ => [] } ;
|
||||
|
||||
predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb ->
|
||||
predV verb ** {c2 = {s = verb.c1 ; ra = []} } ;
|
||||
@@ -116,9 +130,10 @@ oper
|
||||
comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a
|
||||
} ;
|
||||
|
||||
insertVV : (Agr => Str) -> VPH -> VPH = \obj1,vp -> vp ** {
|
||||
wish = True ;
|
||||
vComp = \\a => vp.comp ! a ++ obj1 ! a ; -- IL why this is vp.comp and not vp.vComp??
|
||||
insertVV : Bool -> (Agr => Anteriority => Str) -> VPH -> VPH =
|
||||
\isDef,infcl,vp -> vp ** {
|
||||
defVV = True; --isDef ;
|
||||
vComp = \\agr,ant => vp.vComp ! agr ! ant ++ infcl ! agr ! ant ;
|
||||
} ;
|
||||
|
||||
embComp : Str -> VPH -> VPH = \str,vp -> vp ** {
|
||||
@@ -135,8 +150,14 @@ oper
|
||||
|
||||
---- AR 14/9/2017 trying to fix isAux = True case by inserting conjThat
|
||||
---- but don't know yet how False should be affect
|
||||
infVV : Bool -> VPH -> (Agr => Str) = \isAux,vp ->
|
||||
\\agr => if_then_Str isAux conjThat [] ++ showVPH (Vvform agr) agr vp ;
|
||||
infVV : VV -> VPH -> (Agr => Anteriority => Str) = \vv,vp ->
|
||||
\\agr,ant => if_then_Str vv.isAux conjThat [] ++
|
||||
case <ant,vv.compl> of {
|
||||
<_Simul,Subj> => showVPH (VSubj Pos agr) agr vp ;
|
||||
<_Simul,Indic> => showVPH (VAor Pos agr) agr vp
|
||||
-- TODO: confirm <Anter,_> => showVPH PerfStem agr vp ++ subjAux Pos agr
|
||||
} ;
|
||||
|
||||
|
||||
insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** {
|
||||
ad = vp.ad ++ ad ;
|
||||
@@ -153,23 +174,32 @@ oper
|
||||
---- AR 18/9/2017 intermediate SClause to preserve SOV in e.g. QuestionPes.QuestSlash
|
||||
|
||||
clTable : VPH -> (Agr => VPHTense => Polarity => Str) = \vp ->
|
||||
\\agr,vt,pol => case vt of {
|
||||
TA Pres Simul => vp.s ! VF pol (VFPres PrImperf) agr ;
|
||||
TA Pres Anter => vp.s ! VF pol (VFPres PrPerf) agr ;
|
||||
TA Past Simul => vp.s ! VF pol (VFPast PstAorist) agr ;
|
||||
TA Past Anter => vp.s ! VF pol (VFPast PstPerf) agr ;
|
||||
TA Fut Simul => case vp.wish of {
|
||||
True => vp.s ! VF pol (VFPres PrImperf) agr ;
|
||||
False => vp.s ! VF pol (VFFut FtAorist) agr } ;
|
||||
TA Fut Anter => case vp.wish of {
|
||||
_True => vp.s ! VF pol (VFPres PrPerf) agr } ;
|
||||
--False => vp.s ! VF pol (VFFut FtAorist) agr } ; -- verb form need to be confirmed
|
||||
TA Cond Simul => vp.s ! VF pol (VFPast PstImperf) agr ;
|
||||
TA Cond Anter => vp.s ! VF pol (VFPast PstImperf) agr ; -- verb form to be confirmed
|
||||
VVVForm => vp.s ! Vvform agr ; -- AR 21/3/2018
|
||||
VRoot1 => vp.s ! Root1 {- ++ Predef.Bind ++ "ه" -} -- AR 22/3/2018
|
||||
|
||||
} ;
|
||||
\\agr,vt,pol => vp.prefix ++ case vt of {
|
||||
TA Pres Simul => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; -- for reg. verbs, VAor pol is invariant and negation comes in ImpPrefix.
|
||||
TA Pres Anter => vp.s ! VPerf pol agr ;
|
||||
TA Past Simul => vp.s ! VPast pol agr ;
|
||||
TA Past Anter =>
|
||||
case vp.defVV of {
|
||||
True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ;
|
||||
False => vp.s ! PerfStem ++ pluperfAux pol agr } ;
|
||||
TA Fut Simul =>
|
||||
case vp.defVV of {
|
||||
True => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ;
|
||||
False => futAux pol agr ++ vp.s ! PastStem
|
||||
} ; -- PastStem is, despite the name, used for future too. /IL
|
||||
TA Fut Anter =>
|
||||
case vp.defVV of {
|
||||
True => vp.s ! VPerf pol agr ;
|
||||
False => "خواسته" ++ pluperfAux pol agr ++ vp.s ! PastStem
|
||||
} ; -- verb form need to be confirmed
|
||||
TA Cond Simul => vp.s ! VSubj pol agr ;
|
||||
TA Cond Anter =>
|
||||
case vp.defVV of {
|
||||
True => vp.s ! VSubj pol agr ;
|
||||
False => vp.s ! PerfStem ++ subjAux pol agr } ; -- verb form to be confirmed
|
||||
VVVForm => vp.s ! VSubj Pos agr ; -- AR 21/3/2018
|
||||
VRoot1 => vp.s ! PastStem -- AR 22/3/2018
|
||||
} ;
|
||||
|
||||
mkClause : NP -> VPH -> Clause = \np,vp ->
|
||||
let cls = mkSlClause np vp
|
||||
@@ -181,23 +211,34 @@ oper
|
||||
OQuest => "آیا" } ;
|
||||
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 ++ vps ++ vp.vComp ! np.a ++ vp.embComp
|
||||
let vps = clTable vp ! np.a ! vt ! b ;
|
||||
ant = case vp.defVV of {
|
||||
True => case vt of {TA Pres _ => Simul ; TA _ a => Anter ; _ => Simul} ;
|
||||
False => Simul }
|
||||
in vp.ad ++ vp.comp ! np.a ++ vp.obj ++ vps
|
||||
++ vp.vComp ! np.a ! ant ++ vp.embComp
|
||||
};
|
||||
|
||||
--Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
|
||||
mkSClause : Str -> Agr -> VPH -> Clause = \subj,agr,vp -> {
|
||||
s = \\vt,b,ord =>
|
||||
let vps = clTable vp ! agr ! vt ! b ;
|
||||
quest = case ord of { ODir => [] ; OQuest => "آیا" }
|
||||
in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vps ++ vp.vComp ! agr ++ vp.embComp
|
||||
quest = case ord of { ODir => [] ; OQuest => "آیا" } ;
|
||||
ant = case vp.defVV of {
|
||||
True => case vt of {TA Pres _ => Simul ; TA _ a => Anter ; _ => Simul} ;
|
||||
False => Simul }
|
||||
in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj
|
||||
++ vps ++ vp.vComp ! agr ! ant ++ vp.embComp
|
||||
};
|
||||
|
||||
predProg : VPH -> VPH = \verb -> verb ** {
|
||||
s = \\vh => case vh of {
|
||||
VF pol (VFPres PrImperf) agr => haveVerb.s ! VF Pos (VFPres PrImperf) agr ++ verb.s ! VF pol (VFPres PrImperf) agr ;
|
||||
VF pol (VFPast PstAorist) agr => haveVerb.s ! VF Pos (VFPast PstAorist) agr ++ verb.s ! VF pol (VFPast PstAorist) agr ;
|
||||
VF pol (VFPast PstImperf) agr => haveVerb.s ! VF Pos (VFPast PstAorist) agr ++ verb.s ! VF pol (VFPast PstImperf) agr ;
|
||||
ImpPrefix _ => [] ;
|
||||
VAor p a => haveVerb.s ! VAor Pos a ++ verb.s ! ImpPrefix p ++ verb.s ! VAor Pos a ;
|
||||
VPast p a => haveVerb.s ! VPast Pos a ++ verb.s ! ImpPrefix p ++ verb.s ! VPast Pos a ; -- negation in ImpPrefix
|
||||
-- VF pol (VFPres PrImperf) agr => haveVerb.s ! VF Pos (VFPres PrImperf) agr ++ verb.s ! VF pol (VFPres PrImperf) agr ;
|
||||
-- VF pol (VFPast PstAorist) agr => haveVerb.s ! VF Pos (VFPast PstAorist) agr ++ verb.s ! VF pol (VFPast PstAorist) agr ;
|
||||
-- VF pol (VFPast PstImperf) agr => haveVerb.s ! VF Pos (VFPast PstAorist) agr ++ verb.s ! VF pol (VFPast PstImperf) agr ;
|
||||
_ => verb.s ! vh } ;
|
||||
subj = VIntrans
|
||||
} ;
|
||||
@@ -211,7 +252,7 @@ oper
|
||||
-- Noun Phrase
|
||||
-----------------------------
|
||||
|
||||
partNP : Str -> Str = \str -> (Prelude.glue str "ه") ++ "شده" ;
|
||||
partNP : Verb -> Str = \v -> v.prefix ++ v.s ! PerfStem ++ "شده" ;
|
||||
|
||||
-----------------------------------
|
||||
-- Reflexive Pronouns
|
||||
|
||||
@@ -12,9 +12,9 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
||||
ImpVP vp = {
|
||||
s = \\pol,n =>
|
||||
let agr = Ag (numImp n) P2 ;
|
||||
in case vp.wish of {
|
||||
True => vp.s ! Imp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.embComp;
|
||||
False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ++ vp.s ! Imp pol (numImp n) ++ vp.embComp }
|
||||
in case vp.defVV of {
|
||||
True => vp.s ! VImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! Simul ++ vp.embComp;
|
||||
False => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! Simul ++ vp.s ! VImp pol (numImp n) ++ vp.embComp }
|
||||
} ;
|
||||
|
||||
SlashVP np vp =
|
||||
@@ -59,6 +59,6 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
||||
AdvS a s = {s = a.s ++ s.s} ;
|
||||
|
||||
RelS s r = {s = s.s ++ r.s ! agrP3 Sg} ;
|
||||
SSubjS s sj s = { s = s.s ++ sj.s ++ s.s};
|
||||
SSubjS s1 sj s2 = { s = s1.s ++ sj.s ++ s2.s};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ concrete StructuralPes of Structural = CatPes **
|
||||
by8agent_Prep = ss "توسط" ;
|
||||
by8means_Prep = ss "با" ;
|
||||
-- can8know_VV,can_VV = mkV "سکن" ** { isAux = True} ;
|
||||
can_VV = mkV_1 " توانستن " ** { isAux = True} ; ---- AR
|
||||
can_VV = mkVV (mkV_1 "توانستن") ; ---- AR
|
||||
during_Prep = ss ["در طول"] ;
|
||||
either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ;
|
||||
-- everybody_NP = MassNP (UseN (MorphoPnb.mkN11 ["هر کwی"])); -- not a good way coz need to include NounPnb
|
||||
@@ -49,29 +49,16 @@ concrete StructuralPes of Structural = CatPes **
|
||||
more_CAdv = {s = "بیشتر" ; p = "" } ;
|
||||
most_Predet = ss "اکثر";
|
||||
much_Det = mkDet ["مقدار زیادی"] Pl ;
|
||||
must_VV = invarV " بایستن " ** {isAux = True} ; ---- AR
|
||||
-- must_VV = {
|
||||
-- s = table {
|
||||
-- VVF VInf => ["هوe تْ"] ;
|
||||
-- VVF VPres => "مست" ;
|
||||
-- VVF VPPart => ["هد تْ"] ;
|
||||
-- VVF VPresPart => ["هونگ تْ"] ;
|
||||
-- VVF VPast => ["هد تْ"] ; --# notpresent
|
||||
-- VVPastNeg => ["هدn'ت تْ"] ; --# notpresent
|
||||
-- VVPresNeg => "مستn'ت"
|
||||
-- } ;
|
||||
-- isAux = True
|
||||
-- } ;
|
||||
-----b no_Phr = ss "نْ" ;
|
||||
|
||||
|
||||
must_VV =
|
||||
let must_V : V = defV "بایستن" "باید" "بایست" ;
|
||||
in mkVV must_V ;
|
||||
-- TODO: ** {isDef=True} ; past tense forms with مجبور+beVerb
|
||||
no_Utt = ss "نه" ;
|
||||
on_Prep = ss "روی" ;
|
||||
-- one_Quant = demoPN "یک" ; -- DEPRECATED
|
||||
only_Predet = ss "فقط" ;
|
||||
or_Conj = sd2 [] "یا" ** {n = Sg} ;
|
||||
otherwise_PConj = ss ["درغیراین صورت"] ;
|
||||
part_Prep = ss "از" ; -- the object following it should be in Ezafa form
|
||||
part_Prep = ss "از" ; -- TODO: the object following it should be in Ezafa form
|
||||
please_Voc = ss "لطفاً" ;
|
||||
possess_Prep = ss "" ; -- will be handeled in Ezafeh
|
||||
quite_Adv = ss "کاملاً" ;
|
||||
@@ -95,7 +82,7 @@ concrete StructuralPes of Structural = CatPes **
|
||||
to_Prep = ss "به" ** {lock_Prep = <>};
|
||||
under_Prep = ss "زیر" ** {lock_Prep = <>};
|
||||
very_AdA = ss "خیلی" ;
|
||||
want_VV = mkV "خواستن" "خواه" ** { isAux = False} ;
|
||||
want_VV = mkVV False subjunctive (mkV "خواستن" "خواه") ; --not aux
|
||||
we_Pron = personalPron "ما" "مان" Pl P1 ;
|
||||
whatSg_IP = {s = ["چه چیزی"] ; n = Sg } ;
|
||||
whatPl_IP = {s = ["چه چیزهایی"] ; n = Pl } ;
|
||||
@@ -136,16 +123,16 @@ concrete StructuralPes of Structural = CatPes **
|
||||
-- MorphoPes.haveVerb: "have" as auxiliary.
|
||||
have_V2 = haveVerb ** {
|
||||
s = table {
|
||||
R.Imp Pos Sg => "داشته باش" ;
|
||||
R.Imp Pos Pl => "داشته باشید" ;
|
||||
R.Imp Neg Sg => "نداشته باش" ;
|
||||
R.Imp Neg Pl => "نداشته باشید" ;
|
||||
Vvform (Ag Sg P1) => "داشته باشم" ;
|
||||
Vvform (Ag Sg P2) => "داشته باشی" ;
|
||||
Vvform (Ag Sg P3) => "داشته باشد" ;
|
||||
Vvform (Ag Pl P1) => "داشته باشیم" ;
|
||||
Vvform (Ag Pl P2) => "داشته باشید" ;
|
||||
Vvform (Ag Pl P3) => "داشته باشند" ;
|
||||
VImp Pos Sg => "داشته باش" ;
|
||||
VImp Pos Pl => "داشته باشید" ;
|
||||
VImp Neg Sg => "نداشته باش" ;
|
||||
VImp Neg Pl => "نداشته باشید" ;
|
||||
VSubj _ (Ag Sg P1) => "داشته باشم" ;
|
||||
VSubj _ (Ag Sg P2) => "داشته باشی" ;
|
||||
VSubj _ (Ag Sg P3) => "داشته باشد" ;
|
||||
VSubj _ (Ag Pl P1) => "داشته باشیم" ;
|
||||
VSubj _ (Ag Pl P2) => "داشته باشید" ;
|
||||
VSubj _ (Ag Pl P3) => "داشته باشند" ;
|
||||
x => haveVerb.s ! x } ;
|
||||
c2 = {
|
||||
s = [] ;
|
||||
|
||||
@@ -14,20 +14,20 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
|
||||
|
||||
ComplSlash = complSlash ;
|
||||
|
||||
ComplVV v vp = insertVV (infVV v.isAux vp) (predV v) ;
|
||||
ComplVV v vp = insertVV v.isDef (infVV v vp) (predV v) ;
|
||||
ComplVS v s = embComp (conjThat ++ s.s) (predV v) ;
|
||||
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 = []}} ;
|
||||
SlashV2V v vp = insertVV v.isDef (infVV v vp) (predV v) **{c2 = {s = v.c1 ; ra = []}} ;
|
||||
|
||||
SlashV2S v s = v ** embComp (conjThat ++ s.s) (predV v) ;
|
||||
SlashV2Q v q = v ** embComp (q.s ! QIndir) (predV v) ;
|
||||
SlashV2A v ap = v ** insertObj (ap.s ! Bare) (predV v) ; ---- paint it red , check form of adjective
|
||||
|
||||
SlashVV vv vps = vps ** insertVV (infVV vv.isAux vps) (predV vv) ;
|
||||
SlashVV vv vps = vps ** insertVV vv.isDef (infVV vv vps) (predV vv) ;
|
||||
|
||||
SlashV2VNP v2v np vps =
|
||||
let vvVP : VPH = insertVV (infVV v2v.isAux vps) (predV v2v) ;
|
||||
let vvVP : VPH = insertVV v2v.isDef (infVV v2v 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} ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user