diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 17fd6dcc..fe5d2cab 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -1,4 +1,4 @@ -concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { +concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { flags optimize=all_subs ; @@ -44,9 +44,6 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { VPSlash = ResPes.VPHSlash ; Comp = {s : Agr => Str} ; ----- Adv - Adv = {s : Str} ; - ---- Adjective AP = ResPes.Adjective ; @@ -62,8 +59,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 ; mod : Mod}; - Art = {s : Str} ; + Quant = ResPes.Quant ; ---- Numeral diff --git a/src/persian/ExtendPes.gf b/src/persian/ExtendPes.gf index 077c87f7..77b8c986 100644 --- a/src/persian/ExtendPes.gf +++ b/src/persian/ExtendPes.gf @@ -2,7 +2,8 @@ concrete ExtendPes of Extend = CatPes ** ExtendFunctor - [ - GenNP, ApposNP + GenNP, ApposNP, ICompAP + ,GerundNP,GerundCN,GerundAdv ] with (Grammar=GrammarPes) ** open Prelude, ResPes in { @@ -11,11 +12,22 @@ lin -- NP -> Quant ; -- this man's 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/ + s = \\num,cmpd => np.s ! Bare -- possesser is unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/ } ; -- : NP -> NP -> NP ApposNP np1 np2 = np1 ** { s = \\m => np1.s ! m ++ np2.s ! m } ; + + ICompAP ap = {s = "چقدر" ++ ap.s ! Bare} ; + -- : VP -> CN ; -- publishing of the document (can get a determiner) + GerundCN vp = useN (indeclN (showVPH Inf defaultAgr vp)) ; + + -- : VP -> NP ; -- publishing the document (by nature definite) + GerundNP vp = indeclNP (showVPH Inf defaultAgr vp) ; + + -- : VP -> Adv ; -- publishing the document (prepositionless adverb) + GerundAdv vp = lin Adv {s = showVPH Inf defaultAgr vp} ; + } diff --git a/src/persian/ExtraPes.gf b/src/persian/ExtraPes.gf index 6d8e6634..9a348e22 100644 --- a/src/persian/ExtraPes.gf +++ b/src/persian/ExtraPes.gf @@ -1,19 +1,10 @@ concrete ExtraPes of ExtraPesAbs = CatPes ** - open ResPes, Coordination, Prelude, MorphoPes, ParadigmsPes in { + open ResPes, ExtendPes, Coordination, Prelude, MorphoPes, ParadigmsPes in { flags coding = utf8; lin - GenNP np = {s = \\_ => np.s ! Ezafe ; a = np.a ; mod = Ezafe} ; -- changed from mod=False for Phrasebook + GenNP = ExtendPes.GenNP ; --- 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 } diff --git a/src/persian/GrammarPes.gf b/src/persian/GrammarPes.gf index 0749eb17..42603e11 100644 --- a/src/persian/GrammarPes.gf +++ b/src/persian/GrammarPes.gf @@ -1,8 +1,8 @@ --# -path=.:../abstract:../common:../prelude - concrete GrammarPes of Grammar = - NounPes, - VerbPes, + concrete GrammarPes of Grammar = + NounPes, + VerbPes, AdjectivePes, AdverbPes, NumeralPes, @@ -10,16 +10,14 @@ QuestionPes, RelativePes, ConjunctionPes, - + PhrasePes, - TextPes - [Adv], + TextPes, StructuralPes, - TenseX - [Adv], - IdiomPes + TenseX, + IdiomPes ** { flags startcat = Phr ; unlexer = text ; lexer = text ; } - - diff --git a/src/persian/MorphoPes.gf b/src/persian/MorphoPes.gf index af5d6e63..ab02b871 100644 --- a/src/persian/MorphoPes.gf +++ b/src/persian/MorphoPes.gf @@ -31,6 +31,7 @@ param Animacy = Animate | Inanimate ; Mod = Bare | Ezafe | Clitic | Poss ; Agr = Ag Number Person ; + CmpdStatus = IsCmpd | NotCmpd ; ------------------------------------------ -- Agreement transformations @@ -90,9 +91,14 @@ oper _ => str + "ی" -- any other case: just a single ی } ; - Noun = {s : Number => Mod => Str ; animacy : Animacy} ; - mkN : (x1,x2 : Str) -> Animacy -> Noun = \sg,pl,ani -> { - s = table { + Noun = { + s : Number => Mod => Str ; + animacy : Animacy ; + isCmpd : CmpdStatus -- Affects possession: awkward to use poss. suff. with compound nouns + } ; + + mkN : (x1,x2 : Str) -> Animacy -> Noun = \sg,pl,ani -> indeclN sg ** { + s = table { Sg => table {Bare => sg ; Ezafe => mkEzafe sg ; Clitic => mkEnclic sg ; @@ -100,10 +106,13 @@ oper Pl => table {Bare => pl ; Ezafe => mkEzafe pl ; Clitic => mkEnclic pl ; - Poss => mkPossStem pl } - } ; - animacy = ani - } ; + Poss => mkPossStem pl }} + } ; + + indeclN : Str -> Noun = \s -> { + s = \\_,_ => s ; + animacy = Inanimate ; isCmpd = NotCmpd + } ; -- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e) -- Arabic nouns ends with h. also taken as Masc @@ -111,20 +120,30 @@ oper --------------------- --Determiners -------------------- -Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; mod : Mod} ; + BaseQuant : Type = { + mod : Mod } ; - makeDet : Str -> Number -> Bool -> Determiner = \str,n,b -> { - s = str; - isNum = b; - mod = Bare ; - n = n - }; + Determiner : Type = BaseQuant ** { + s : Str ; + sp : Str ; -- stand-alone form for DetNP and possessive pronouns with compound nouns + n : Number ; + isNum : Bool + } ; - makeQuant : Str -> Str -> {s : Number => Str ; a : Agr; mod : Mod } = \sg,pl -> { - s = table {Sg => sg ; Pl => pl} ; - mod = Bare ; - a = agrP3 Sg - }; + Quant : Type = BaseQuant ** { + s : Number => CmpdStatus => Str} ; + + makeDet : Str -> Number -> Bool -> Determiner = \str,n,b -> { + s,sp = str; + isNum = b; + mod = Bare ; + n = n + }; + + makeQuant : Str -> Str -> Quant = \sg,pl -> { + s = table {Sg => \\_ => sg ; Pl => \\_ => pl} ; + mod = Bare ; + }; --------------------------- -- Adjectives -------------------------- diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index 5b4abc0f..c517e246 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -8,9 +8,15 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { let num : Number = case det.isNum of { True => Sg ; -- noun modified by a number is invariably singular False => det.n } ; - 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 + mod : Mod = case of { + => Ezafe ; -- If CN is compound and Det is poss.pron, don't use poss.suff but Ezafe and full form of pronoun + _ => det.mod } ; + detStr : Str = case cn.isCmpd of { + NotCmpd => det.s ; -- possessive suffix + IsCmpd => det.sp } ; -- full form + in case mod of { + Bare => detStr ++ cn.s ! num ! m ; -- det doesn't require a special form, keep the Mod=>Str table + x => cn.s ! num ! x ++ detStr } ; -- det requires a special form a = agrP3 det.n ; compl = cn.compl ! det.n } ; @@ -35,28 +41,35 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { } ; DetQuantOrd quant num ord = { - s = quant.s ! num.n ++ num.s ++ ord.s ; + s = quant.s ! num.n ! NotCmpd ++ num.s ++ ord.s ; + sp = quant.s ! num.n ! IsCmpd ++ num.s ++ ord.s ; -- only matters for PossPron isNum = orB num.isNum ord.isNum ; mod = quant.mod ; n = num.n } ; DetQuant quant num = { - s = quant.s ! num.n ++ num.s; + s = quant.s ! num.n ! NotCmpd ++ num.s ; + sp = quant.s ! num.n ! IsCmpd ++ num.s ; -- only matters for PossPron isNum = num.isNum; mod = quant.mod ; n = num.n } ; DetNP det = { - s = \\_ => det.s ; ---- case + s = \\_ => det.sp ; a = agrP3 det.n ; hasAdj = False ; animacy = Inanimate ; compl = [] } ; - PossPron p = {s = \\_ => BIND ++ p.ps ; a = p.a ; mod = Poss} ; + PossPron p = { + s = \\_ => table { + NotCmpd => BIND ++ p.ps ; + IsCmpd => p.s } ; -- is a compound + a = p.a ; + mod = Poss} ; -- make into Ezafe if DetCN if N is compound NumSg = {s = [] ; n = Sg ; isNum = False} ; NumPl = {s = [] ; n = Pl ; isNum = False} ; @@ -73,8 +86,8 @@ 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 - DefArt = {s = \\_ => [] ; a = defaultAgr ; mod = Bare} ; - IndefArt = {s = table {Sg => IndefArticle ; Pl => []} ; a = defaultAgr ; mod = Bare} ; + DefArt = {s = \\_,_ => [] ; mod = Bare} ; + IndefArt = {s = table {Sg => \\_ => IndefArticle ; Pl => \\_ => []} ; mod = Bare} ; MassNP cn = cn ** { s = cn.s ! Sg ; diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index cbef4532..30faba83 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -53,7 +53,9 @@ oper cmpdN : N -> Str -> N -- Compound noun with an invariable modifier /after/ the head. NB. no ezāfe. = mkCmpdNoun2 ; -- e.g. مأمور پلیس '/officer/ police'. cmpdN : N -> N -> N -- Compound noun with ezafe (Nی N) - = \n1,n2 -> n1 ** {s = \\n,m => n1.s ! n ! Ezafe ++ n2.s ! n ! m} ; + = \n1,n2 -> n1 ** { + s = \\n,m => n1.s ! n ! Ezafe ++ n2.s ! n ! m ; + isCmpd = IsCmpd} ; } ; -- Proper names @@ -290,10 +292,14 @@ oper \s1,s2,s3,s4,n,g -> let p = mkIntPronForm s1 s2 s3 s4 in { s = p.s ; n = n ; g = g ; lock_IP = <>}; -} - mkCmpdNoun1 : Str -> N -> N - = \s,noun -> noun ** {s =\\ez,n => s ++ noun.s ! ez ! n}; - mkCmpdNoun2 : N -> Str -> N - = \noun,s -> noun ** {s =\\ez,n => noun.s ! ez ! n ++ s}; + mkCmpdNoun1 : Str -> N -> N = \s,noun -> + noun ** { + s = \\ez,n => s ++ noun.s ! ez ! n ; + isCmpd = IsCmpd} ; + mkCmpdNoun2 : N -> Str -> N = \noun,s -> + noun ** { + s = \\ez,n => noun.s ! ez ! n ++ s ; + isCmpd = IsCmpd}; -- hidden from public API compoundV = overload {