From c25a2365857cc624d49a52b8067f8a788ebbde1d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 22 Feb 2019 11:16:49 +0100 Subject: [PATCH] (Pes) Make poss.suff. attach to the head for N2,N3 --- src/persian/CatPes.gf | 2 +- src/persian/LexiconPes.gf | 6 ++--- src/persian/NounPes.gf | 44 ++++++++++++++++++++----------------- src/persian/ParadigmsPes.gf | 4 ++-- src/persian/ResPes.gf | 5 ++++- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 490ae3fd..014b1c65 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -89,7 +89,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { N = ResPes.Noun ; - N2 = ResPes.Noun ** {c : Str}; + N2 = ResPes.Noun ** {c : Str ; compl : Str}; -- when N3 is made to N2, need to retain compl N3 = ResPes.Noun ** {c2 : Str ; c3 : Str} ; PN = {s : Str ; animacy : Animacy} ; diff --git a/src/persian/LexiconPes.gf b/src/persian/LexiconPes.gf index e5d10b9d..0574740a 100644 --- a/src/persian/LexiconPes.gf +++ b/src/persian/LexiconPes.gf @@ -35,7 +35,7 @@ concrete LexiconPes of Lexicon = CatPes ** bread_N = mkN01 "نان" inanimate; break_V2 = mkV2 (mkV "شکستن" "شکن") "را"; broad_A = mkA "وسیع" ; - brother_N2 = (mkN01 "برادر" animate) ** {c=""}; + brother_N2 = mkN2 (mkN01 "برادر" animate) []; brown_A = mkA ["قهوه ای"] ; butter_N = mkN01 "کره" inanimate; buy_V2 = mkV2 (mkV_1 "خریدن") "را"; @@ -75,7 +75,7 @@ concrete LexiconPes of Lexicon = CatPes ** empty_A = mkA "خالی" ; enemy_N = mkN02 "دشمن" animate; factory_N = mkN01 "کارخانه" inanimate; - father_N2 = (mkN02 "پدر" animate) ** {c=""}; + father_N2 = mkN2 (mkN02 "پدر" animate) []; fear_VS = mkV_1 "ترسیدن"; find_V2 = mkV2 (compoundV "پیدا" doVerb) "را"; fish_N = mkN01 "ماهی" animate; @@ -125,7 +125,7 @@ concrete LexiconPes of Lexicon = CatPes ** meat_N = mkN01 "گوشت" inanimate; milk_N = mkN01 "شیر" inanimate; moon_N = mkN01 "ماه" inanimate; -- is this not a proper noun? - mother_N2 = (mkN02 "مادر" animate) ** {c=""}; + mother_N2 = mkN2 (mkN02 "مادر" animate) [] ; mountain_N = mkN01 "کوه" inanimate; music_N = mkN "موسیقی" "موسیقی" animate; narrow_A = mkA "باریک" ; diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index 8a2552a0..ea4f3826 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -3,13 +3,14 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { flags optimize=all_subs ; lin - DetCN det cn = cn ** {s = \\mod => - case of { - => det.s ++ cn.s ! det.n ! mod ; -- det is not from Pron, retain NPForm. - => cn.s ! det.n ! X ++ det.s ; -- det is from Pron, cn is in Ezafe. - => det.s ++ cn.s ! Sg ! mod ; -- noun modified by a number is invariably singular - => cn.s ! Sg ! X ++ det.s - } ; + DetCN det cn = cn ** { + s = \\m => + 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 ++ cn.compl ; -- det doesn't require a special form, keep the Mod=>Str table + x => cn.s ! num ! x ++ det.s ++ cn.compl } ; -- det requires a special form a = agrP3 det.n ; } ; @@ -29,7 +30,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { } ; AdvNP np adv = np ** { - s = \\ez => np.s ! Ezafe ++ adv.s + s = \\ez => np.s ! Ezafe ++ adv.s } ; DetQuantOrd quant num ord = { @@ -71,39 +72,40 @@ 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} ; + IndefArt = {s = table {Sg => IndefArticle ; Pl => []} ; a = defaultAgr ; mod = Bare} ; MassNP cn = cn ** { s = cn.s ! Sg ; a = agrP3 Sg } ; - UseN n = n ** {hasAdj=False}; - UseN2 n = n ** {hasAdj=False}; + UseN n = n ** {hasAdj=False; compl=[]}; + UseN2 n = n ** {hasAdj=False; compl=[]}; Use2N3 f = f ** { c = f.c2; - definitness = True + compl = [] } ; Use3N3 f = f ** { c = f.c3; - definitness = True + compl = [] } ; ComplN2 n2 np = n2 ** { - s = \\n,m => n2.s ! n ! Ezafe ++ n2.c ++ np.s ! m ; + s = \\n,m => n2.s ! n ! Ezafe ; + compl = n2.compl ++ n2.c ++ np.s ! Bare ; hasAdj = False }; - ComplN3 f x = f ** { - s = \\n,ez => f.s ! n ! Ezafe ++ f.c2 ++ x.s ! ez ; - c = f.c3; - definitness = True; + ComplN3 n3 np = n3 ** { + s = \\n,m => n3.s ! n ! Ezafe ; + compl = n3.c2 ++ np.s ! Bare ; + c = n3.c3; } ; AdjCN ap cn = cn ** { - s = \\n,ez => cn.s ! n ! Ezafe ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!Ezafe!n to have correct enclicitic form other wise it creats wrong enclictic form of old man + s = \\n,ez => cn.s ! n ! Ezafe ++ ap.s ! ez ; hasAdj = True } ; @@ -115,6 +117,8 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { SentCN cn sc = cn ** {s = \\n,m => cn.s ! n ! m ++ sc.s} ; - ApposCN cn np = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ np.s ! m ; definitness = True} ; + -- correct for /city Paris/, incorrect for /king John/ + -- ApposNP in ExtendPes works for /king John/ (no ezafe). + ApposCN cn np = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ np.s ! m} ; } diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index 01bdf6db..a4ffc683 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -265,9 +265,9 @@ oper mkN2 = overload { mkN2 : N -> Str -> N2 - = \n,c -> lin N2 (n ** {c = c}) ; + = \n,c -> lin N2 (n ** {c = c ; compl=[]}) ; mkN2 : N -> Prep -> Str -> N2 -- hidden from puclic API - = \n,p,c -> lin N2 (n ** {c = p.s ; c2 = c}) -- there is no c2 + = \n,p,c -> lin N2 (n ** {c = p.s ; c2 = c; compl=[]}) -- there is no c2 } ; mkN3 = overload { diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index 4df0e412..9f428415 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -24,7 +24,10 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { oper Compl : Type = {s : Str ; ra : Str ; c : VType} ; - CN : Type = Noun ** {hasAdj : Bool} ; -- for getting the right form when NP/CN is a predicate + CN : Type = Noun ** { + hasAdj : Bool ; -- to get the right form when CN is a predicate + compl : Str -- to make possessive suffix attach to the right word + } ; NP : Type = {s : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ; VPHSlash : Type = VPH ** {c2 : Compl} ;