From 781f049fdded71be32551dced1c6fe753296fa4a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 31 Jan 2019 16:38:46 +0100 Subject: [PATCH] (Pes) Add isNum to Num + Ord; fix bug in DetCN, DetQuant and DetQuantOrd See https://sites.la.utexas.edu/persian_online_resources/nouns/ "A noun modified by a number is never pluralized; that is to say, it is invariably singular" In the old grammar, DetQuant would always make the Det into numeral, and so Sg was always chosen in DetCN. --- src/persian/CatPes.gf | 4 ++-- src/persian/NounPes.gf | 46 +++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index b360842a..65e35413 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -59,9 +59,9 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in { Pron = {s : Str ; ps : Str ; a : AgrPes}; Det = ResPes.Determiner ; Predet = {s : Str} ; - Num = {s : Str ; n : Number} ; + Num = {s : Str ; n : Number ; isNum : Bool} ; Card = {s : Str; n : Number} ; - Ord = {s : Str; n : Number} ; + Ord = {s : Str; n : Number ; isNum : Bool} ; Quant = {s: Number => Str ; a:AgrPes ; fromPron : Bool}; Art = {s : Str} ; diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index a925ca3f..0667c1d2 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -3,13 +3,13 @@ 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.n ; - => det.s ++ cn.s ! bEzafa ! det.n ; -- det.n ; - => cn.s ! aEzafa ! Sg ++ det.s ; - => det.s ++ cn.s ! bEzafa ! Sg - }; + 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 + }; a = agrPesP3 det.n ; animacy = cn.animacy } ; @@ -42,17 +42,17 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { } ; DetQuantOrd quant num ord = { - s = quant.s ! num.n ++ num.s ++ ord.s ; - isNum = True; - fromPron = quant.fromPron ; + s = quant.s ! num.n ++ num.s ++ ord.s ; + isNum = orB num.isNum ord.isNum ; + fromPron = quant.fromPron ; n = num.n } ; DetQuant quant num = { - s = quant.s ! num.n ++ num.s; - isNum = True ; -- this does not work in case of 'these women' but works in case of 'five women' - fromPron = quant.fromPron ; - n = num.n + s = quant.s ! num.n ++ num.s; + isNum = num.isNum; + fromPron = quant.fromPron ; + n = num.n } ; DetNP det = { @@ -63,20 +63,20 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { PossPron p = {s = \\_ => p.ps ; a = p.a ; fromPron = True} ; - NumSg = {s = [] ; n = Sg} ; - NumPl = {s = [] ; n = Pl} ; + NumSg = {s = [] ; n = Sg ; isNum = False} ; + NumPl = {s = [] ; n = Pl ; isNum = False} ; -- from here - NumCard n = n ** {hasCard = True} ; + NumCard n = n ** {isNum = True} ; - NumDigits n = {s = n.s ! NCard ; n = n.n} ; - OrdDigits n = {s = n.s ! NOrd; n = n.n} ; + NumDigits n = n ** {s = n.s ! NCard; isNum = True} ; + OrdDigits n = n ** {s = n.s ! NOrd ; isNum = True} ; - NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; - OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ; + NumNumeral n = n ** {s = n.s ! NCard; isNum = True} ; + OrdNumeral n = n ** {s = n.s ! NOrd ; isNum = True} ; -- to here - AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; + AdNum adn num = num ** {s = adn.s ++ num.s} ; - OrdSuperl a = {s = a.s ! bEzafa ++ taryn; n = Sg} ; -- check the form of adjective + OrdSuperl a = {s = a.s ! bEzafa ++ taryn; n = Sg ; isNum=False} ; -- check the form of adjective DefArt = {s = \\_ => [] ; a = defaultAgrPes ; fromPron = False} ; IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgrPes ; fromPron = False} ;