From 55decd9317698129312e798e77c3e5a84d472d7f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 7 Feb 2019 19:49:06 +0100 Subject: [PATCH] (Pes) Noun is indefinite if predicative and modified by adjective According to this source: https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/ --- src/persian/CatPes.gf | 2 +- src/persian/ConjunctionPes.gf | 8 +++--- src/persian/NounPes.gf | 49 ++++++++++++++++------------------- src/persian/ResPes.gf | 3 ++- src/persian/SymbolPes.gf | 15 +++++------ src/persian/VerbPes.gf | 20 ++++++++++---- 6 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 453f891cb..7623fe1ac 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -53,7 +53,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { ---- Noun - CN = ResPes.Noun ; + CN = ResPes.CN ; NP = ResPes.NP ; Pron = {s : Str ; ps : Str ; a : Agr}; diff --git a/src/persian/ConjunctionPes.gf b/src/persian/ConjunctionPes.gf index ffe4f556d..e439848eb 100644 --- a/src/persian/ConjunctionPes.gf +++ b/src/persian/ConjunctionPes.gf @@ -12,7 +12,7 @@ concrete ConjunctionPes of Conjunction = ConjAdv = conjunctDistrSS ; -- ConjAdv conj advs = conjunctDistrTable Gender conj advs ; - ConjNP conj ss = conjunctDistrTable NPCase conj ss ** { + ConjNP conj ss = ss ** conjunctDistrTable NPCase conj ss ** { a = conjAgr (agrP3 conj.n) ss.a ; animacy = ss.animacy ; } ; @@ -28,9 +28,9 @@ concrete ConjunctionPes of Conjunction = -- BaseAdv x y = twoTable Gender x y ; ConsAdv = consrSS comma ; -- ConsAdv xs x = consrTable Gender comma xs x ; - BaseNP x y = twoTable NPCase x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy + BaseNP x y = y ** twoTable NPCase x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy BaseRS x y = twoTable Agr x y ** {c = x.c}; - ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ; + ConsNP xs x = xs ** consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ; ConsRS xs x = consrTable Agr comma xs x ** { c = xs.c}; -- BaseAP x y = twoTable3 Number Gender Case x y ; -- ** {isPre = andB x.isPre y.isPre} ; BaseAP x y = twoTable Ezafa x y ** {adv = x.adv}; @@ -39,7 +39,7 @@ concrete ConjunctionPes of Conjunction = lincat [S] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ; - [NP] = {s1,s2 : NPCase => Str ; a : Agr ; animacy : Animacy } ; + [NP] = {s1,s2 : NPCase => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ; [AP] = {s1,s2 : Ezafa => Str ; adv : Str} ; [RS] = {s1,s2 : Agr => Str }; diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index ebaed2e6f..abb8c070a 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -3,19 +3,18 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { flags optimize=all_subs ; lin - DetCN det cn = { s = \\_ => - case of { - => cn.s ! aEzafa ! det.n ++ det.s ; - => det.s ++ cn.s ! bEzafa ! det.n ; - => cn.s ! aEzafa ! Sg ++ det.s ; -- noun modified by a number is invariably singular - => det.s ++ cn.s ! bEzafa ! Sg - }; + DetCN det cn = cn ** {s = \\npc => + case of { + => det.s ++ cn.s ! ez ! det.n ; -- det is not from Pron, retain NPForm. + => cn.s ! aEzafa ! det.n ++ det.s ; -- det is from Pron, cn is in aEzafa. + => det.s ++ cn.s ! ez ! Sg ; -- noun modified by a number is invariably singular + => cn.s ! aEzafa ! Sg ++ det.s + } ; a = agrP3 det.n ; - animacy = cn.animacy } ; - UsePN pn = {s = \\_ => pn.s ; a = agrP3 Sg ; animacy = pn.animacy } ; - UsePron p = {s = \\_ => p.s ; a = p.a ; animacy = Animate} ; + UsePN pn = pn ** {s = \\_ => pn.s ; a = agrP3 Sg ; hasAdj = False} ; + UsePron p = p ** {s = \\_ => p.s ; animacy = Animate ; hasAdj = False} ; PredetNP pred np = np ** { s = \\ez => pred.s ++ np.s ! ez @@ -50,6 +49,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { DetNP det = { s = \\_ => det.s ; ---- case a = agrP3 det.n ; + hasAdj = False ; animacy = Inanimate } ; @@ -73,47 +73,42 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { DefArt = {s = \\_ => [] ; a = defaultAgr ; fromPron = False} ; IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgr ; fromPron = False} ; - MassNP cn = {s =\\c => case c of { + MassNP cn = cn ** {s =\\c => case c of { NPC bEzafa => cn.s ! bEzafa ! Sg ; NPC aEzafa => cn.s ! aEzafa ! Sg ; NPC enClic => cn.s ! enClic ! Sg }; a = agrP3 Sg ; - animacy = cn.animacy } ; - UseN n = n ; - UseN2 n = n ; + UseN n = n ** {hasAdj=False}; + UseN2 n = n ** {hasAdj=False}; - Use2N3 f = { - s = f.s; + Use2N3 f = f ** { c = f.c2; - animacy = f.animacy; definitness = True } ; - Use3N3 f = { - s = f.s ; + Use3N3 f = f ** { c = f.c3; - animacy = f.animacy; definitness = True } ; - ComplN2 f x = { + ComplN2 f x = f ** { s = \\ez,n => f.s ! ez ! n ++ f.c ++ x.s ! NPC ez ; - animacy = f.animacy; - definitness = True + definitness = True ; + hasAdj = False ; }; - ComplN3 f x = { + ComplN3 f x = f ** { s = \\ez,n => f.s ! ez ! n ++ f.c2 ++ x.s ! NPC ez ; c = f.c3; - animacy = f.animacy; definitness = True; } ; AdjCN ap cn = cn ** { - s = \\ez,n => cn.s ! aEzafa ! n ++ ap.s ! ez -- check the form of adjective and also cn.s!ez!n changed from cn.s!aEzafa!n to have correct enclicitic form other wise it creats wrong enclictic form of old man - } ; + s = \\ez,n => cn.s ! aEzafa ! n ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!aEzafa!n to have correct enclicitic form other wise it creats wrong enclictic form of old man + hasAdj = True + } ; RelCN cn rs = cn ** { s = \\ez,n => cn.s ! enClic ! n ++ rs.s ! agrP3 n ; diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index fc9c1b30f..039553ad2 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -25,7 +25,8 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { oper Compl : Type = {s : Str ; ra : Str ; c : VType} ; - NP : Type = {s : NPCase => Str ; a : Agr ; animacy : Animacy } ; + CN : Type = Noun ** {hasAdj : Bool} ; -- for getting the right form when NP/CN is a predicate + NP : Type = {s : NPCase => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ; VPHSlash : Type = VPH ** {c2 : Compl} ; oper diff --git a/src/persian/SymbolPes.gf b/src/persian/SymbolPes.gf index ef8e2922b..2e7b1ee1e 100644 --- a/src/persian/SymbolPes.gf +++ b/src/persian/SymbolPes.gf @@ -10,20 +10,17 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in { IntPN i = {s = i.s ; animacy = Inanimate} ; FloatPN i = {s = i.s ; animacy = Inanimate} ; NumPN i = {s = i.s ; animacy = Inanimate} ; - CNIntNP cn i = { + CNIntNP cn i = cn ** { s = \\ez => cn.s ! aEzafa ! Sg ++ i.s ; - a = agrP3 Sg ; - animacy = cn.animacy + a = agrP3 Sg } ; - CNSymbNP det cn xs = { + CNSymbNP det cn xs = cn ** { s = \\ez => det.s ++ cn.s ! aEzafa ! det.n ++ xs.s ; - a = agrP3 det.n ; - animacy = cn.animacy + a = agrP3 det.n } ; - CNNumNP cn i = { + CNNumNP cn i = cn ** { s = \\ez => cn.s ! aEzafa ! Sg ++ i.s ; - a = agrP3 Sg ; - animacy = cn.animacy + a = agrP3 Sg } ; SymbS sy = sy ; diff --git a/src/persian/VerbPes.gf b/src/persian/VerbPes.gf index a382dd391..eacd0aca2 100644 --- a/src/persian/VerbPes.gf +++ b/src/persian/VerbPes.gf @@ -1,4 +1,4 @@ -concrete VerbPes of Verb = CatPes ** open ResPes in { +concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in { flags coding = utf8; flags optimize=all_subs ; @@ -42,9 +42,19 @@ concrete VerbPes of Verb = CatPes ** open ResPes in { PassV2 v = predV v ; -- need to be fixed CompAP ap ={s = \\_ => ap.s ! bEzafa} ; -- check form of adjective CompAdv adv = {s = \\_ => adv.s } ; - CompCN cn = {s = \\a => cn.s ! bEzafa ! giveNumber a } ; - -- IL 2019-01-31 changed bEzafa to enClic according to - -- https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/ - CompNP np = {s = \\a => np.s ! NPC enClic} ; + + -- see https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/ + CompCN cn = { + s = \\a => cn.s ! case cn.hasAdj of { + False => bEzafa ; + True => enClic } + ! giveNumber a + } ; + + CompNP np = { + s = \\a => np.s ! case np.hasAdj of { + False => NPC bEzafa ; + True => NPC enClic } + } ; }