From 02b231363ead80600c31ae9714dc94bcbcb9e3d5 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 18 Apr 2019 18:10:13 +0200 Subject: [PATCH 1/4] (Pes) Add a parameter to VS whether to select subjunctive or indicative Co-Authored-By: Nasrin Mostofian --- src/persian/CatPes.gf | 5 +++-- src/persian/LexiconPes.gf | 8 ++++---- src/persian/ParadigmsPes.gf | 4 ++-- src/persian/VerbPes.gf | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index cfcce220c..cd39cb741 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -12,7 +12,7 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { ---- Sentence - Cl = ResPes.Clause ; + Cl = ResPes.Clause ; -- TODO: like romance does "no tiene ningún", i.e. negative quant/det/NP forces negation in Cl and S ClSlash = { subj : Str ; vp : ResPes.TAnt => Polarity => Order => Str ; @@ -72,9 +72,10 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { -----b Conj = {s : Str ; n : Number} ; -----b DConj = {s1,s2 : Str ; n : Number} ; Subj = {s : Str ; compl : VVForm} ; -- subjunctive or indicative + VS = ResPes.Verb ** {compl : VVForm} ; -- subjunctive or indicative Prep = Compl ; ---- Open lexical classes, e.g. Lexicon - V, VS, VQ = ResPes.Verb ; + V, VQ = ResPes.Verb ; V2, VA, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ; V3 = ResPes.Verb ** {c2, c3 : Compl} ; diff --git a/src/persian/LexiconPes.gf b/src/persian/LexiconPes.gf index e5cc52626..5207e035c 100644 --- a/src/persian/LexiconPes.gf +++ b/src/persian/LexiconPes.gf @@ -76,7 +76,7 @@ concrete LexiconPes of Lexicon = CatPes ** enemy_N = mkN02 "دشمن" animate; factory_N = mkN01 "کارخانه" inanimate; father_N2 = mkN2 (mkN02 "پدر" animate) []; - fear_VS = mkV_1 "ترسیدن"; + fear_VS = mkVS (mkV_1 "ترسیدن") ; find_V2 = mkV2 (compoundV "پیدا" doVerb) "را"; fish_N = mkN01 "ماهی" animate; floor_N = mkN01 "زمین" inanimate; -- Note: floor in persian can have 3 different translations @@ -97,7 +97,7 @@ concrete LexiconPes of Lexicon = CatPes ** hat_N = mkN01 "کلاه" inanimate; hear_V2 = mkV2 (mkV "شنیدن" "شنو") "را" ; hill_N = mkN01 "تپه" inanimate; - hope_VS = compoundV "امیدوار" beVerb; + hope_VS = mkVS (compoundV "امیدوار" beVerb) ; horse_N = mkN01 "اسب" animate; hot_A = mkA "داغ" ["داغ داغ"] ; house_N = mkN01 "خانه" inanimate; @@ -106,7 +106,7 @@ concrete LexiconPes of Lexicon = CatPes ** iron_N = mkN01 "آهن" inanimate; king_N = mkN "پادشاه" "پادشاهان" animate; know_V2 = mkV2 (mkV "شناختن" "شناس") "را"; - know_VS = (mkV_1 "دانستن") ; -- danestan -> dan ; needs explicit mkV_1 + know_VS = mkVS (mkV_1 "دانستن") ; -- danestan -> dan ; needs explicit mkV_1 know_VQ = (mkV_1 "دانستن") ; lake_N = mkN01 "دریاچه" inanimate; lamp_N = mkN01 "چراغ" inanimate; -- also "لامپ", but they have different usage @@ -157,7 +157,7 @@ concrete LexiconPes of Lexicon = CatPes ** roof_N = mkN01 "بام" inanimate; -- has variant "سقف" rubber_N = mkN01 "پاککن" inanimate; -- also "لاستیک" run_V = mkV_1 "دویدن" ; - say_VS = mkV "گفتن" "گوی" ; + say_VS = mkVS (mkV "گفتن" "گوی") ; school_N = mkN "مدرسه" "مدارس" inanimate; science_N = mkN "علم" "علوم" inanimate; -- also "دانش" sea_N = mkN01 "دریا" inanimate; diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index b29dc62df..f0b4716e8 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -148,9 +148,9 @@ oper mkVS = overload { mkVS : Str -> VS -- predictable verb with sentence complement - = \s -> lin VS (regV s) ; + = \s -> lin VS (regV s ** {compl=subjunctive}) ; mkVS : V -> VS -- VS out of a verb - = \v -> lin VS v + = \v -> lin VS (v ** {compl=subjunctive}) } ; mkVV = overload { diff --git a/src/persian/VerbPes.gf b/src/persian/VerbPes.gf index cff7d80d3..a31a610cc 100644 --- a/src/persian/VerbPes.gf +++ b/src/persian/VerbPes.gf @@ -13,7 +13,7 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in { ComplSlash = complSlash ; ComplVV = insertVV ; - ComplVS v s = embComp (conjThat ++ s.s ! Indic) (predV v) ; + ComplVS v s = embComp (conjThat ++ s.s ! v.compl) (predV v) ; ComplVQ v q = embComp (conjThat ++ q.s) (predV v) ; ComplVA v ap = insertObj (appComp v.c2 ap.s) (predV v) ; -- check form of adjective From 1719924f5692bd601cddbce5f6b704ce450f9889 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 18 Apr 2019 18:31:59 +0200 Subject: [PATCH 2/4] (Pes) Add parameter in A+AP about AP's placement as predicative Co-Authored-By: Nasrin Mostofian --- src/persian/AdjectivePes.gf | 3 ++- src/persian/ConjunctionPes.gf | 2 +- src/persian/MorphoPes.gf | 5 +++-- src/persian/ParadigmsPes.gf | 3 +++ src/persian/VerbPes.gf | 6 +++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/persian/AdjectivePes.gf b/src/persian/AdjectivePes.gf index cad4b4a9a..ca7bed159 100644 --- a/src/persian/AdjectivePes.gf +++ b/src/persian/AdjectivePes.gf @@ -43,7 +43,8 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in { AdjOrd ord = { s = \\_ => ord.s ; adv = ord.s ; - isPre = ord.isPre + isPre = ord.isPre ; + afterPrefix = False ; } ; AdvAP ap adv = ap ** { diff --git a/src/persian/ConjunctionPes.gf b/src/persian/ConjunctionPes.gf index 1aa4a2e35..86cda5cd2 100644 --- a/src/persian/ConjunctionPes.gf +++ b/src/persian/ConjunctionPes.gf @@ -48,7 +48,7 @@ concrete ConjunctionPes of Conjunction = isCmpd : CmpdStatus; hasAdj : Bool ; compl : Number => Str} ; - [AP] = {s1,s2 : Mod => Str ; adv : Str ; isPre : Bool} ; + [AP] = {s1,s2 : Mod => Str ; adv : Str ; isPre,afterPrefix : Bool} ; [RS] = {s1,s2 : Agr => Str ; rp : RelPron => Str} ; oper diff --git a/src/persian/MorphoPes.gf b/src/persian/MorphoPes.gf index d5378f19a..2c294f37b 100644 --- a/src/persian/MorphoPes.gf +++ b/src/persian/MorphoPes.gf @@ -150,7 +150,8 @@ oper Adjective : Type = { s : Mod => Str ; adv : Str ; - isPre : Bool + isPre : Bool ; -- as attributive + afterPrefix : Bool ; -- as predicative, does it go between the prefix and the light verb } ; mkAdj : Str -> Str -> Adjective = \adj,adv -> { @@ -159,7 +160,7 @@ oper Clitic => mkEnclic adj ; Poss => mkPossStem adj } ; - adv = adv ; isPre = False + adv = adv ; isPre = False ; afterPrefix = True ; }; ------------------------------------------------------------------ diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index f0b4716e8..dd86f8e06 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -88,6 +88,7 @@ oper mkA : Str -> A ; -- Regular adjective, same form for adjective and adverb. mkA : (adj,adv : Str) -> A -- Different forms for adjective and adverb. } ; + prefixA : A -> A ; -- Adjective that comes before the noun mkA2 : (married,to : Str) -> A2 -- Takes string and complementiser, returns A2. = \a,c -> lin A2 (mkAdj a a ** {c2 = c}) ; @@ -303,6 +304,8 @@ oper = \a,c -> lin A2 (mkAdj a a ** {c2 = c}) } ; + prefixA a = a ** {isPre=True}; + preA : (adj,adv : Str) -> A = \adj,adv -> lin A ((mkAdj adj adv) ** {isPre=True}) ; diff --git a/src/persian/VerbPes.gf b/src/persian/VerbPes.gf index a31a610cc..50a037149 100644 --- a/src/persian/VerbPes.gf +++ b/src/persian/VerbPes.gf @@ -15,7 +15,11 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in { ComplVV = insertVV ; ComplVS v s = embComp (conjThat ++ s.s ! v.compl) (predV v) ; ComplVQ v q = embComp (conjThat ++ q.s) (predV v) ; - ComplVA v ap = insertObj (appComp v.c2 ap.s) (predV v) ; -- check form of adjective + ComplVA v ap = let adjStr = appComp v.c2 ap.s in + case ap.afterPrefix of { + True => predV (v ** {prefix = v.prefix ++ adjStr}) ; + False => insertObj adjStr (predV v) -- check form of adjective + } ; SlashVV vv vps = vps ** ComplVV vv vps ; SlashV2S v s = predVc v ** embComp (conjThat ++ s.s ! Indic) (predV v) ; From 6bf31fa9ec67a91a114d294d847ea4ff19a4bd72 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 18 Apr 2019 18:44:44 +0200 Subject: [PATCH 3/4] (Pes) misc small fixes and additions Co-Authored-By: Nasrin Mostofian --- src/persian/LexiconPes.gf | 2 +- src/persian/ResPes.gf | 10 ++++++---- src/persian/StructuralPes.gf | 2 +- src/persian/SymbolPes.gf | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/persian/LexiconPes.gf b/src/persian/LexiconPes.gf index 5207e035c..28ca642ea 100644 --- a/src/persian/LexiconPes.gf +++ b/src/persian/LexiconPes.gf @@ -215,7 +215,7 @@ concrete LexiconPes of Lexicon = CatPes ** woman_N = mkN02 "زن" animate; wonder_VQ = compoundV "متعجب" beVerb ; wood_N = mkN01 "چوب" inanimate; - write_V2 = mkV2 (mkV "نوشتن" "نویس") "را" ; + write_V2 = mkV2 (mkV "نوشتن" "نویس") ; -- would need ra with a definite object, but better rule of thumb to go without ra /NM yellow_A = mkA "زرد" ; young_A = mkA "جوان""جوانانه" ; do_V2 = mkV2 (compoundV "انجام" giveVerb) "را"; diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index 22b3bbc1c..a9a06f4aa 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -131,11 +131,13 @@ oper predVc : (Verb ** {c2 : Compl}) -> VPHSlash = \verb -> predV verb ** vs verb.c2 ; - passV : Verb -> VPH = \v -> predV v ** { + passV : Verb -> VPH = \v -> passVP (predV v) ; + + passVP : VPH -> VPH = \vp -> vp ** { s = becomeVerb.s ; - prefix = case v.passive of { - Add => v.s ! PerfStem ++ v.prefix ; - Replace => v.prefix + prefix = case vp.passive of { + Add => vp.s ! PerfStem ++ vp.prefix ; + Replace => vp.prefix } ; } ; -- --------------------- diff --git a/src/persian/StructuralPes.gf b/src/persian/StructuralPes.gf index 6ecc2817f..e4d0c1fd9 100644 --- a/src/persian/StructuralPes.gf +++ b/src/persian/StructuralPes.gf @@ -26,7 +26,7 @@ concrete StructuralPes of Structural = CatPes ** either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ; -- everybody_NP = R.indeclNP "هر کwی"; every_Det = mkDet "هر" Sg ; --- everything_NP = R.indeclNP ["هر XE"])); + everything_NP = DetCN (mkDet "همه" Sg) (UseN (mkN "چیز")) ; everywhere_Adv = ss ["هر جا"] ; few_Det = mkDet ["تعداد کمی"] Pl True; -- check for_Prep = mkPrep "برای" Ezafe ; diff --git a/src/persian/SymbolPes.gf b/src/persian/SymbolPes.gf index 59f02f6c7..26298aedc 100644 --- a/src/persian/SymbolPes.gf +++ b/src/persian/SymbolPes.gf @@ -24,8 +24,8 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in { } ; SymbS sy = {s = \\_ => sy.s} ; - SymbNum sy = { s = sy.s ; n = Pl } ; - SymbOrd sy = { s = sy.s ++ "wN" ; n = Pl; isNum,isPre=False} ; + SymbNum sy = {s = sy.s ; n = Pl} ; + SymbOrd sy = {s = sy.s ; n = Sg ; isNum,isPre=False} ; lincat From aac108808c442308b1e32956d30d31d5881f26b2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 18 Apr 2019 18:45:31 +0200 Subject: [PATCH 4/4] (Pes) Fixes in verb tenses Co-Authored-By: Nasrin Mostofian --- src/persian/ResPes.gf | 77 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index a9a06f4aa..8235a477b 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -67,16 +67,23 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { ----------------------- param VVType = NoVV | FullVV | DefVV ; - VVForm = Indic | Subj ; - VVTense = VVPres | VVPerf | VVPast ; -- VVPast Anteriority ??? + VVForm = Indic | Subj ; ---| SubjPast ; -- TODO extend this to VV, VS and Subj + VVTense = VVPres | VVPast VVForm ; TAnt = TA Tense Anteriority ; oper - -- TODO: all forms - ta2vvt : TAnt -> VVTense = \ta -> case ta of { - TA Pres Anter => VVPerf ; - TA Past _ => VVPast ; + -- VVPast Subj is another possibility, used in constructions such as + -- قاتل نمی توانسته آنجا بوده باشد، چون او آن زمان در پاریس بوده + -- The form is created in complVV, but not currently used in other functions. /IL + ta2vvt : TAnt -> VVType -> VVTense = \ta,vvtype -> case ta of { + TA Pres Anter | + TA Past _ => VVPast Indic ; + TA Cond Simul => VVPres ; + TA Cond Anter => + case vvtype of { + DefVV => VVPast Indic ; + _ => VVPres } ; _ => VVPres } ; VV : Type = Verb ** { @@ -95,20 +102,18 @@ oper } ; showVPH = overload { - showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' VVPres ; - showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH' + showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' False VVPres ; + showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH' False } ; - showVPH' : VVTense -> VerbForm -> Agr -> VPH -> Str = - \ant,vf,agr,vp -> vp.ad ++ vp.comp ! agr ++ vp.obj - ++ vp.prefix ++ vp.s ! vf - ++ vp.vComp ! agr ! ant ++ vp.embComp ; - - -- A hack: we reuse the obj field for the VP complement in - -- SlashV2V and this is needed to get the right word order for complVV. - showVPHvv : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp -> - vp.comp ! agr ++ vp.prefix ++ vp.s ! vf -- vp.ad is missing on purpose! we add it in insertVV. - ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ; + showVPH' : Bool -> VVTense -> VerbForm -> Agr -> VPH -> Str = + \showImpPref,ant,vf,agr,vp -> + let impPref = case showImpPref of { + True => vp.s ! ImpPrefix Pos ; + False => [] } + in vp.ad ++ vp.comp ! agr ++ vp.obj + ++ vp.prefix ++ impPref ++ vp.s ! vf + ++ vp.vComp ! agr ! ant ++ vp.embComp ; Compl : Type = {s : Str ; ra : Str ; mod : Mod} ; @@ -161,7 +166,6 @@ oper insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** { vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ; vvtype = case vv.isDef of {True => DefVV ; _ => FullVV} ; - ad = vp.ad -- because complVV doesn't include ad! for word order. } ; embComp : Str -> VPH -> VPH = \str,vp -> vp ** { @@ -183,15 +187,15 @@ oper \\agr,ant => if_then_Str vv.isAux conjThat [] ++ case of { -- Auxiliaries with defective inflection: complement inflects in tense - => showVPHvv (VPast Pos agr) agr vp ; --- => showVPH PerfStem agr vp ++ pluperfAux Pos agr ; -- TODO do we need this? - => showVPHvv PerfStem agr vp ++ subjAux Pos agr ; + => showVPH' True VVPres (VPast Pos agr) agr vp ; + => showVPH (VPast Pos agr) agr vp ; + => showVPH PerfStem agr vp ++ subjAux Pos agr ; -- Auxiliaries that take indicative (full or defective inflection) - => showVPHvv (VAor Pos agr) agr vp ; + => showVPH (VAor Pos agr) agr vp ; -- Default: complement in subjunctive - _ => showVPHvv (VSubj Pos agr) agr vp ---- TODO more forms ? + _ => showVPH (VSubj Pos agr) agr vp } ; insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** { @@ -207,16 +211,15 @@ oper SlClause : Type = {quest : Order => Str ; subj : Str ; vp : TAnt => Polarity => Order => Str} ; ---- AR 18/9/2017 intermediate SClause to preserve SOV in e.g. QuestionPes.QuestSlash - -- TODO: check the VV forms with defective verbs clTable : VPH -> (Agr => TAnt => Polarity => Str) = \vp -> \\agr,vt,pol => vp.prefix ++ case vt of { TA Pres Simul => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; -- for reg. verbs, VAor pol is invariant and negation comes in ImpPrefix. TA Pres Anter => vp.s ! VPerf pol agr ; - TA Past Simul => vp.s ! VPast pol agr ; - TA Past Anter => - case vp.vvtype of { - DefVV => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; - _ => vp.s ! PerfStem ++ pluperfAux pol agr } ; + TA Past Simul => vp.s ! VPast pol agr ; -- Past Simul: simple past + TA Past Anter | TA Cond _ => -- Past Anter & Cond _: continuous past + case vp.vvtype of { + DefVV => vp.s ! VPast pol agr ; + _ => vp.s ! ImpPrefix pol ++ vp.s ! VPast Pos agr } ; TA Fut Simul => case vp.vvtype of { DefVV => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; @@ -225,13 +228,8 @@ oper TA Fut Anter => case vp.vvtype of { DefVV => vp.s ! VPerf pol agr ; - _ => "خواسته" ++ pluperfAux pol agr ++ vp.s ! PastStem - } ; -- verb form need to be confirmed - TA Cond Simul => vp.s ! VSubj pol agr ; - TA Cond Anter => - case vp.vvtype of { - DefVV => vp.s ! VSubj pol agr ; - _ => vp.s ! PerfStem ++ subjAux pol agr } -- verb form to be confirmed + _ => futAux pol agr ++ vp.s ! PastStem + } } ; mkClause : NP -> VPH -> Clause = \np,vp -> @@ -245,7 +243,7 @@ oper subj = np2str np ; vp = \\ta,p,ord => let vps = clTable vp ! np.a ! ta ! p ; - vvt = ta2vvt ta ; + vvt = ta2vvt ta vp.vvtype ; in case vp.vvtype of { DefVV => vps ++ vp.ad ++ vp.comp ! np.a ++ vp.obj @@ -259,9 +257,8 @@ oper s = \\ta,p,ord => let vps = clTable vp ! agr ! ta ! p ; quest = case ord of { ODir => [] ; OQuest => "آیا" } ; - vvt = ta2vvt ta ; + vvt = ta2vvt ta vp.vvtype ; in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj --- in quest ++ vp.ad ++ subj ++ vp.comp ! agr ++ vp.obj -- TODO check which word order is better /IL ++ vps ++ vp.vComp ! agr ! vvt ++ vp.embComp };