(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
This commit is contained in:
Inari Listenmaa
2019-02-22 10:03:38 +01:00
committed by GitHub
parent 8a47956688
commit d175b1eedf
4 changed files with 57 additions and 29 deletions
+40 -16
View File
@@ -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 {