From e2a3791ccfd2d8b6b8272c4920ae51e511a74e53 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 4 Mar 2019 16:48:20 +0100 Subject: [PATCH] (Pes) Adding fields to some lexical categories --- src/persian/CatPes.gf | 6 +++--- src/persian/LexiconPes.gf | 2 +- src/persian/ParadigmsPes.gf | 26 ++++++++++++++-------- src/persian/StructuralPes.gf | 42 ++++++++++++++++++------------------ 4 files changed, 42 insertions(+), 34 deletions(-) diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 37752356..6b71d98b 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -76,11 +76,11 @@ concrete CatPes of Cat = CommonX - [Adv] ** 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 - Prep = {s : Str}; + Prep = Compl ; ---- Open lexical classes, e.g. Lexicon - V, VS, VQ, VA = ResPes.Verb ; + V, VS, VQ = ResPes.Verb ; - V2, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ; + V2, VA, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ; V3 = ResPes.Verb ** {c2, c3 : Compl} ; VV = ResPes.VV ; V2V = ResPes.VV ** {c2 : Compl} ; diff --git a/src/persian/LexiconPes.gf b/src/persian/LexiconPes.gf index 35223fd6..30fee490 100644 --- a/src/persian/LexiconPes.gf +++ b/src/persian/LexiconPes.gf @@ -19,7 +19,7 @@ concrete LexiconPes of Lexicon = CatPes ** bad_A = mkA "بد" ; bank_N = mkN01 "بانک" inanimate; beautiful_A = mkA "زیبا" ; - become_VA = mkV "شدن" "شو"; + become_VA = mkVA (mkV "شدن" "شو") ; beer_N = mkN01 "آبجو" inanimate; beg_V2V = mkV2V (compoundV "خواهش" doVerb) "از" False; big_A = mkA "بزرگ" ; diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index 1a424ed7..4f8e3314 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -89,12 +89,11 @@ oper mkV : (inf : Str) -> V -- Takes infinitive. Use for predictable verbs: if it ends in vowel+دن, the present stem removes the vowel as well. If it ends in consonant+تن or consonant+دن, present stem only removes تن/دن. = regV ; mkV : (inf,pres : Str) -> V -- Takes infinitive and present root. Use for unpredictable verbs, e.g. دانستن with present stem دان, or irregular, e.g. کردن with present stem کن. - = \s1, s2 -> lin V (mkVerb s1 s2) + = \s1, s2 -> lin V (mkVerb s1 s2) ; + mkV : Str -> V -> V -- Invariable prefix to a verb, e.g. mkV "دوست" haveVerb + = compoundV ; } ; - compoundV : overload { - compoundV : Str -> V -> V -- Invariable prefix to a verb, e.g. compoundV "دوست" haveVerb - } ; invarV : Str -> V -- no inflection at all = \s -> lin V (M.invarV s); @@ -116,7 +115,9 @@ oper mkV3 : Str -> V3 -- Predictable V3, را for direct object, no prepositions. = \s -> lin V3 (regV s ** {c2 = prepOrRa "را" ; c3 = prepOrRa []}) ; mkV3 : V -> (dir,indir : Str) -> V3 -- Takes a verb and two prepositions or را as strings (can be empty). - = \v,p,q -> lin V3 (v ** {c2 = prepOrRa p ; c3 = prepOrRa q}) + = \v,p,q -> lin V3 (v ** {c2 = prepOrRa p ; c3 = prepOrRa q}) ; + mkV3 : V -> (dir,indir : Prep) -> V3 -- Takes a verb and two prepositions + = \v,p,q -> lin V3 (v ** {c2 = p ; c3 = q}) } ; mkVQ = overload { @@ -128,9 +129,11 @@ oper mkVA = overload { mkVA : Str -> VA -- predictable verb with adjective complement - = \s -> lin VA (regV s) ; + = \s -> lin VA (regV s ** {c2 = prepOrRa []}) ; mkVA : V -> VA -- VA out of a verb - = \v -> lin VA v + = \v -> lin VA (v ** {c2 = prepOrRa []}) ; + mkVA : V -> Prep -> VA -- VA out of a verb and preposition + = \v,p -> lin VA (v ** {c2 = p}) ; } ; mkVS = overload { @@ -169,7 +172,7 @@ oper ----2 Prepositions mkPrep : Str -> Prep ; -- Takes a string, returns a preposition. - mkPrep str = lin Prep {s = str}; + mkPrep str = lin Prep {s = str ; ra = []} ; {- --3 Determiners and quantifiers @@ -295,6 +298,7 @@ oper mkCmpdNoun2 : N -> Str -> N = \noun,s -> noun ** {s =\\ez,n => noun.s ! ez ! n ++ s}; +-- hidden from public API compoundV = overload { compoundV : Str -> V -> V = \s,v -> v ** {prefix = s} ; @@ -309,8 +313,10 @@ oper in lin V (mkVerb inf pres) ; mkV2 = overload { - mkV2 : Str -> V2 -- Predictable V2 with + mkV2 : Str -> V2 -- Predictable V2 with را = \s -> lin V2 (regV s ** {c2 = prepOrRa "را"}) ; + mkV2 : Str -> V -> V2 -- Compound V2 with را + = \s,v -> lin V2 (v ** {prefix = s ; c2 = prepOrRa "را"}) ; mkV2 : V -> V2 = \v -> lin V2 (v ** {c2 = prepOrRa "را"}) ; mkV2 : V -> Prep -> V2 @@ -326,6 +332,8 @@ oper prep => {s = prep ; ra = []} } ; + mkPost : Str -> Prep = \s -> lin Prep {s=[] ; ra=s} ; + mkN2 = overload { mkN2 : Str -> N2 -- Predictable N2 without complement = \s -> lin N2 (mkN01 s inanimate ** {c2,compl = []}) ; diff --git a/src/persian/StructuralPes.gf b/src/persian/StructuralPes.gf index 5969a552..b9603d57 100644 --- a/src/persian/StructuralPes.gf +++ b/src/persian/StructuralPes.gf @@ -5,32 +5,32 @@ concrete StructuralPes of Structural = CatPes ** coding = utf8; lin - above_Prep = ss "بالای" ; - after_Prep = ss ["بعد از"] ; + above_Prep = mkPrep "بالای" ; + after_Prep = mkPrep ["بعد از"] ; all_Predet = ss ["همه ی"] ; almost_AdA, almost_AdN = ss "تقریباً" ; although_Subj = mkSubj "با وجود این" ; always_AdV = ss "همیشه" ; and_Conj = sd2 [] "و" ** {n = Pl} ; because_Subj = mkSubj "برای این" ; - before_Prep = ss ["قبل از"] ; - behind_Prep = ss "پشت" ; - between_Prep = ss "بین" ; + before_Prep = mkPrep ["قبل از"] ; + behind_Prep = mkPrep "پشت" ; + between_Prep = mkPrep "بین" ; both7and_DConj = sd2 "هم" ["و هم"] ** {n = Pl} ; but_PConj = ss "اما" ; - by8agent_Prep = ss "توسط" ; - by8means_Prep = ss "با" ; + by8agent_Prep = mkPrep "توسط" ; + by8means_Prep = mkPrep "با" ; -- can8know_VV,can_VV = mkVV (mkV "سکن") ; can_VV = mkVV (mkV_1 "توانستن") ; ---- AR - during_Prep = ss ["در طول"] ; + during_Prep = mkPrep ["در طول"] ; either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ; -- everybody_NP = R.indeclNP "هر کwی"; every_Det = mkDet "هر" Sg ; -- everything_NP = R.indeclNP ["هر XE"])); everywhere_Adv = ss ["هر جا"] ; few_Det = mkDet ["تعداد کمی"] Pl True; -- check - for_Prep = ss "برای" ; - from_Prep = ss "از" ; + for_Prep = mkPrep "برای" ; + from_Prep = mkPrep "از" ; he_Pron = personalPron "او" "ش" Sg P3 ; here_Adv = ss "اینجا" ; here7to_Adv = ss "اینجا" ; @@ -39,9 +39,9 @@ concrete StructuralPes of Structural = CatPes ** how8many_IDet = {s = "چند" ; n = Pl ; isNum = True} ; how8much_IAdv = ss "چقدر" ; if_Subj = mkSubj subjunctive "اگر" ; - in8front_Prep = ss "جلوی" ; + in8front_Prep = mkPrep "جلوی" ; i_Pron = personalPron "من" "م" Sg P1; - in_Prep = ss "در" ; + in_Prep = mkPrep "در" ; it_Pron = personalPron "آن" "ش" Sg P3; less_CAdv = {s = "کمتر" ; p = ""} ; many_Det = mkDet ["تعداد زیادی"] Pl True; -- check @@ -53,13 +53,13 @@ concrete StructuralPes of Structural = CatPes ** in must ** {isDef=True} ; -- TODO: past tense forms with مجبور+beVerb no_Utt = ss "نه" ; - on_Prep = ss "روی" ; + on_Prep = mkPrep "روی" ; only_Predet = ss "فقط" ; or_Conj = sd2 [] "یا" ** {n = Sg} ; otherwise_PConj = ss ["درغیراین صورت"] ; - part_Prep = ss "از" ; -- TODO: the object following it should be in Ezafa form + part_Prep = mkPrep "از" ; -- TODO: the object following it should be in Ezafa form please_Voc = ss "لطفاً" ; - possess_Prep = ss "" ; -- will be handeled in Ezafeh + possess_Prep = mkPrep "" ; -- will be handeled in Ezafeh quite_Adv = ss "کاملاً" ; she_Pron = personalPron "او" "ش" Sg P3 ; so_AdA = ss "بسیار" ; @@ -76,10 +76,10 @@ concrete StructuralPes of Structural = CatPes ** therefore_PConj = ss ["به همین دلیل"] ; they_Pron = personalPron "آن ها" "شان" Pl P3 ; this_Quant = mkQuant "این" "این" ; - through_Prep = ss ["از طریق"] ; + through_Prep = mkPrep ["از طریق"] ; too_AdA = ss "خیلی" ; - to_Prep = ss "به" ** {lock_Prep = <>}; - under_Prep = ss "زیر" ** {lock_Prep = <>}; + to_Prep = mkPrep "به" ** {lock_Prep = <>}; + under_Prep = mkPrep "زیر" ** {lock_Prep = <>}; very_AdA = ss "خیلی" ; want_VV = mkVV False subjunctive (mkV "خواستن" "خواه") ; --not aux we_Pron = personalPron "ما" "مان" Pl P1 ; @@ -94,8 +94,8 @@ concrete StructuralPes of Structural = CatPes ** whoSg_IP = {s = ["چه کسی"] ; n = Sg} ; whoPl_IP = {s = ["چه کسانی"] ;n = Pl} ; why_IAdv = ss "چرا" ; - without_Prep = ss "بدون" ; - with_Prep = ss "با"; + without_Prep = mkPrep "بدون" ; + with_Prep = mkPrep "با"; -- yes_Phr = ss "بله" ; yes_Utt = ss "بله" ; youSg_Pron = personalPron "تو" "ت" Sg P2 ; @@ -107,7 +107,7 @@ concrete StructuralPes of Structural = CatPes ** at_least_AdN = ss "حداقل" ; at_most_AdN = ss "حداکثر"; nothing_NP = R.indeclNP "هیچ" ; - except_Prep = ss ["به جز"] ; + except_Prep = mkPrep ["به جز"] ; nobody_NP = R.indeclNP "هیچ کس"; as_CAdv = {s = ["به اندازه ی"] ; p = ""} ;