diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 17fd6dcc7..0cfd20e4f 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -62,8 +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 ; mod : Mod}; - Art = {s : Str} ; + Quant = ResPes.Quant ; ---- Numeral diff --git a/src/persian/ExtendPes.gf b/src/persian/ExtendPes.gf index 11836635e..5b4441d76 100644 --- a/src/persian/ExtendPes.gf +++ b/src/persian/ExtendPes.gf @@ -11,7 +11,7 @@ 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 diff --git a/src/persian/MorphoPes.gf b/src/persian/MorphoPes.gf index af5d6e63f..c42aafe42 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 -> { + s = table { Sg => table {Bare => sg ; Ezafe => mkEzafe sg ; Clitic => mkEnclic sg ; @@ -102,7 +108,7 @@ oper Clitic => mkEnclic pl ; Poss => mkPossStem pl } } ; - animacy = ani + animacy = ani ; isCmpd = NotCmpd } ; -- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e) @@ -111,20 +117,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 5b4abc0fa..35d70ba65 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 { + IsCmpd => det.sp ; + NotCmpd => det.sp } ; + 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 ; -- 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 ; -- 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 cbef4532b..30faba830 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 {