From 61838b818ea404c29129a7ded45e228a516fa9d9 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 7 Feb 2019 19:34:21 +0100 Subject: [PATCH 1/3] (Pes) Fix orthography and add a vowel diacritic in mkEzafa and mkEnclic --- src/persian/MorphoPes.gf | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/persian/MorphoPes.gf b/src/persian/MorphoPes.gf index 9b5e2a97..9c4037ee 100644 --- a/src/persian/MorphoPes.gf +++ b/src/persian/MorphoPes.gf @@ -55,23 +55,24 @@ oper oper mkEzafa : Str -> Str ; - mkEzafa str = case str of { - st + "اه" => str ; - st + "وه" => str ; + mkEzafa str = let kasre = "ِ" in + case str of { + st + "اه" => str + kasre ; + st + "وه" => str + kasre ; st + "ه" => st + "ۀ" ; -- str ++ "ی" ; - st + "او" => str ; - st + "وو" => str ; + st + "او" => str + kasre ; + st + "وو" => str + kasre ; st + "و" => str + "ی" ; st + "ا" => str + "ی" ; - _ => str - }; + _ => str + kasre + }; + mkEnclic : Str -> Str ; mkEnclic str = case str of { - st + "ا" => str ++ "یی" ; - st + "و" => str ++ "یی" ; - st + "ی" => str ++ "یی" ; -- TODO - st + "ه" => str ++ "یی" ; - _ => str + "ی" + st + ("ا"|"و") => zwnj str "یی" ; -- ی after a long vowel to help pronunciation + st + "اه" => str + "ی" ; -- here ه is a consonant, so single ی + st + ("ی"|"ه") => zwnj str "ای" ; -- after ی or ه as a vowel, add an alif to help pronunciation + _ => str + "ی" -- any other case: just a single ی } ; Noun = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool } ; From a45cc462e397ee8461359228d3bc0a31a96e991a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 7 Feb 2019 19:37:17 +0100 Subject: [PATCH 2/3] (Pes) Fixes in VV constructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add the conjunction که 'that' in VV * Fix word order in imperatives formed of VV+complement --- src/persian/ResPes.gf | 7 ++++++- src/persian/SentencePes.gf | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index d5201ab9..fc9c1b30 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -34,6 +34,11 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { Neg => CNeg b } ; + cpol2pol : CPolarity -> Polarity = \cp -> case cp of { + CPos => Pos ; + _ => Neg + } ; + ----------------------- --- Verb Phrase ----------------------- @@ -144,7 +149,7 @@ oper insertVV : (Agr => Str) -> VPH -> VPH = \obj1,vp -> vp ** { wish = True ; - vComp = \\a => vp.comp ! a ++ obj1 ! a ; + vComp = \\a => vp.comp ! a ++ conjThat ++ obj1 ! a ; } ; insertObj2 : (Str) -> VPH -> VPH = \obj1,vp -> vp ** { diff --git a/src/persian/SentencePes.gf b/src/persian/SentencePes.gf index 500a9760..2b48d2b5 100644 --- a/src/persian/SentencePes.gf +++ b/src/persian/SentencePes.gf @@ -10,12 +10,12 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in { PredSCVP sc vp = mkSClause ("این" ++ sc.s) (defaultAgr) vp ; ImpVP vp = { - s = \\pol,n => + s = \\cpol,n => let agr = Ag (numImp n) P2 ; - in case pol of { - CPos => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ vp.s ! VPImp Pos (numImp n) ++ vp.embComp; - CNeg _ => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ vp.s ! VPImp Neg (numImp n) ++ vp.embComp - } ; + pol = cpol2pol cpol ; + in case vp.wish of { + True => vp.s ! VPImp pol (numImp n) ++ vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ vp.embComp; + False => vp.ad ++ vp.comp ! agr ++ vp.obj.s ++ vp.vComp ! agr ++ vp.s ! VPImp pol (numImp n) ++ vp.embComp } } ; From 55decd9317698129312e798e77c3e5a84d472d7f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 7 Feb 2019 19:49:06 +0100 Subject: [PATCH 3/3] (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 453f891c..7623fe1a 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 ffe4f556..e439848e 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 ebaed2e6..abb8c070 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 fc9c1b30..039553ad 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 ef8e2922..2e7b1ee1 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 a382dd39..eacd0aca 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 } + } ; }