diff --git a/src/russian/AdjectiveRus.gf b/src/russian/AdjectiveRus.gf index 3908b827..52b99942 100644 --- a/src/russian/AdjectiveRus.gf +++ b/src/russian/AdjectiveRus.gf @@ -14,11 +14,11 @@ lin AdAP ada ap = ap ** {s=\\gn,a,c => ada.s ++ ap.s ! gn ! a ! c } ; -- : CAdv -> AP -> NP -> AP ; -- as cool as John CAdvAP cadv ap np = ap ** { - s = \\gn,a,c => cadv.s ++ ap.s ! gn ! a ! c ++ comma ++ cadv.p ++ np.s ! Nom -- TODO: embedInCommas ? + s = \\gn,a,c => cadv.s ++ ap.s ! gn ! a ! c ++ embedInCommas (cadv.p ++ np.s ! Nom) } ; -- : AP -> SC -> AP ; -- good that she is here - SentAP ap sc = ap ** {s = \\gn,a,c => ap.s ! gn ! a ! c ++ [", "] ++ sc.s ; isPost = True} ; + SentAP ap sc = ap ** {s = \\gn,a,c => ap.s ! gn ! a ! c ++ sc.s ; isPost = True} ; -- : A -> NP -> AP ; -- warmer than I - теплее меня ComparA a np = { diff --git a/src/russian/ConjunctionRus.gf b/src/russian/ConjunctionRus.gf index 30cd0a6e..e64ebd39 100644 --- a/src/russian/ConjunctionRus.gf +++ b/src/russian/ConjunctionRus.gf @@ -26,6 +26,7 @@ concrete ConjunctionRus of Conjunction = } ; [CN] = {s1,s2 : Number => Case => Str ; g : Gender ; + mayben : MaybeNumber ; anim : Animacy } ; [S] = {s1,s2 : Mood => Str} ; @@ -125,12 +126,14 @@ concrete ConjunctionRus of Conjunction = s1 = x.s ; s2 = y.s ; g = y.g ; + mayben = JustPl ; anim = conjAnim x.anim y.anim } ; -- : CN -> ListCN -> ListCN ; -- man, woman, child ConsCN x xs = consrTable2 Number Case comma x xs ** { g = conjGender x.g xs.g ; + mayben = JustPl ; anim = conjAnim x.anim xs.anim } ; @@ -138,6 +141,7 @@ concrete ConjunctionRus of Conjunction = ConjCN conj xs = { s = \\n,cas => conj.s1 ++ xs.s1 ! n ! cas ++ conj.s2 ++ xs.s2 ! n ! cas ; g = xs.g ; + mayben = JustPl ; anim = xs.anim } ; diff --git a/src/russian/DocumentationRus.gf b/src/russian/DocumentationRus.gf index dca6e847..a815c0b7 100644 --- a/src/russian/DocumentationRus.gf +++ b/src/russian/DocumentationRus.gf @@ -1,49 +1,6 @@ -concrete DocumentationRus of Documentation = CatRus ** open ResRus, HTML in { -flags coding=utf8 ; +--# -path=.:../abstract:../common -lincat - Inflection = {t : Str; s1,s2,s3 : Str} ; - Definition = {s : Str} ; - Document = {s : Str} ; - Tag = {s : Str} ; +-- documentation of Russian in Russian: the default introduced in LangRus -lin - InflectionN = \n -> { - t = "сущ" ; - s1= heading1 ( - "Существительное" ++ - case n.g of { - Masc => "(м.р.)" ; - Fem => "(ж.р.)" ; - Neut => "(ср.р.)" - } ++ - - case n.anim of { - Animate => "Одушевлённое" ; - Inanimate => "Неодушевлённое" - } - ) ; - s2= frameTable ( - tr (th "Падеж" ++ th "ед. ч." ++ th "мн. ч.") ++ - tr (th "Им." ++ td (n.snom) ++ td (n.pnom)) ++ - tr (th "Р." ++ td (n.sgen) ++ td (n.pgen)) ++ - tr (th "Д." ++ td (n.sdat) ++ td (n.pdat)) ++ - tr (th "В." ++ td (n.sacc) ++ td (n.pacc)) ++ - tr (th "Тв." ++ td (n.sins) ++ td (n.pins)) ++ - tr (th "Пр." ++ td (n.sprep) ++ td (n.pprep)) ++ - tr (th "Мест.(П2)" ++ td (n.sloc) ++ td "") ++ - tr (th "Разд.(Р2)" ++ td (n.sptv) ++ td "") ++ - tr (th "Зват." ++ td (n.svoc) ++ td "") - ) ; - s3= "" - } ; - - -lin - MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ i.s3 ++ e.s} ; - MkTag i = {s = i.t} ; - - NoDefinition t = {s=t.s}; - MkDefinition t d = {s="
Определение:" ++ t.s ++ d.s ++ "
"}; - MkDefinitionEx t d e = {s="Определение:" ++ t.s ++ d.s ++ "
Пример:" ++ e.s ++ "
"}; -} +concrete DocumentationRus of Documentation = CatRus ** + DocumentationRusFunctor with (Terminology = TerminologyRus) ; diff --git a/src/russian/DocumentationRusEng.gf b/src/russian/DocumentationRusEng.gf new file mode 100644 index 00000000..f9534174 --- /dev/null +++ b/src/russian/DocumentationRusEng.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common + +-- documentation of Russion in English + +concrete DocumentationRusEng of Documentation = CatRus ** + DocumentationRusFunctor with (Terminology = TerminologyEng) ; diff --git a/src/russian/DocumentationRusFunctor.gf b/src/russian/DocumentationRusFunctor.gf new file mode 100644 index 00000000..a7887840 --- /dev/null +++ b/src/russian/DocumentationRusFunctor.gf @@ -0,0 +1,304 @@ +--# -path=.:../abstract:../common + +incomplete concrete DocumentationRusFunctor of Documentation = CatRus ** open + Terminology, -- the interface + ResRus, + ParadigmsRus, + (G = GrammarRus), + (S = SyntaxRus), + (L = LexiconRus), + Prelude, + HTML +in { + +lincat + Inflection = {t : Str; s1,s2 : Str} ; + Definition = {s : Str} ; + Document = {s : Str} ; + Tag = {s : Str} ; + +{- +-} --# notpresent + +oper + heading : N -> Str = \n -> (nounHeading n).s ; + +lin + InflectionN, InflectionN2, InflectionN3 = \noun -> { + t = "s" ; + s1 = heading1 (heading noun_Category) ; + s2 = inflNoun (\nf -> (snoun2nounSep noun).s ! nf) + } ; + + InflectionA, InflectionA2 = \adj -> { + t = "a" ; + s1 = heading1 (heading adjective_Category) ; + s2 = inflNoun (\nf -> (snoun2nounSep {s = \\f => adj.s ! Posit ! sAN f ; h = adj.h}).s ! nf) ++ + heading2 (heading comparative_Parameter) ++ + inflNoun (\nf -> (snoun2nounSep {s = \\f => adj.s ! Compar ! sAN f ; h = adj.h}).s ! nf) ++ + heading2 (heading superlative_Parameter) ++ + inflNoun (\nf -> (snoun2nounSep {s = \\f => adj.s ! Superl ! sAN f ; h = adj.h}).s ! nf) + } ; + + InflectionAdv adv = { + t = "adv" ; + s1 = heading1 (heading adverb_Category) ; + s2 = paragraph adv.s + } ; + + InflectionPrep p = { + t = "prep" ; + s1 = heading1 (heading preposition_Category) ; + s2 = paragraph ((S.mkAdv (lin Prep p) S.it_NP).s ++ ";" ++ (S.mkAdv (lin Prep p) S.we_NP).s) + } ; + + InflectionV v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v)) ; + s2 = inflVerb v + } ; + + InflectionV2 v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ; + s2 = inflVerb v + } ; + + InflectionV3 v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ; + s2 = inflVerb v + } ; + + InflectionV2V v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (S.mkVP (L.sleep_V)))) ; + s2 = inflVerb v + } ; + + InflectionV2S v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin S (ss "...")))) ; + s2 = inflVerb v + } ; + + InflectionV2Q v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin QS (ss "...")))) ; + s2 = inflVerb v + } ; + + InflectionV2A v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v S.we_NP L.beautiful_A)) ; + s2 = inflVerb v + } ; + + InflectionVV v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v (S.mkVP (L.sleep_V)))) ; + s2 = inflVerb v + } ; + + InflectionVS v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v (lin S (ss "...")))) ; + s2 = inflVerb v + } ; + + InflectionVQ v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v (lin QS (ss "...")))) ; + s2 = inflVerb v + } ; + + InflectionVA v = { + t = "v" ; + s1 = heading1 (heading verb_Category) ++ + paragraph (verbExample (S.mkCl S.she_NP v L.beautiful_A)) ; + s2 = inflVerb v + } ; + +oper + verbExample : CatRus.Cl -> Str = \cl -> (S.mkUtt cl).s ; +{- +-} --# notpresent + inflVerb : CatRus.V -> Str = \verb0 -> + let + verb = sverb2verbSep verb0 ; + vfin : ResRus.VForm -> Str = \f -> + verb.s ! f ; + + nounNounHeading : Parameter -> Parameter -> Str = \n1,n2 -> + (S.mkUtt (G.PossNP (S.mkCN n1) (S.mkNP (snoun2nounSep n2)))).s ; + in + heading3 (nounNounHeading present_Parameter indicative_Parameter) ++ + frameTable ( + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter) + ++ th (heading passive_Parameter) --# notpresent + ) ++ + tr (th "1.p" ++ td (vfin (Presn Sg P1)) ++ td (vfin (Presn Pl P1)) + ++ intagAttr "td" "rowspan=3" (vfin (PassPresn True)) --# notpresent + ) ++ + tr (th "2.p" ++ td (vfin (Presn Sg P2)) ++ td (vfin (Presn Pl P2))) ++ + tr (th "3.p" ++ td (vfin (Presn Sg P3)) ++ td (vfin (Presn Pl P3))) ++ + tr (th (heading negative_Parameter) ++ + intagAttr "td" "colspan=2 align=center" (vfin (Imper Sg)) ++ td (vfin (PassPresn False))) + ) ++ + heading3 (nounNounHeading past_Parameter indicative_Parameter) ++ + frameTable ( + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter) + ++ th (heading passive_Parameter) --# notpresent + ) ++ + tr (th "1.p" ++ td (vfin (Impf Sg P1)) ++ td (vfin (Impf Pl P1)) + ++ intagAttr "td" "rowspan=3" (vfin (PassImpf True))) ++ + tr (th "2.p" ++ td (vfin (Impf Sg P2)) ++ td (vfin (Impf Pl P2))) ++ + tr (th "3.p" ++ td (vfin (Impf Sg P3)) ++ td (vfin (Impf Pl P3))) ++ + tr (th (heading negative_Parameter) ++ + td (vfin (PastPartAct (AN (NCase Sg Nom)))) ++ + td (vfin (PastPartAct (AN (NCase Pl Nom)))) ++ + td (vfin (PassImpf False))) + ) ++ + heading3 (nounNounHeading present_Parameter conditional_Parameter) ++ + frameTable ( + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter) + ++ th (heading passive_Parameter) --# notpresent + ) ++ + tr (th "1.p" ++ td (vfin (Condit Sg P1)) ++ td (vfin (Condit Pl P1)) + ++ intagAttr "td" "rowspan=3" (vfin (PassCondit True)) --# notpresent + ) ++ + tr (th "2.p" ++ td (vfin (Condit Sg P2)) ++ td (vfin (Condit Pl P2))) ++ + tr (th "3.p" ++ td (vfin (Condit Sg P3)) ++ td (vfin (Condit Pl P3))) ++ + tr (th (heading negative_Parameter) ++ + intagAttr "td" "colspan=2 align=center" (vfin (Condit Sg P3)) ++ td (vfin (PassCondit False))) + ) ++ + heading3 (nounNounHeading present_Parameter potential_Parameter) ++ + frameTable ( + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter) + ++ th (heading passive_Parameter) --# notpresent + ) ++ + tr (th "1.p" ++ td (vfin (Potent Sg P1)) ++ td (vfin (Potent Pl P1)) + ++ intagAttr "td" "rowspan=3" (vfin (PassPotent True)) --# notpresent + ) ++ + tr (th "2.p" ++ td (vfin (Potent Sg P2)) ++ td (vfin (Potent Pl P2))) ++ + tr (th "3.p" ++ td (vfin (Potent Sg P3)) ++ td (vfin (Potent Pl P3))) ++ + tr (th (heading negative_Parameter) ++ + intagAttr "td" "colspan=2 align=center" (vfin PotentNeg) ++ td (vfin (PassPotent False))) + ) ++ + heading3 (nounNounHeading present_Parameter imperative_Parameter) ++ + frameTable ( + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter) + ++ th (heading passive_Parameter) --# notpresent + ) ++ + tr (th "1.p" ++ td "" ++ td (vfin ImperP1Pl) + ++ intagAttr "td" "rowspan=3" (vfin (PassImper True))) ++ + tr (th "2.p" ++ td (vfin (Imper Sg)) ++ td (vfin (Imper Pl))) ++ + tr (th "3.p" ++ td (vfin (ImperP3 Sg)) ++ td (vfin (ImperP3 Pl))) ++ + tr (th (heading negative_Parameter) ++ + td (vfin (Imper Sg)) ++ + td (vfin ImpNegPl) ++ + td (vfin (PassImper False))) + ) ++ + heading2 (nounPluralHeading nominal_form_ParameterType).s ++ + heading3 (heading infinitive_Parameter) ++ + frameTable ( + tr (intagAttr "th" "rowspan=2" "1" ++ + th (heading short_Parameter) ++ --- + td (vfin (Inf Inf1))) ++ + tr (th (heading long_Parameter) ++ --- + td (vfin (Inf Inf1Long) ++ BIND ++ "(ni)")) ++ + tr (intagAttr "th" "rowspan=2" ("2." ++ heading active_Parameter) ++ + th (heading inessive_Parameter) ++ + td (vfin (Inf Inf2Iness))) ++ + tr (th (heading instructive_Parameter) ++ + td (vfin (Inf Inf2Instr))) ++ + tr (th ("2." ++ heading passive_Parameter) ++ + th (heading inessive_Parameter) ++ + td (vfin (Inf Inf2InessPass))) ++ + + tr (intagAttr "th" "rowspan=7" "3." ++ + th (heading inessive_Parameter) ++ td (vfin (Inf Inf3Iness))) ++ + tr (th (heading elative_Parameter) ++ td (vfin (Inf Inf3Elat))) ++ + tr (th (heading illative_Parameter) ++ td (vfin (Inf Inf3Illat))) ++ + tr (th (heading adessive_Parameter) ++ td (vfin (Inf Inf3Adess))) ++ + tr (th (heading abessive_Parameter) ++ td (vfin (Inf Inf3Abess))) ++ + tr (th (heading instructive_Parameter) ++ td (vfin (Inf Inf3Instr))) ++ + tr (th (heading instructive_Parameter ++ "pass.") ++ td (vfin (Inf Inf3InstrPass))) ++ + + tr (intagAttr "th" "rowspan=2" "4." ++ + th (heading nominative_Parameter) ++ td (vfin (Inf Inf4Nom))) ++ + tr (th (heading partitive_Parameter) ++ td (vfin (Inf Inf4Part))) ++ + + tr (intagAttr "th" "colspan=2" "5." ++ td (vfin (Inf Inf5) ++ BIND ++ "(ni)")) + ) ++ + heading3 (heading participle_Parameter) ++ + frameTable ( + tr (intagAttr "th" "rowspan=2" (heading present_Parameter) ++ + th (heading active_Parameter) ++ + td (vfin (PresPartAct (AN (NCase Sg Nom))))) ++ + tr (th (heading passive_Parameter) ++ + td (vfin (PresPartPass (AN (NCase Sg Nom))))) ++ + + tr (intagAttr "th" "rowspan=2" (heading perfect_Parameter) ++ + th (heading active_Parameter) ++ + td (vfin (PastPartAct (AN (NCase Sg Nom))))) ++ + + tr (th (heading passive_Parameter) ++ + td (vfin (PastPartPass (AN (NCase Sg Nom))))) ++ + + tr (intagAttr "th" "colspan=2" (heading agent_Parameter) ++ + td (vfin (AgentPart (AN (NCase Sg Nom))))) + ) ; + + inflNoun : (NForm -> Str) -> Str = \nouns -> + frameTable ( + tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++ + tr (th (heading nominative_Parameter) ++ td (nouns (NCase Sg Nom)) ++ td (nouns (NCase Pl Nom))) ++ + tr (th (heading genitive_Parameter) ++ td (nouns (NCase Sg Gen)) ++ td (nouns (NCase Pl Gen))) ++ + tr (th (heading partitive_Parameter) ++ td (nouns (NCase Sg Part)) ++ td (nouns (NCase Pl Part))) ++ + tr (th (heading translative_Parameter) ++ td (nouns (NCase Sg Transl)) ++ td (nouns (NCase Pl Transl))) ++ + tr (th (heading essive_Parameter) ++ td (nouns (NCase Sg Ess)) ++ td (nouns (NCase Pl Ess))) ++ + tr (th (heading inessive_Parameter) ++ td (nouns (NCase Sg Iness)) ++ td (nouns (NCase Pl Iness))) ++ + tr (th (heading elative_Parameter) ++ td (nouns (NCase Sg Elat)) ++ td (nouns (NCase Pl Elat))) ++ + tr (th (heading illative_Parameter) ++ td (nouns (NCase Sg Illat)) ++ td (nouns (NCase Pl Illat))) ++ + tr (th (heading adessive_Parameter) ++ td (nouns (NCase Sg Adess)) ++ td (nouns (NCase Pl Adess))) ++ + tr (th (heading ablative_Parameter) ++ td (nouns (NCase Sg Ablat)) ++ td (nouns (NCase Pl Ablat))) ++ + tr (th (heading allative_Parameter) ++ td (nouns (NCase Sg Allat)) ++ td (nouns (NCase Pl Allat))) ++ + tr (th (heading abessive_Parameter) ++ td (nouns (NCase Sg Abess)) ++ td (nouns (NCase Pl Abess))) ++ + tr (th (heading comitative_Parameter) ++ td "" ++ td (nouns (NComit))) ++ + tr (th (heading instructive_Parameter) ++ td "" ++ td (nouns (NInstruct))) + ) ; + +lin + NoDefinition t = {s=t.s}; + MkDefinition t d = {s="Определение:"++t.s++d.s++"
"}; + MkDefinitionEx t d e = {s="Определение:"++t.s++d.s++"
Пример:"++e.s++"
"}; + +lin + MkDocument d i e = ss (i.s1 ++ d.s ++ i.s2 ++ paragraph e.s) ; -- explanation appended in a new paragraph + MkTag i = ss (i.t) ; + +{- --# notpresent +-} + +} diff --git a/src/russian/LangRus.gf b/src/russian/LangRus.gf index ec9337a6..5c4b6c92 100644 --- a/src/russian/LangRus.gf +++ b/src/russian/LangRus.gf @@ -3,8 +3,8 @@ concrete LangRus of Lang = GrammarRus, LexiconRus, - ConstructionRus, - DocumentationRus + ConstructionRus --, + --DocumentationRus ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ; diff --git a/src/russian/LexiconRus.gf b/src/russian/LexiconRus.gf index 6a0af2f9..62c12c47 100644 --- a/src/russian/LexiconRus.gf +++ b/src/russian/LexiconRus.gf @@ -13,13 +13,13 @@ lin apartment_N = mkN "квартира" ; apple_N = mkN "яблоко" neuter inanimate "3a(1)" ; art_N = mkN "искусство" ; - ashes_N = mkN "пепел" masculine inanimate "1*a" ; + ashes_N = mkN "пепел" masculine inanimate "1*a" only_singular; ask_V2Q = dirV2 (mkV perfective "спросить" "спрошу" "спросит") ; baby_N = mkN "малыш" masculine animate "4b" ; back_N = mkN "спина" ; bad_A = mkA "плохой" "хуже" "3b/c'"; bank_N = mkN "банк" ; - bark_N = mkN "кора"; + bark_N = (mkNplus (mkN "кора")) ** {mayben=only_singular} ; beautiful_A = mkA "красивый" ; become_VA = mkV imperfective intransitive "становиться" "становлюсь" "становится"; beer_N = mkN "пиво" neuter inanimate ; @@ -101,7 +101,7 @@ lin fat_N = mkN "жир" ; father_N2 = mkN2 (mkN "отец" masculine inanimate "5*b"); fear_V2 = mkV2 (mkV imperfective intransitive "бояться" "боюсь" "боится") Gen ; - fear_VS = mkV imperfective "бояться" "боюсь" "боится"; --intran + fear_VS = mkVS (mkV imperfective "бояться" "боюсь" "боится" ) ; --intran feather_N = (mkNplus (mkN "перо" neuter inanimate "1d")) ** {pnom="перья";pgen="перьев";pdat="перьям";pacc="перья";pins="перьями";pprep="перьях"}; fight_V2 = mkV2 (mkV imperfective intransitive "бороться" "борюсь" "борется") with_Prep ; find_V2 = mkV2 (mkV imperfective "находить" "нахожу" "находит"); @@ -128,7 +128,7 @@ lin give_V3 = tvDirDir (mkV imperfective "давать" "даю" "даёт") ; glove_N = mkN "перчатка" feminine inanimate "3*a"; go_V = mkV imperfective intransitive "ходить" "хожу" "ходит"; - gold_N = mkN "золото" ; + gold_N = (mkNplus (mkN "золото")) ** {mayben=only_singular} ; good_A = mkA "хороший" "лучше" ; grammar_N = mkN "грамматика"; grass_N = mkN "трава"; @@ -144,27 +144,27 @@ lin heart_N = mkN "сердце" neuter inanimate "5*c" ; heavy_A = (mkAltShort (mkA "тяжёлый" "тяжелее") (mkA "тяжелый")) ** {sm="тяжёл"} ; -- TODO: same hill_N = mkN "холм" ; - hit_V2 = mkV2 (mkV imperfective "ударять" "ударяю" "ударяет"); - hold_V2 = mkV2 (mkV imperfective "держать" "держу" "держит"); - hope_VS= mkV imperfective "надеяться" "надеюсь" ; + hit_V2 = mkV2 (mkV imperfective "ударять" "ударяю" "ударяет") ; + hold_V2 = mkV2 (mkV imperfective "держать" "держу" "держит") ; + hope_VS = mkVS (mkV imperfective "надеяться" "надеюсь") ; horn_N = mkN "рог" masculine inanimate "3c(1)" ; horse_N = mkN "лошадь" feminine animate "8e" ; hot_A = mkA "горячий" "" "4a/b"; house_N = mkN "дом" masculine inanimate "1c(1)" ; hunt_V2 = mkV2 (mkV imperfective intransitive "охотиться" "охочусь" "охотится") (lin Prep {s="на" ; c=Acc ; hasPrep=True}) ; husband_N = (mkNplus (mkN "муж" masculine animate "4c")) ** {pnom="мужья";pgen="мужей";pdat="мужьям";pacc="мужей";pins="мужьями";pprep="мужьях"}; - ice_N = (mkNplus (mkN "лёд" masculine animate "1b")) ** {sloc="льду";sptv="льду"} ; + ice_N = (mkNplus (mkN "лёд" masculine animate "1*b")) ** {sloc="льду";sptv="льду"} ; important_A = mkA "важный" ; industry_N = mkN "промышленность" ; - iron_N = mkN "железо" ; + iron_N = (mkNplus (mkN "железо")) ** {mayben=only_singular}; john_PN = mkPN "Иван" masculine animate ; jump_V = mkV imperfective intransitive "прыгать" "прыгаю" "прыгает"; kill_V2 = mkV2 (mkV imperfective "убивать" "убиваю"); king_N = mkN "король" masculine animate "2b"; knee_N = (mkNplus (mkN "колено" neuter inanimate "1a")) ** {pnom="колени";pgen="коленей";pdat="коленям";pacc="колени";pins="коленями";pprep="коленях"} ; - know_V2 = mkV2 (mkV imperfective "знать" "знаю"); - know_VQ = mkV imperfective "знать" "знаю"; - know_VS= mkV imperfective "знать" "знаю" ; + know_V2 = mkV2 (mkV imperfective "знать" "знаю") ; + know_VQ = mkVQ (mkV imperfective "знать" "знаю") ; + know_VS = mkVS (mkV imperfective "знать" "знаю") ; lake_N = (mkNplus (mkN "озеро" neuter inanimate "1a")) ** {pnom="озёра";pgen="озёр";pdat="озёрам";pacc="озёра";pins="озёрами";pprep="озёрах"} ; lamp_N = mkN "лампа" ; language_N = mkN "язык" ; @@ -188,7 +188,7 @@ lin man_N = (mkNAltPl (mkN "человек" masculine animate "3a") (mkN "людь" masculine animate)) ** {pins="людьми"}; married_A2 = mkA2 (mkA "замужем" "" "0") behind_Prep ; -- for Fem only meat_N = mkN "мясо" neuter inanimate "1c" ; - milk_N = mkN "молоко" neuter inanimate "3d(1)" ; + milk_N = mkN "молоко" neuter inanimate "3d(1)" only_singular ; moon_N = mkN "луна" ; mother_N2 = (mkN2plus (mkN2 "матерь" feminine animate "8e" nullPrep)) ** {snom="мать";sacc="мать";svoc="мать";} ; mountain_N = mkN "гора" ; @@ -249,7 +249,7 @@ lin run_V = mkV imperfective intransitive "бегать" "бегу" "бежит" ; salt_N = mkN "соль" ; sand_N = (mkNplus (mkN "песок" masculine inanimate "3*b")) ** {sptv="песку"} ; - say_VS = mkV imperfective "говорить" "говорю" "говорит" ; + say_VS = mkVS (mkV imperfective "говорить" "говорю" "говорит") ; school_N = mkN "школа" ; science_N = mkN "наука" ; scratch_V2 = mkV2 (mkV imperfective "чесать" "чешу" "чешет"); @@ -267,7 +267,7 @@ lin shoe_N = mkN "туфля" feminine inanimate "2*a" ; shop_N = mkN "магазин" ; short_A = mkA "короткий" "короче" "3*a/c'"; - silver_N = mkN "серебро" ; + silver_N = (mkNplus (mkN "серебро")) ** {mayben=only_singular}; sister_N = mkN "сестра" feminine animate ; sit_V = mkV imperfective intransitive "сидеть" "сижу" "сидит"; skin_N = mkN "кожа" ; @@ -344,7 +344,7 @@ lin wing_N = (mkNplus (mkN "крыло" neuter inanimate "1d")) ** {pnom="крылья";pgen="крыльев";pdat="крыльям";pacc="крылья";pins="крыльями";pprep="крыльях"}; wipe_V2 = mkV2 (mkV imperfective "вытирать" "вытираю"); woman_N = mkN "женщина" feminine animate ; - wonder_VQ = mkV imperfective "интересовать" "интересую" "интересует"; + wonder_VQ = mkVQ (mkV imperfective "интересовать" "интересую" "интересует") ; wood_N = mkN "древесина" feminine inanimate "1a" ; worm_N = mkN "червь" masculine animate ; write_V2 = mkV2 (mkV imperfective "писать" "пишу" "пишет"); diff --git a/src/russian/NounRus.gf b/src/russian/NounRus.gf index 56c468ac..d4c4d506 100644 --- a/src/russian/NounRus.gf +++ b/src/russian/NounRus.gf @@ -10,21 +10,11 @@ lin DetCN det cn = let n = numSizeNumber det.size in { s=case det.type of { - -- EmptyIndef => \\cas => - -- let d=case n of {Pl=>a_Pl_Det; _=>a_Det} in - -- d.s ! det.g ! Inanimate ! cas - -- ++ det.s ! cn.g ! cn.anim ! cas - -- ++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ; - -- EmptyDef => \\cas => - -- let d=case n of {Pl=>the_Pl_Det; _=>the_Det} in - -- d.s ! det.g ! Inanimate ! cas - -- ++ det.s ! cn.g ! cn.anim ! cas - -- ++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ; _ => \\cas => det.s ! cn.g ! cn.anim ! cas ++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size } ; pron=False ; - a=Ag (gennum det.g n) P3 + a=Ag (gennum det.g (forceMaybeNum cn.mayben n)) P3 } ; -- : PN -> NP ; -- John @@ -65,22 +55,25 @@ lin } ; -- : CN -> NP ; -- (beer) - MassNP cn = { - s = \\cas => cn.s ! Sg ! cas ; -- can it be plural-only? eg квасцы - pron=False ; - a = Ag (gennum cn.g Sg) P3 - } ; + MassNP cn = + let n=forceMaybeNum cn.mayben Sg in { + s = \\cas => cn.s ! Sg ! cas ; + pron=False ; + a = Ag (gennum cn.g n) P3 + } ; -- : N2 -> NP -> CN ; -- mother of the king - мать короля ComplN2 n2 np = { s=\\n,cas=> (nounFormsNoun n2).s ! n ! cas ++ n2.c2.s ++ np.s ! n2.c2.c ; g=n2.g ; + mayben=n2.mayben ; anim=n2.anim } ; -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) ComplN3 n3 np = let n3_noun = nounFormsNoun n3 in nounToNounForm { s=\\n,g=>n3_noun.s ! n ! g ++ n3.c2.s ++ np.s ! n3.c2.c ; g=n3.g ; + mayben=n3.mayben ; anim=n3.anim } ** {c2=n3.c3} ; @@ -146,7 +139,9 @@ lin -- Common nouns -- : AP -> CN -> CN ; -- big house - большой дом - AdjCN ap cn = cn ** {s = \\n,cas => preOrPost (notB ap.isPost) (ap.s ! (gennum cn.g n) ! cn.anim ! cas) (cn.s ! n ! cas)} ; + AdjCN ap cn = cn ** { + s = \\n,cas => preOrPost (notB ap.isPost) (ap.s ! (gennum cn.g (forceMaybeNum cn.mayben n)) ! cn.anim ! cas) (cn.s ! n ! cas) + } ; -- : N -> CN UseN n = nounFormsNoun n ; @@ -161,10 +156,14 @@ lin Use3N3 n3 = lin N2 n3 ; -- : CN -> RS -> CN ; -- house that John bought - RelCN cn rs = cn ** {s = \\n,c => cn.s ! n ! c ++ embedInCommas (rs.s ! gennum cn.g n ! cn.anim ! c)} ; + RelCN cn rs = cn ** { + s = \\n,c => cn.s ! n ! c ++ embedInCommas (rs.s ! gennum cn.g (forceMaybeNum cn.mayben n) ! cn.anim ! c) + } ; -- : CN -> SC -> CN ; -- question where she sleeps - SentCN cn sc = cn ** {s = \\n,c => cn.s ! n ! c ++ sc.s}; -- SC type will change??? + SentCN cn sc = cn ** { + s = \\n,c => cn.s ! n ! c ++ sc.s + }; -- SC type will change??? -- : CN -> Adv -> CN ; -- house on the hill AdvCN cn adv = cn ** {s = \\n,c => cn.s ! n ! c ++ adv.s}; diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index a2409aec..ae251fcc 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -1,14 +1,12 @@ -resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=ZaliznyakAlgo), Prelude in { +--1 Russian Lexical Paradigms ----------------- --- Parameters +resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=ZaliznyakAlgo), Prelude, Maybe in { + +--2 Parameters +-- oper - singular : Number - = Sg ; - plural : Number - = Pl ; - +-- Abstracting gender. Gender is a parameter for mkN, mkN2, mkN3 masculine : Gender = Masc ; feminine : Gender @@ -16,16 +14,31 @@ oper neuter : Gender = Neut ; +-- Abstracting numbers. Number is a parameter for mkPN, mkConj + singular : Number + = Sg ; + plural : Number + = Pl ; + +-- Limiting number + only_singular : MaybeNumber + = JustSg ; + only_plural : MaybeNumber + = JustPl ; + +-- Adjectives can have short and full form. ShortFormPreference type is a parameter for mkA short : ShortFormPreference = PrefShort ; full : ShortFormPreference = PrefFull ; +-- Animacy is needed for nouns and some pronouns. animate : Animacy = Animate ; inanimate : Animacy = Inanimate ; +-- Main cases: nominative : Case = Nom ; genitive : Case @@ -39,15 +52,15 @@ oper prepositional : Case = Pre ; - -- "Minor" cases: - - locative : Case +-- "Minor" cases: + locative : Case -- or Pre-2, some nouns have this different from prepositional case = Loc ; - partitive : Case + partitive : Case -- or Gen-2. Some nouns like "tee", have this in addition to genitive, usually spoken language = Ptv ; - vocative : Case + vocative : Case -- can be used in spoken language = VocRus ; +-- Degrees of adjectives positive : Degree = Posit ; comparative : Degree @@ -55,19 +68,134 @@ oper superlative : Degree = Superl ; +-- Aspects of verbs perfective : Aspect = Perfective ; imperfective : Aspect = Imperfective ; +-- Transitivity is verb's inherent characteristic. Can influence which forms are possible transitive : Transitivity = Transitive ; intransitive : Transitivity = Intransitive ; +-- Reflexivity is traditionally understood as inherent characteristic. Not to be confused with passive forms + reflexive : Reflexivity + = Reflexive ; + non_reflexive : Reflexivity + = NonReflexive ; + +-- Voice (not yet used) + active : Voice + = Act ; + passive : Voice + = Pass ; + +------------------------------ +--2 Nouns + + mkN : overload { + mkN : Str -> N ; -- can guess declension and gender of some nouns given nominative + mkN : Str -> Gender -> Animacy -> N ; -- can guess declension of more nouns + mkN : Str -> Gender -> Animacy -> (idx : Str) -> N ; -- Fourth parameter is a declension type index (based on Zaliznyak's dictionary), for example, "1*a(1)" + mkN : Str -> Gender -> Animacy -> (idx : Str) -> MaybeNumber -> N ; -- Same, but number restrictions can be added + mkN : A -> Gender -> Animacy -> N ; -- for nouns, which decline as adjective + mkN : A -> Gender -> Animacy -> MaybeNumber -> N ; -- same, with possibility to limit number (usually to only_singular) + mkN : N -> (link : Str) -> N -> N ; -- compound noun. Link can end on "-", in which case parts are glued together. First one characterizes the whole. + } ; + + mkN2 : overload { + mkN2 : N -> N2 ; + mkN2 : N -> Prep -> N2 ; + mkN2 : Str -> Gender -> Animacy -> (idx : Str) -> Prep -> N2 ; -- convenience for making N2. Fourth parameter is a declension type index (based on Zaliznyak's dictionary), for example, "1*f''(1)" + } ; + + mkN3 : overload { + mkN3 : N -> Prep -> Prep -> N3 ; + mkN3 : Str -> Gender -> Animacy -> (idx : Str) -> Prep -> Prep -> N3 ; -- convenience for making N2. Fourth parameter is a declension type index (based on Zaliznyak's dictionary), for example, "4*b" + } ; + + mkPN : overload { + mkPN : N -> PN ; + mkPN : N -> Str -> N -> PN ; -- see compound noun + } ; + +--2 Adjectives + + mkA : overload { + mkA : Str -> A ; -- can guess declension of many adjectives given nominative masculine + mkA : Str -> Str -> A ; -- same, but comparative given as a second argument + mkA : Str -> Str -> (idx : Str) -> A ; -- nom masc, comparative and third parameter is Zaliznyak's dictionary index, for example, "1a" + mkA : Str -> Str -> (idx : Str) -> ShortFormPreference -> A ; -- same, but with short form preference given + } ; + + ShortenA : A -> A ; + +-- Two-place adjectives need a preposition and a case as extra arguments. + + -- TODO: ? mkA2 : A -> Str -> Case -> A2 ; -- "делим на" + mkA2 : A -> Prep -> A2 ; + + mkOrd : overload { + mkOrd : (nom : Str) -> Ord ; + } ; + +------------------------- +--2 Verbs + + mkV : overload { + mkV : (inf : Str) -> (sg1 : Str) -> V ; -- guess some I conjugation verbs (not "ё") from infinitive and Sg P1, perfective, transitive + mkV : (inf : Str) -> (sg1 : Str) -> (sg3 : Str) -> V ; -- guess verb forms given Inf, Sg P1, Sg P3, perfective, transitive + mkV : Aspect -> (inf : Str) -> (sg1 : Str) -> (sg3 : Str) -> V ; -- same, but aspect as first parameter + mkV : Aspect -> Transitivity -> (inf : Str) -> (sg1 : Str) -> (sg3 : Str) -> V ; -- aspect, transitivity, Inf, Sg P1, Sg P3 + mkV : Aspect -> Transitivity -> (inf : Str) -> (sg1 : Str) -> (sg3 : Str) -> (idx : Str) -> V -- aspect, transitivity, Inf, Sg P1, Sg P3 and index from Zaliznyak's dictionary, eg "14a" + } ; + + mkV2 : overload { + mkV2 : V -> V2 ; -- most common case with Acc and no preposition + mkV2 : V -> Case -> V2 ; -- given case, but no preposition + mkV2 : V -> Prep -> V2 ; + } ; + + mkV3 : overload { + mkV3 : V -> Case -> Case -> V3 ; + mkV3 : V -> Prep -> Prep -> V3 ; + } ; + + mkVS : V -> VS ; + mkVQ : V -> VQ ; + mkV2V : V -> Prep -> V2V ; + mkV2S : V -> Prep -> V2S ; + mkV2Q : V -> Prep -> V2Q ; + mkV2A : V -> Prep -> V2A ; + + dirV2 : V -> V2 ; + tvDirDir : V -> V3 ; + mkVV : V -> VV; + +------------------------ +--2 Adverbs, prepositions, conjunctions, ... + + mkAdv : Str -> Adv ; + mkIAdv : Str -> IAdv ; + mkConj : overload { + mkConj : Str -> Number -> Conj ; -- only middle conjunction + mkConj : Str -> Str -> Number -> Conj ; -- two-part conjunction + } ; + + mkInterj : Str -> Interj ; + mkPrep : Str -> Case -> Prep ; + +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. +--. + ------------------------------ -- Nouns + nullPrep : Prep = lin Prep {s=[]; c=Gen; hasPrep=False} ; + mkN = overload { mkN : Str -> N = \nom -> lin N (guessNounForms nom) ; @@ -79,8 +207,14 @@ oper = \word, g, anim, z -> lin N (noMinorCases (Z.makeNoun word g anim z)) ; mkN : Str -> Gender -> Animacy -> Str -> N = \word, g, anim, zi -> lin N (noMinorCases (Z.makeNoun word g anim (Z.parseIndex zi))) ; + mkN : Str -> Gender -> Animacy -> Str -> MaybeNumber -> N + = \word, g, anim, zi, mbn -> lin N (applyMaybeNumber ((noMinorCases (Z.makeNoun word g anim (Z.parseIndex zi))) ** {mayben=mbn})) ; mkN : A -> Gender -> Animacy -> N = \a, g, anim -> lin N (makeNFFromAF a g anim) ; + mkN : A -> Gender -> Animacy -> MaybeNumber -> N + = \a, g, anim, mbn -> lin N (applyMaybeNumber ((makeNFFromAF a g anim) ** {mayben=mbn})) ; + mkN : N -> Str -> N -> N + = \n1,link,n2 -> lin N (compoundN n1 link n2) ; -- For backwards compatibility: mkN : (nomSg, genSg, datSg, accSg, instSg, preposSg, prepos2Sg, nomPl, genPl, datPl, accPl, instPl, preposPl : Str) -> Gender -> Animacy -> N @@ -89,6 +223,7 @@ oper snom=nomSg;pnom=nomPl;sgen=genSg;pgen=genPl;sdat=datSg;pdat=datPl;sacc=accSg;pacc=accPl;sins=instSg;pins=instPl;sprep=preposSg;pprep=preposPl; sloc=prepos2Sg; sptv=genSg ; svoc=nomSg ; anim=anim; + mayben=BothSgPl ; g=g } ; } ; @@ -114,6 +249,8 @@ oper mkPN = overload { mkPN : N -> PN = \n -> lin PN n ; + mkPN : N -> Str -> N -> PN + = \n1,link,n2 -> lin PN (compoundN n1 link n2) ; mkPN : Str -> PN = \nom -> lin PN (guessNounForms nom) ; mkPN : Str -> Gender -> Animacy -> PN @@ -140,13 +277,16 @@ oper = \nom, comp, zi, spf -> lin A (makeAdjectiveForms nom comp zi spf) ; } ; + ShortenA : A -> A + = \a -> a ** {preferShort = PrefShort} ; + -- Two-place adjectives need a preposition and a case as extra arguments. -- TODO: ? mkA2 : A -> Str -> Case -> A2 ; -- "делим на" mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {c = p}) ; - mkOrd = overload { -- ord from adj. TODO: This shadows mkOrd from constructors... + mkOrd = overload { mkOrd : (nom : Str) -> Ord = \nom -> lin Ord (guessAdjectiveForms nom) ; } ; @@ -208,33 +348,17 @@ oper = \vf, prep1, prep2, cas1, cas2 -> lin V3 (vf ** {c={s=prep1 ; c=cas1 ; hasPrep=True} ; c2={s=prep2 ; c=cas2 ; hasPrep=True}} ) ; } ; - dirV2 : V -> V2 ; - dirV2 v = mkV2 v Acc ; - tvDirDir : V -> V3 ; - tvDirDir v = mkV3 v Acc Dat ; - mkVV : V -> VV; + dirV2 v = mkV2 v Acc ; + tvDirDir v = mkV3 v Acc Dat ; mkVV = \v -> lin VV {v=v; modal=\\a=>[]} ; - -- for backwards compatibility only. Use mkV methods instead. - -- These are deprecated! -param Conjugation = First | FirstE | Second | SecondA | Mixed | Dolzhen | Foreign ; -oper - first, firstE, second, mixed, dolzhen, foreign : Conjugation ; - first = First ; firstE = FirstE ; second = Second ; secondA = SecondA ; mixed = Mixed ; dolzhen = Dolzhen; foreign = Foreign; - - -- Do not use the following method as it is only approximate because it does not use most informative SgP3 amd - -- SgP3 is being guessed instead from SgP1. - regV : Aspect -> Conjugation -> (stemPresSg1,endPresSg1,pastSg1,imp,inf : Str) -> V ; - regV asp bconj stemPresSg1 endPresSg1 pastSg1 imp inf = - let sg1=stemPresSg1 + endPresSg1 in - let sg3 : Str = case bconj of { - First => (Z.sg1StemFromVerb sg1) + "ет" ; - Mixed => (Z.sg1StemFromVerb sg1) + "чет" ; - FirstE => (Z.sg1StemFromVerb sg1) + "ёт" ; - Second | SecondA => (Z.sg1StemFromVerb sg1) + "ит" ; - _ => (Z.sg1StemFromVerb sg1) + "ет" - } in (guessVerbForms asp Transitive inf sg1 sg3) ** {lock_V=<>} ; + mkVS v = lin VS v ; + mkVQ v = lin VQ v ; + mkV2V v prep = lin V2V (v ** {c=prep}) ; + mkV2S v prep = lin V2S (v ** {c=prep}) ; + mkV2Q v prep = lin V2Q (v ** {c=prep}) ; + mkV2A v prep = lin V2A (v ** {c=prep}) ; ------------------------ -- Adverbs, prepositions, conjunctions, ... @@ -257,4 +381,24 @@ oper mkPrep : Str -> Case -> Prep = \s,c -> lin Prep {s = s ; c = c ; hasPrep = True} ; + + -- for backwards compatibility only. Use mkV methods instead. + -- These are deprecated! +param Conjugation = First | FirstE | Second | SecondA | Mixed | Dolzhen | Foreign ; +oper + first, firstE, second, mixed, dolzhen, foreign : Conjugation ; + first = First ; firstE = FirstE ; second = Second ; secondA = SecondA ; mixed = Mixed ; dolzhen = Dolzhen; foreign = Foreign; + + -- Do not use the following method as it is only approximate because it does not use most informative SgP3 amd + -- SgP3 is being guessed instead from SgP1. + regV : Aspect -> Conjugation -> (stemPresSg1,endPresSg1,pastSg1,imp,inf : Str) -> V ; + regV asp bconj stemPresSg1 endPresSg1 pastSg1 imp inf = + let sg1=stemPresSg1 + endPresSg1 in + let sg3 : Str = case bconj of { + First => (Z.sg1StemFromVerb sg1) + "ет" ; + Mixed => (Z.sg1StemFromVerb sg1) + "чет" ; + FirstE => (Z.sg1StemFromVerb sg1) + "ёт" ; + Second | SecondA => (Z.sg1StemFromVerb sg1) + "ит" ; + _ => (Z.sg1StemFromVerb sg1) + "ет" + } in (guessVerbForms asp Transitive inf sg1 sg3) ** {lock_V=<>} ; } \ No newline at end of file diff --git a/src/russian/ParamRus.gf b/src/russian/ParamRus.gf index 8b1fe5b2..728d5133 100644 --- a/src/russian/ParamRus.gf +++ b/src/russian/ParamRus.gf @@ -29,11 +29,15 @@ param Case = Nom | Gen | Dat | Acc | Ins | Pre -- падеж, "малые падежи": | Loc | Ptv | VocRus ; -- "minor cases", usually Loc = Pre, Ptv = Gen, VocRus = Nom ShortFormPreference = PrefShort | PrefFull ; - CopulaType = NomCopula | InsCopula | EllCopula; + CopulaType = NomCopula | InsCopula | EllCopula | ExplicitCopula ; SpecialFuture = NormalFuture | BeFuture | CanFuture | WantFuture | NullFuture ; DetType = NormalDet | EmptyDef | EmptyIndef ; -- artificial parameter to side-step DetNP parsing issues oper MaybeAgr = Maybe Agr ; + MaybeNumber = Maybe Number ; + JustSg = Just Number Sg ; + JustPl = Just Number Pl ; + BothSgPl = Nothing Number Sg ; -- Both are possible, nothing limited -- GenNum helpers and coercions MSg = GSg Masc ; FSg = GSg Fem ; diff --git a/src/russian/QuestionRus.gf b/src/russian/QuestionRus.gf index 9c1c0d90..de8403d0 100644 --- a/src/russian/QuestionRus.gf +++ b/src/russian/QuestionRus.gf @@ -64,7 +64,7 @@ lin -- : IDet -> CN -> IP ; -- which five songs IdetCN idet cn = caseTableToRecord (\\cas => idet.s ! cn.g ! cn.anim ! cas ++ cn.s ! numSizeNum cas idet.size ! numSizeCase cas idet.size) - (Ag (gennum cn.g (numSizeNumber idet.size)) P3) cn.anim ; + (Ag (gennum cn.g (forceMaybeNum cn.mayben (numSizeNumber idet.size))) P3) cn.anim ; -- : IDet -> IP ; -- which five IdetIP idet = caseTableToRecord (\\cas => idet.s ! idet.g ! Inanimate ! cas) diff --git a/src/russian/ResRus.gf b/src/russian/ResRus.gf index 4431af80..f1e77c41 100644 --- a/src/russian/ResRus.gf +++ b/src/russian/ResRus.gf @@ -1,4 +1,4 @@ -resource ResRus = ParamRus ** open Prelude, ZaliznyakAlgo in { +resource ResRus = ParamRus ** open Prelude, ZaliznyakAlgo, Maybe in { flags coding=utf8 ; optimize=all ; --------------- @@ -30,8 +30,11 @@ oper snom, sgen, sdat, sacc, sins, sprep, sloc, sptv, svoc, pnom, pgen, pdat, pacc, pins, pprep : Str ; g : Gender ; + mayben : MaybeNumber ; anim : Animacy } ; + Noun2Forms = NounForms ** {c2 : ComplementCase} ; + Noun3Forms = NounForms ** {c2,c3 : ComplementCase} ; -- But traditional tables make agreement easier to handle in syntax -- so this is the lincat of CN @@ -39,13 +42,15 @@ oper Noun : Type = { s : Number => Case => Str ; g : Gender ; + mayben : MaybeNumber ; -- used to control dependent words anim : Animacy } ; - Noun2Forms = NounForms ** {c2 : ComplementCase} ; - Noun3Forms = NounForms ** {c2,c3 : ComplementCase} ; - --- this is used in UseN + NounPhrase = { + s : Case => Str ; + pron : Bool ; -- this only indicates n-prefixable pronouns + a : Agr + } ; nounFormsNoun : NounForms -> Noun = \forms -> { @@ -74,6 +79,7 @@ oper } } ; g = forms.g ; + mayben=forms.mayben ; anim = forms.anim } ; @@ -140,18 +146,43 @@ oper sloc = base.sprep ; sptv = base.sgen ; svoc = base.snom ; + mayben = BothSgPl } ; mkNAltPl : NounForms -> NounForms -> NounForms = \sgn, pln -> sgn ** { - pnom = pln.pnom ; - pgen = pln.pgen ; - pdat = pln.pdat ; - pacc = pln.pacc ; - pins = pln.pins ; - pprep= pln.pprep + pnom = pln.pnom ; + pgen = pln.pgen ; + pdat = pln.pdat ; + pacc = pln.pacc ; + pins = pln.pins ; + pprep = pln.pprep } ; + applyMaybeNumber : NounForms -> NounForms + = \nf -> case