Merge pull request #204 from inariksit/persian

(Pes) Add mkInterj + minor fixes in some prepositions
This commit is contained in:
Inari Listenmaa
2019-03-20 16:11:27 +01:00
committed by GitHub
10 changed files with 49 additions and 24 deletions

View File

@@ -11,12 +11,12 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in {
s = a.adv ++ cadv.p ++ cadv.s ++ s.s ! Indic; s = a.adv ++ cadv.p ++ cadv.s ++ s.s ! Indic;
} ; } ;
PrepNP prep np = {s = prep.s ++ np.s ! Bare } ; PrepNP prep np = {s = appComp prep np.s} ;
AdAdv ada adv = { s = ada.s ++ adv.s} ; AdAdv ada adv = { s = ada.s ++ adv.s} ;
-- SubjS = cc2 ; -- SubjS = cc2 ;
SubjS sub snt = {s = sub.s ++ "که" ++ snt.s ! sub.compl} ; SubjS sub snt = {s = sub.s ++ conjThat ++ snt.s ! sub.compl} ;
AdnCAdv cadv = {s = cadv.s ++ "از"} ; AdnCAdv cadv = {s = cadv.s ++ "از"} ;
} }

View File

@@ -18,7 +18,7 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
vp : ResPes.TAnt => Polarity => Order => Str ; vp : ResPes.TAnt => Polarity => Order => Str ;
c2 : ResPes.Compl c2 : ResPes.Compl
} ; } ;
Imp = {s : Polarity => ImpForm => Str} ; Imp = {s : Polarity => Number => Str} ;
---- Question ---- Question
QCl = {s : ResPes.TAnt => Polarity => Str} ; QCl = {s : ResPes.TAnt => Polarity => Str} ;

View File

@@ -2,7 +2,7 @@
concrete ExtendPes of Extend = concrete ExtendPes of Extend =
CatPes ** ExtendFunctor - [ CatPes ** ExtendFunctor - [
GenNP, ApposNP, ICompAP, AdvIsNP GenNP, ApposNP, ICompAP, AdvIsNP, InOrderToVP, ByVP
,GerundNP,GerundCN,GerundAdv,EmbedPresPart ,GerundNP,GerundCN,GerundAdv,EmbedPresPart
] ]
with (Grammar=GrammarPes) with (Grammar=GrammarPes)
@@ -10,7 +10,7 @@ concrete ExtendPes of Extend =
lin lin
-- NP -> Quant ; -- this man's -- NP -> Quant ; -- this man's
GenNP np = np ** { GenNP np = makeQuant [] [] ** np ** {
mod = Ezafe ; -- the possessed will get Ezafe mod = Ezafe ; -- the possessed will get Ezafe
s = \\num,cmpd => np2str np -- possesser is unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/ s = \\num,cmpd => np2str np -- possesser is unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/
} ; } ;
@@ -35,4 +35,14 @@ lin
-- : Adv -> NP -> Cl -- here is the car / here are the cars -- : Adv -> NP -> Cl -- here is the car / here are the cars
AdvIsNP adv np = mkClause (indeclNP adv.s ** {a = np.a}) (UseComp (CompNP np)) ; AdvIsNP adv np = mkClause (indeclNP adv.s ** {a = np.a}) (UseComp (CompNP np)) ;
-- : VP -> Adv ; -- by publishing the document
ByVP vp = lin Adv {s = with_Prep.s ++ showVPH Inf defaultAgr vp} ;
-- : VP -> Adv ; -- (in order) to publish the document
InOrderToVP vp = lin Adv {s = for_Prep.s ++ showVPH PerfStem defaultAgr vp} ;
} }

View File

@@ -119,7 +119,7 @@ oper
--Determiners --Determiners
-------------------- --------------------
BaseQuant : Type = { BaseQuant : Type = {
mod : Mod } ; mod : Mod} ;
Determiner : Type = BaseQuant ** { Determiner : Type = BaseQuant ** {
s : Str ; s : Str ;
@@ -129,7 +129,8 @@ oper
} ; } ;
Quant : Type = BaseQuant ** { Quant : Type = BaseQuant ** {
s : Number => CmpdStatus => Str} ; s : Number => CmpdStatus => Str ;
isDef : Bool } ;
makeDet : Str -> Number -> Bool -> Determiner = \str,n,b -> { makeDet : Str -> Number -> Bool -> Determiner = \str,n,b -> {
s,sp = str; s,sp = str;
@@ -141,6 +142,7 @@ oper
makeQuant : Str -> Str -> Quant = \sg,pl -> { makeQuant : Str -> Str -> Quant = \sg,pl -> {
s = table {Sg => \\_ => sg ; Pl => \\_ => pl} ; s = table {Sg => \\_ => sg ; Pl => \\_ => pl} ;
mod = Bare ; mod = Bare ;
isDef = True
}; };
--------------------------- ---------------------------
-- Adjectives -- Adjectives

View File

@@ -41,17 +41,27 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
s = \\ez => np.s ! Ezafe ++ adv.s s = \\ez => np.s ! Ezafe ++ adv.s
} ; } ;
DetQuantOrd quant num ord = { DetQuantOrd quant num ord =
s = quant.s ! num.n ! NotCmpd ++ num.s ++ ord.s ; let cs : CmpdStatus => Str = case <num.isNum,num.n,quant.isDef> of {
sp = quant.s ! num.n ! IsCmpd ++ num.s ++ ord.s ; -- only matters for PossPron <True,Sg,False> => \\_ => num.s ++ ord.s ;
_ => \\c => quant.s ! num.n ! c ++ num.s ++ ord.s} ;
in {
s = cs ! NotCmpd ;
sp = cs ! IsCmpd ; -- only matters for PossPron
isNum = orB num.isNum ord.isNum ; isNum = orB num.isNum ord.isNum ;
mod = quant.mod ; mod = quant.mod ;
n = num.n n = num.n
} ; } ;
DetQuant quant num = { DetQuant quant num =
s = quant.s ! num.n ! NotCmpd ++ num.s ; let cs : CmpdStatus => Str = case <num.isNum,num.n,quant.isDef> of {
sp = quant.s ! num.n ! IsCmpd ++ num.s ; -- only matters for PossPron <True,Sg,False> => \\_ => num.s ;
_ => \\c => quant.s ! num.n ! c ++ num.s } ;
in {
s = cs ! NotCmpd ;
sp = cs ! IsCmpd ; -- only matters for PossPron
isNum = num.isNum; isNum = num.isNum;
mod = quant.mod ; mod = quant.mod ;
n = num.n n = num.n
@@ -65,7 +75,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
relpron = Ance -- TODO check if this works for all Dets relpron = Ance -- TODO check if this works for all Dets
} ; } ;
PossPron p = { PossPron p = DefArt ** {
s = \\_ => table { s = \\_ => table {
NotCmpd => BIND ++ p.ps ; NotCmpd => BIND ++ p.ps ;
IsCmpd => p.s } ; -- is a compound IsCmpd => p.s } ; -- is a compound
@@ -87,8 +97,8 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
OrdSuperl a = {s = a.s ! Bare ++ taryn; n = Sg ; isNum=False ; isPre = True} ; -- 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 = makeQuant [] [] ;
IndefArt = {s = table {Sg => \\_ => IndefArticle ; Pl => \\_ => []} ; mod = Bare} ; IndefArt = makeQuant IndefArticle [] ** {isDef = False} ;
MassNP cn = emptyNP ** cn ** { MassNP cn = emptyNP ** cn ** {
s = \\m => cn.s ! Sg ! m ++ cn.compl ! Sg ; s = \\m => cn.s ! Sg ! m ++ cn.compl ! Sg ;

View File

@@ -214,6 +214,9 @@ oper
= \vvf,s -> lin Subj {s=s ; compl=vvf} = \vvf,s -> lin Subj {s=s ; compl=vvf}
} ; } ;
mkInterj : Str -> Interj
= \s -> lin Interj {s=s} ;
--. --.
--2 Definitions of paradigms --2 Definitions of paradigms

View File

@@ -3,9 +3,9 @@ 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} ;
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg False} ; UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False} ; UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True} ; UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
UttIP, --- Acc also UttIP, --- Acc also
UttQS, UttQS,

View File

@@ -151,7 +151,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. ad = vp.ad -- because complVV doesn't include ad! for word order.
} ; } ;

View File

@@ -11,8 +11,8 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
ImpVP vp = { ImpVP vp = {
s = \\pol,n => s = \\pol,n =>
let agr = Ag (numImp n) P2 ; let agr = Ag n P2 ;
vps = vp.prefix ++ vp.s ! VImp pol (numImp n) vps = vp.prefix ++ vp.s ! VImp pol n
in case vp.vvtype of { in case vp.vvtype of {
NoVV => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vps ++ vp.embComp ; NoVV => vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vps ++ vp.embComp ;
_ => vps ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp } _ => vps ++ vp.ad ++ vp.comp ! agr ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp }

View File

@@ -57,9 +57,9 @@ concrete StructuralPes of Structural = CatPes **
only_Predet = ss "فقط" ; only_Predet = ss "فقط" ;
or_Conj = sd2 [] "یا" ** {n = Sg} ; or_Conj = sd2 [] "یا" ** {n = Sg} ;
otherwise_PConj = ss ["درغیراین صورت"] ; otherwise_PConj = ss ["درغیراین صورت"] ;
part_Prep = mkPrep "از" ; -- TODO: the object following it should be in Ezafa form part_Prep = mkPrep "از" Ezafe ;
please_Voc = ss "لطفاً" ; please_Voc = ss "لطفاً" ;
possess_Prep = mkPrep "" ; -- will be handeled in Ezafeh possess_Prep = mkPrep [] Ezafe ;
quite_Adv = ss "کاملاً" ; quite_Adv = ss "کاملاً" ;
she_Pron = R.agr2pron ! Ag Sg P3 ; she_Pron = R.agr2pron ! Ag Sg P3 ;
so_AdA = ss "بسیار" ; so_AdA = ss "بسیار" ;