From d175b1eedf86239973b6a17f74d09a229d086105 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 22 Feb 2019 10:03:38 +0100 Subject: [PATCH] (Pes) mkN, ApposN, animacy, compound nouns (#185) * Add an mkN instance for nouns with unexpected possessive stem * Rename inanimate and animate to nonhuman and human (old ones kept in the hidden part of API) * Fix john_PN's animacy * Add an instance of cmpdN with ezafe * Add ApposNP + some lex. fixes --- src/persian/ExtendPes.gf | 6 +++- src/persian/LexiconPes.gf | 6 ++-- src/persian/NounPes.gf | 18 ++++++------ src/persian/ParadigmsPes.gf | 56 ++++++++++++++++++++++++++----------- 4 files changed, 57 insertions(+), 29 deletions(-) diff --git a/src/persian/ExtendPes.gf b/src/persian/ExtendPes.gf index cfc2b31a..077c87f7 100644 --- a/src/persian/ExtendPes.gf +++ b/src/persian/ExtendPes.gf @@ -2,7 +2,7 @@ concrete ExtendPes of Extend = CatPes ** ExtendFunctor - [ - GenNP + GenNP, ApposNP ] with (Grammar=GrammarPes) ** open Prelude, ResPes in { @@ -14,4 +14,8 @@ lin s = \\num => np.s ! Bare -- possesser is unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/ } ; + -- : NP -> NP -> NP + ApposNP np1 np2 = np1 ** { + s = \\m => np1.s ! m ++ np2.s ! m + } ; } diff --git a/src/persian/LexiconPes.gf b/src/persian/LexiconPes.gf index 2fba727d..e5d10b9d 100644 --- a/src/persian/LexiconPes.gf +++ b/src/persian/LexiconPes.gf @@ -142,7 +142,7 @@ concrete LexiconPes of Lexicon = CatPes ** planet_N = mkN01 "سیّاره" inanimate; plastic_N = mkN01 "پلاستیک" inanimate; -- is uncountable play_V2 = mkV2 (mkV "نواختن" "نواز") "را" ; - policeman_N = mkCmpdNoun2 (mkN02 "مأمور" animate) "پلیس"; + policeman_N = cmpdN (mkN02 "مأمور" animate) (mkN "پلیس"); priest_N = mkN01 "کشیش" animate; -- probable_AS = mkAS (regA "محتمل") ; queen_N = mkN01 "ملکه" animate; @@ -265,7 +265,7 @@ concrete LexiconPes of Lexicon = CatPes ** fingernail_N = mkN01 "ناخن" inanimate; fire_N = mkN01 "آتش" inanimate; flower_N = mkN01 "گل" inanimate; - fog_N = mkN01 "مه" inanimate; + fog_N = mkN "مه" (mkN "مه") ; foot_N = mkN01 "پا" inanimate; forest_N = mkN01 "جنگل" inanimate; grass_N = mkN01 "چمن" inanimate; @@ -361,7 +361,7 @@ concrete LexiconPes of Lexicon = CatPes ** rule_N = mkN "قانون" "قوانین" inanimate; ---- added 4/6/2007 - john_PN = mkPN "جان" inanimate; + john_PN = mkPN "جان" animate; question_N = mkN01 "سؤال" inanimate; -- has variant "پرسش" ready_A = mkA "آماده" ["با آمادگی"] ; reason_N = mkN "دلیل" "دلایل" inanimate; diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index 8ee0d75e..8a2552a0 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -91,11 +91,11 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { definitness = True } ; - ComplN2 f x = f ** { - s = \\n,ez => f.s ! n ! Ezafe ++ f.c ++ x.s ! ez ; - definitness = True ; - hasAdj = False ; + ComplN2 n2 np = n2 ** { + s = \\n,m => n2.s ! n ! Ezafe ++ n2.c ++ np.s ! m ; + hasAdj = False }; + ComplN3 f x = f ** { s = \\n,ez => f.s ! n ! Ezafe ++ f.c2 ++ x.s ! ez ; c = f.c3; @@ -103,18 +103,18 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { } ; AdjCN ap cn = cn ** { - s = \\n,ez => cn.s! n! Ezafe ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!Ezafe!n to have correct enclicitic form other wise it creats wrong enclictic form of old man + s = \\n,ez => cn.s ! n ! Ezafe ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!Ezafe!n to have correct enclicitic form other wise it creats wrong enclictic form of old man hasAdj = True } ; RelCN cn rs = cn ** { - s = \\n,ez => cn.s ! n! Clitic ++ rs.s ! agrP3 n ; + s = \\n,ez => cn.s ! n ! Clitic ++ rs.s ! agrP3 n ; } ; - AdvCN cn ad = cn ** {s = \\n,ez => cn.s ! n ! Ezafe ++ ad.s} ; + AdvCN cn ad = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ ad.s} ; - SentCN cn sc = cn ** {s = \\n,ez => cn.s ! n ! ez ++ sc.s} ; + SentCN cn sc = cn ** {s = \\n,m => cn.s ! n ! m ++ sc.s} ; - ApposCN cn np = cn ** {s = \\n,ez => cn.s ! n ! ez ++ np.s ! Ezafe ; definitness = True} ; -- ezafa form of city to be used + ApposCN cn np = cn ** {s = \\n,m => cn.s ! n ! Ezafe ++ np.s ! m ; definitness = True} ; } diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index 30c75d2f..01bdf6db 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -17,25 +17,20 @@ resource ParadigmsPes = open oper Animacy : Type ; -- Argument to mkN - animate : Animacy ; -- e.g. /mkN "خواهر" animate/ to get the plural خواهران. - inanimate : Animacy ; -- default animacy for mkN, not needed unless you want to make the animacy explicit or force a plural with ها. + human : Animacy ; -- e.g. /mkN "خواهر" human/ to get the plural خواهران. + nonhuman : Animacy ; -- default animacy for mkN, not needed unless you want to make the animacy explicit or force a plural with ها. Number : Type ; -- Argument to mkDet and mkConj singular : Number ; -- e.g. mkConj "یا" singular plural : Number ; -- e.g. mkConj "و" plural - --2 Nouns - mkN = overload { - mkN : (sg : Str) -> N -- Takes singular form, returns an inanimate noun with ها as the plural form. - = \sg -> mkN01 sg inanimate ; - mkN : (sg : Str) -> Animacy -> N -- Takes singular form and animacy. Inanimate plural ها. Animate plural ان or an allomorph of it (یان or گان) depending on the singular form. - = \sg,ani -> case ani of { - Inanimate => mkN01 sg ani ; - Animate => mkN02 sg ani } ; - mkN : (sg,pl : Str) -> Animacy -> N -- Worst-case constructor: takes singular and plural forms and animacy. Use for e.g. loanwords with Arabic plural, or animate nouns with ها as plural. - = \sg,pl,ani -> M.mkN sg pl ani + mkN : overload { + mkN : (sg : Str) -> N ; -- Takes singular form, returns a nonhuman noun with ها as the plural form. + mkN : (sg : Str) -> Animacy -> N ; -- Takes singular form and animacy. Nonhuman plural ها. Human plural ان or an allomorph of it (یان or گان) depending on the singular form. + mkN : (sg,pl : Str) -> Animacy -> N ; -- Worst-case constructor: takes singular, plural and animacy. Use for loanwords with Arabic plural, human plurals with ها and nonhuman plurals with ان or its allomorphs. + mkN : (possStem : Str) -> N -> N -- Noun with an unexpected possessive stem, e.g. مه where ه is a consonant, not vowel. } ; mkN2 : overload { @@ -52,7 +47,9 @@ oper cmpdN : Str -> N -> N -- Compound noun with an invariable modifier /before/ the head. NB. no ezāfe. = mkCmpdNoun1 ; -- e.g. تخم مرغ 'chicken /egg/' cmpdN : N -> Str -> N -- Compound noun with an invariable modifier /after/ the head. NB. no ezāfe. - = mkCmpdNoun2 -- e.g. مأمور پلیس '/officer/ police'. + = mkCmpdNoun2 ; -- e.g. مأمور پلیس '/officer/ police'. + cmpdN : N -> N -> N -- Compound noun with ezafe (Nی N) + = \n1,n2 -> n1 ** {s = \\n,m => n1.s ! n ! Ezafe ++ n2.s ! n ! m} ; } ; -- Proper names @@ -133,7 +130,6 @@ oper -- } ; -} - --2 Conjunctions mkConj = overload { mkConj : Str -> Conj -- and (plural agreement) @@ -159,8 +155,11 @@ oper plural = Pl; Animacy = ResPes.Animacy ; - animate = Animate ; - inanimate = Inanimate ; + human = Animate ; + nonhuman = Inanimate ; + + animate = human ; + inanimate = nonhuman ; -- Removed mkV_1, mkV_2, mkN01 and mkN02 from public API, still available for -- any applications that open ParadigmsPes. /IL 2019-02-08 @@ -169,6 +168,31 @@ oper mkV_2 : Str -> V = \s -> lin V (mkVerb2 s) ; + + mkN = overload { + mkN : (sg : Str) -> N -- Takes singular form, returns a noun with ها as the plural form. + = \sg -> mkN01 sg inanimate ; + mkN : (sg,pl : Str) -> N -- Takes singular and plural forms. Use for ان or its allomorphs, and loanwords with Arabic plural. + = \sg,pl -> M.mkN sg pl inanimate ; + mkN : (possStem : Str) -> N -> N -- Noun with an unexpected possessive stem, e.g. مه where ه is a consonant, not vowel. + = \ps,n -> possStemN ps n ; + + -- hidden from API + mkN : (sg : Str) -> Animacy -> N -- Takes singular form and animacy. Inanimate plural ها. Animate plural ان or an allomorph of it (یان or گان) depending on the singular form. + = \sg,ani -> case ani of { + Inanimate => mkN01 sg ani ; + Animate => mkN02 sg ani } ; + mkN : (sg,pl : Str) -> Animacy -> N -- Worst-case constructor: takes singular and plural forms and animacy. Use for e.g. loanwords with Arabic plural, or animate nouns with ها as plural. + = \sg,pl,ani -> M.mkN sg pl ani + } ; + + possStemN : Str -> N -> N = \possStem,n -> n ** { + s = table {num => table {Poss => possStem ; + mod => n.s ! num ! mod} + } + + } ; + mkN01 : (sg : Str) -> Animacy -> Noun ; -- Takes singular form and animacy, forms plural with ها mkN01 sg ani = let pl : Str = case last sg of {