resource MorphoRus = open Prelude in { -- using transliteration defined in rus.trans -- ps -to=rus.trans "zme'a'" gives змея -- features param Number = Sg | Pl ; Case = Nom | Gen | Dat | Ins | Pre ; Gender = Masc | Fem | Neutr ; oper -- the type of nouns Noun = {s : Number => Case => Str ; g : Gender} ; -- the worst-case paradigm for nouns mkNoun : (sn, sg, sd, si, sp, pn, pg, pd, pi, pp : Str) -> Gender -> Noun = \sn, sg, sd, si, sp, pn, pg, pd, pi, pp, g -> { s = table { Sg => table { Nom => sn ; Gen => sg ; Dat => sd ; Ins => si ; Pre => sp } ; Pl => table { Nom => pn ; Gen => pg ; Dat => pd ; Ins => pi ; Pre => pp } } ; g = g } ; noun_ja : Gender -> Str -> Noun = \g, tjotja -> let tjotj = Predef.tk 2 tjotja in mkNoun tjotja (tjotj + "i") (tjotj + "e'") (tjotj + "e'i") (tjotj + "e'") (tjotj + "i") (tjotj + "e'i") (tjotj + "am") (tjotj + "ami") (tjotj + "ah") g ; noun_fem_ja : Str -> Noun = noun_ja Fem ; noun_masc_ja : Str -> Noun = noun_ja Masc ; noun_o : Str -> Noun = \okno -> let okn = init okno ; ok = init okn ; n = last okn in mkNoun okno (okn + "a") (okn + "u") (okn + "om") (okn + "ieh") (okn + "a") (ok + "o" + n) (okn + "am") (okn + "ami") (okn + "ah") Neutr ; smartNoun : Str -> Noun = \s -> case s of { _ + "a'" => noun_fem_ja s ; _ => noun_o s } ; }