1
0
forked from GitHub/gf-rgl

(Pes) Add zero-width non-joiner + mkN in ParadigmsPes

This commit is contained in:
Inari Listenmaa
2019-02-04 10:44:44 +01:00
parent 19d4934671
commit 7cb2298b55
2 changed files with 27 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../../prelude:../common --# -path=.:../abstract:../prelude:../common
-- --
----1 Pnbu Lexical Paradigms ----1 Persian Lexical Paradigms
resource ParadigmsPes = open resource ParadigmsPes = open
Predef, Predef,
@@ -23,14 +23,26 @@ oper
singular = Sg ; plural = Pl; singular = Sg ; plural = Pl;
animate = Animate ; inanimate = Inanimate ; --i animate = Animate ; inanimate = Inanimate ; --i
mkN01 : Str -> Animacy -> Noun ; mkN01 : (sg : Str) -> Animacy -> Noun ; -- Takes singular form and animacy, forms plural with ها
mkN01 str ani = mkN str (str ++ "ها") ani; mkN01 sg ani =
mkN02 : Str -> Animacy -> Noun ; let pl = zwnj sg "ها" ; -- Using zero-width non-joiner, defined in ResPes
mkN02 str ani = case (last str) of { in MorphoPes.mkN sg pl ani ;
"ه" => mkN str ((init str) + "گان") ani ;
("ا"|"و") => mkN str (str + "یان") ani ; mkN02 : (sg : Str) -> Animacy -> Noun ; -- Takes singular form and animacy, pattern matches singular and forms plural with either گان, یان or ان
_ => mkN str (str+"ان") ani mkN02 str ani = case last str of {
"ه" => MorphoPes.mkN str (init str + "گان") ani ;
("ا"|"و") => MorphoPes.mkN str (str + "یان") ani ;
_ => MorphoPes.mkN str (str + "ان") ani
}; };
mkN = overload {
mkN : (sg : Str) -> N -- Takes singular form, returns an inanimate noun with ها as the plural form
= \sg -> mkN01 sg inanimate ;
mkN : (sg,pl : Str) -> N -- Takes singular and plural form, returns an inanimate noun
= \sg,pl -> MorphoPes.mkN sg pl inanimate ;
mkN : (sg,pl : Str) -> Animacy -> N -- Worst-case constructor: takes singular and plural forms and animacy
= \sg,pl,ani -> MorphoPes.mkN sg pl ani
} ;
{- {-
--2 Nouns --2 Nouns

View File

@@ -62,6 +62,10 @@ resource ResPes = ParamX ** open Prelude,Predef in {
Neg => CNeg b Neg => CNeg b
} ; } ;
-- Zero-width non-joiner, used for certain morphemes
-- See https://en.wikipedia.org/wiki/Persian_alphabet#Word_boundaries
ZWNJ : Str = "" ;
zwnj : Str -> Str -> Str = \s1,s2 -> s1 + ZWNJ + s2 ;
----------------------- -----------------------
--- Verb Phrase --- Verb Phrase
----------------------- -----------------------