From e4f9b85f53f5bcdc3a0f9b9fedfb4a312aea2038 Mon Sep 17 00:00:00 2001 From: Roman Suzi Date: Sun, 2 Aug 2020 19:24:28 +0300 Subject: [PATCH] Improvements to Number; started doc --- src/russian/AdjectiveRus.gf | 4 +- src/russian/ConjunctionRus.gf | 4 + src/russian/DocumentationRus.gf | 51 +---- src/russian/DocumentationRusEng.gf | 6 + src/russian/DocumentationRusFunctor.gf | 304 +++++++++++++++++++++++++ src/russian/LangRus.gf | 4 +- src/russian/LexiconRus.gf | 32 +-- src/russian/NounRus.gf | 37 ++- src/russian/ParadigmsRus.gf | 220 ++++++++++++++---- src/russian/ParamRus.gf | 6 +- src/russian/QuestionRus.gf | 2 +- src/russian/ResRus.gf | 104 +++++++-- src/russian/StructuralRus.gf | 2 +- src/russian/SymbolRus.gf | 12 +- src/russian/TerminologyRus.gf | 93 ++++++++ src/russian/VerbRus.gf | 8 +- src/russian/test_rus_grammar.gfs | 116 +++++++++- src/russian/todo.txt | 43 +++- 18 files changed, 884 insertions(+), 164 deletions(-) create mode 100644 src/russian/DocumentationRusEng.gf create mode 100644 src/russian/DocumentationRusFunctor.gf create mode 100644 src/russian/TerminologyRus.gf diff --git a/src/russian/AdjectiveRus.gf b/src/russian/AdjectiveRus.gf index 3908b827f..52b999423 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 30cd0a6e0..e64ebd392 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 dca6e8473..a815c0b70 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 000000000..f95341743 --- /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 000000000..a78878404 --- /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 ec9337a6e..5c4b6c927 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 6a0af2f9b..62c12c477 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 56c468acb..d4c4d5066 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 a2409aec7..ae251fcce 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 8b1fe5b27..728d51336 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 9c1c0d90c..de8403d06 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 4431af800..f1e77c417 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 of { + => nf ** { + pnom = nf.snom ; + pgen = nf.sgen ; + pdat = nf.sdat ; + pacc = nf.sacc ; + pins = nf.sins ; + pprep = nf.sprep + } ; + => nf ** { + snom = nf.pnom ; + sgen = nf.pgen ; + sdat = nf.pdat ; + sacc = nf.pacc ; + sins = nf.pins ; + sprep = nf.pprep ; + sloc = nf.pprep ; + sptv = nf.pgen ; + svoc = nf.pnom ; + } ; + _ => nf + } ; + mkNplus : NounForms -> NounForms = \nf -> nf ; @@ -176,6 +207,27 @@ oper from2 = {s="из"; c=Gen; hasPrep=True} ; + compoundN : NounForms -> Str -> NounForms -> NounForms + = \n1,link,n2 -> + let l : Str=case link of {x+"-" => BIND ++ "-" ++ BIND ; _ => link} in + n1 ** { + snom = n1.snom ++ l ++ n2.snom ; + sgen = n1.sgen ++ l ++ n2.sgen ; + sdat = n1.sdat ++ l ++ n2.sdat ; + sacc = n1.sacc ++ l ++ n2.sacc ; + sins = n1.sins ++ l ++ n2.sins ; + sprep = n1.sprep ++ l ++ n2.sprep ; + sloc = n1.sloc ++ l ++ n2.sloc ; + sptv = n1.sptv ++ l ++ n2.sptv ; + svoc = n1.svoc ++ l ++ n2.svoc ; + pnom = n1.pnom ++ l ++ n2.pnom ; + pgen = n1.pgen ++ l ++ n2.pgen ; + pdat = n1.pdat ++ l ++ n2.pdat ; + pacc = n1.pacc ++ l ++ n2.pacc ; + pins = n1.pins ++ l ++ n2.pins ; + pprep = n1.pprep ++ l ++ n2.pprep + } ; + --------------------------- -- Adjectives -- Прилагательные @@ -373,6 +425,7 @@ oper sptv = af.fsgen ; svoc = af.fsnom ; g=g ; + mayben=BothSgPl ; anim=anim } ; Masc => { @@ -392,6 +445,7 @@ oper sptv = af.msgen ; svoc = af.msnom ; g=g ; + mayben=BothSgPl ; anim=anim } ; Neut => { @@ -411,6 +465,7 @@ oper sptv = af.msgen ; svoc = af.nsnom ; g=g ; + mayben=BothSgPl ; anim=anim } } ; @@ -511,9 +566,20 @@ oper prpl3="" } ; + copulaFull : VerbForms + = copula ** { + prsg1="есть" ; + prsg2="есть" ; + prsg3="есть" ; + prpl1="есть" ; + prpl2="есть" ; + prpl3="есть" + } ; + selectCopula : CopulaType -> VerbForms = \cop -> case cop of { NomCopula => copula ; + ExplicitCopula => copulaFull ; EllCopula => copulaEll ; InsCopula => copulaIns } ; @@ -1109,6 +1175,7 @@ oper pptv=n.s ! Pl ! Ptv ; pvoc=n.s ! Pl ! VocRus ; g=n.g ; + mayben=n.mayben ; anim=n.anim } ; @@ -1272,6 +1339,10 @@ oper size : NumSize } ; + -- choose number, force limited number if necessary + forceMaybeNum : MaybeNumber -> Number -> Number + = \mbn,n -> fromMaybe Number n mbn; + -- Number from size to be used in agreement after numeral has been applied numSizeNumber : NumSize -> Number = \ns -> case ns of {Num1 => Sg ; NumAll | Num2_4 | Num5 => Pl} ; @@ -1294,13 +1365,12 @@ oper numSizeGenAgr : NumSize -> Gender -> Person -> Agr = \ns,g,p -> Ag (case ns of {Num1 => GSg g ; NumAll | Num2_4 | Num5 => GPl}) p ; -oper -- TODO: - ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ; - ---------------- -- Misc oper + ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ; + applyPrep : ComplementCase -> NounPhrase -> Str = \prep,np -> case of { => prep.s ++ "н" ++ BIND ++ (np.s ! prep.c) ; @@ -1310,10 +1380,4 @@ oper applyIPronPrep : ComplementCase -> IPronounForms -> Str = \prep,ip -> prep.s ++ selectIPronCase ip prep.c ; - NounPhrase = { - s : Case => Str ; - -- , prep : Case => Str -- what for is this neeeded? - pron : Bool ; -- this only indicates n-prefixable pronouns - a : Agr - } ; } diff --git a/src/russian/StructuralRus.gf b/src/russian/StructuralRus.gf index 8e52b9686..a2c8f9ad2 100644 --- a/src/russian/StructuralRus.gf +++ b/src/russian/StructuralRus.gf @@ -96,7 +96,7 @@ lin less_CAdv = X.mkCAdv "менее" "чем" ; more_CAdv = X.mkCAdv "более" "чем" ; - as_CAdv = X.mkCAdv "так же" "как и" ; + as_CAdv = X.mkCAdv "так же" "как и" ; -- requires short form adjective can8know_VV = {v=can; modal=\\a=>[]} ; can_VV = {v=can; modal=\\a=>[]} ; diff --git a/src/russian/SymbolRus.gf b/src/russian/SymbolRus.gf index c2adbb2b4..d07eceef0 100644 --- a/src/russian/SymbolRus.gf +++ b/src/russian/SymbolRus.gf @@ -15,17 +15,19 @@ lin NumPN card = (immutableNounForms (card.s ! Neut ! Inanimate ! Nom) Neut Inanimate) ** {g = Neut; a = Inanimate} ; -- : CN -> Card -> NP ; -- level five ; level 5 - CNNumNP cn n = { - s = \\cas => cn.s ! Sg ! cas ++ n.s ! cn.g ! cn.anim ! cas ; + CNNumNP cn card = { + s = \\cas => cn.s ! Sg ! cas ++ card.s ! cn.g ! cn.anim ! cas ; pron=False ; - a = Ag (gennum cn.g Sg) P3 + a = Ag (gennum cn.g (forceMaybeNum cn.mayben Sg)) P3 } ; -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and CNSymbNP det cn xs = { - s=\\cas => det.s ! cn.g ! cn.anim ! cas ++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ++ xs.s ; + s=\\cas => det.s ! cn.g ! cn.anim ! cas + ++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size + ++ xs.s ; pron=False ; - a=Ag (gennum cn.g (numSizeNumber det.size)) P3 + a=Ag (gennum cn.g (forceMaybeNum cn.mayben ((numSizeNumber det.size)))) P3 } ; -- : Symb -> S ; -- A diff --git a/src/russian/TerminologyRus.gf b/src/russian/TerminologyRus.gf new file mode 100644 index 000000000..bf2b1366a --- /dev/null +++ b/src/russian/TerminologyRus.gf @@ -0,0 +1,93 @@ +--# -path=.:../abstract:../common + +concrete TerminologyRus of Terminology = CatRus ** open + ResRus, + ParadigmsRus, + (G = GrammarRus), + (S = SyntaxRus), + (L = LexiconRus), + Prelude, + HTML +in { +flags coding=utf8 ; + +lincat + Category = G.N ; + ParameterType = G.N ; + Parameter = G.N ; + Modifier = G.A ; + Heading = {s : Str} ; + +lin + noun_Category = mkN (mkA "существительный") neuter inanimate ; + adjective_Category = mkN (mkA "прилагательный") neuter inanimate ; + verb_Category = mkN "глагол" ; + adverb_Category = mkN "наречие" ; + preposition_Category = mkN "предлог" ; + + finite_form_ParameterType = mkN (mkN (mkA "личный" "" "1*a") feminine inanimate) "" (mkN "форма") ; + nominal_form_ParameterType = mkN (mkN (mkA "субстантивный" "" "1*a") feminine inanimate) "" (mkN "форма") ; + + singular_Parameter = mkN "ед.ч." ; + plural_Parameter = mkN "мн.ч." ; + + masculine_Parameter = mkN "мужской" ; + feminine_Parameter = mkN "женский" ; + neuter_Parameter = mkN "средний" ; + + nominative_Parameter = mkN "именительный" ; + genitive_Parameter = mkN "родительный" ; + dative_Parameter = mkN "дательный" ; + accusative_Parameter = mkN "винительный" ; + + partitive_Parameter = mkN "разделительный" ; + translative_Parameter = mkN "становительный" ; + essive_Parameter = mkN "эссив" ; + inessive_Parameter = mkN "инессив" ; + elative_Parameter = mkN "элатив" ; + illative_Parameter = mkN "иллатив" ; + adessive_Parameter = mkN "адессив" ; + ablative_Parameter = mkN "аблатив" ; + allative_Parameter = mkN "аллатив" ; + abessive_Parameter = mkN "абессив" ; + comitative_Parameter = mkN "комитатив" ; + instructive_Parameter = mkN "инструктив" ; + + active_Parameter = mkN "автивный" ; + passive_Parameter = mkN "пассивный" ; + + imperative_Parameter = mkN "повелительное" ; + indicative_Parameter = mkN "изъявительное" ; + conjunctive_Parameter = mkN "сослагательное" ; + infinitive_Parameter = mkN "инфинитив" ; + + present_Parameter = mkN "настоящее" ; + past_Parameter = mkN "прошлое" ; + future_Parameter = mkN "будущее" ; + conditional_Parameter = mkN "условное" ; + perfect_Parameter = mkN "перфект" ; + potential_Parameter = mkN "потенциал" ; + + participle_Parameter = mkN "причастие" ; + aux_verb_Parameter = mkN "глагол" ; + agent_Parameter = mkN "агенс" ; + + positive_Parameter = mkN "положительная" ; + comparative_Parameter = mkN "сравнительная" ; + superlative_Parameter = mkN "превосходная" ; + predicative_Parameter = mkN "предикатив" ; + negative_Parameter = mkN "отрицательное" ; + positivePol_Parameter = mkN "утвердительное" ; + + long_Parameter = mkN "длинная" ; + short_Parameter = mkN "краткая" ; + + finite_Modifier = mkA "финитный" ; + + nounHeading n = ss n.snom ; + nounPluralHeading n = ss n.pnom ; + + formGF_N = mkN "форма" ; + exampleGr_N = mkN "пример" ; + +} diff --git a/src/russian/VerbRus.gf b/src/russian/VerbRus.gf index ce394169d..0e6bd8305 100644 --- a/src/russian/VerbRus.gf +++ b/src/russian/VerbRus.gf @@ -168,9 +168,13 @@ lin CompNP np = {s=\\a=>np.s ! Ins ; adv=[] ; cop=InsCopula} ; -- : Adv -> Comp ; -- (be) here - CompAdv adv = {s=\\a=>[] ; adv=adv.s ; cop=NomCopula} ; + CompAdv adv = {s=\\a=>[] ; adv=adv.s ; cop=ExplicitCopula} ; -- : CN -> Comp ; -- (be) a man/men - CompCN cn = {s=\\a=>cn.s ! numGenNum (agrGenNum a) ! Ins ; adv=[] ; cop=InsCopula} ; + CompCN cn = { + s=\\a=>cn.s ! numGenNum (agrGenNum a) ! Ins ; + adv=[] ; + cop=InsCopula + } ; -- : VP ; -- be UseCopula = {adv=\\a=>[] ; verb=copulaIns ; dep=[] ; compl=\\a=>[]} ; diff --git a/src/russian/test_rus_grammar.gfs b/src/russian/test_rus_grammar.gfs index 9f2e32fd2..33782b1b4 100644 --- a/src/russian/test_rus_grammar.gfs +++ b/src/russian/test_rus_grammar.gfs @@ -17,13 +17,125 @@ gt RelCN (UseN apple_N) (UseRCl ? PPos (RelSlash IdRP (SlashVP (UsePN john_PN) ( gt RelCN (UseN apple_N) (UseRCl (TTAnt TCond AAnter) PPos (RelSlash IdRP (SlashVP (MassNP (RelCN (UseN bird_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (UsePN john_PN) (Slash3V3 send_V3 (UsePN paris_PN))))))) (Slash3V3 add_V3 (UsePN paris_PN))))) | l -treebank gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a like_V2) (MassNP (RelCN (UseN worm_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP thirsty_VP)))))) | l -treebank gt RelSlash IdRP (SlashPrep (CleftAdv now_Adv (ConjS and_Conj (BaseS (UseCl (TTAnt TPres ASimul) PNeg (PredVP everybody_NP UseCopula)) (UseCl (TTAnt TPast ASimul) PPos (ImpersCl hungry_VP))))) in8front_Prep) | l -treebank -gt UseRCl (TTAnt TCond ASimul) PPos ( RelSlash IdRP ( SlashPrep ( CleftAdv now_Adv ( ConjS and_Conj (BaseS (UseCl (TTAnt TPres ASimul) PNeg (PredVP everybody_NP UseCopula)) (UseCl (TTAnt TPast ASimul) PPos (ImpersCl hungry_VP))) ) ) after_Prep ) ) |l -treebank +gt UseRCl (TTAnt TCond ASimul) PPos ( RelSlash IdRP (SlashPrep ( CleftAdv now_Adv ( ConjS and_Conj (BaseS (UseCl (TTAnt TPres ASimul) PNeg (PredVP everybody_NP UseCopula)) (UseCl (TTAnt TPast ASimul) PPos (ImpersCl hungry_VP))) ) ) after_Prep ) ) |l -treebank gt UseCl (TTAnt TPres AAnter) PPos (CleftNP (UsePron ?) (UseRCl (TTAnt TPast AAnter) PPos (RelVP IdRP ready_VP))) | l -treebank gt ComplA2 ? (UsePron she_Pron) | l -treebank gt ReflA2 ? |l -treebank +gt CAdvAP less_CAdv (PositA full_A) (MassNP (UseN2 brother_N2)) | l -treebank +gt TFullStop (PhrUtt NoPConj (UttAP (SentAP (CAdvAP less_CAdv (PositA full_A) (MassNP (UseN2 brother_N2))) (EmbedQS (UseQCl (TTAnt TPast ASimul) PPos (QuestCl (PredVP (UsePron ?) (AdvVP (UseV sit_V) (PrepNP on_Prep (MassNP (UseN table_N)))))))))) NoVoc) TEmpty | l -treebank gt EmbedQS (UseQCl (TTAnt ? ASimul) PNeg (ExistIP whatSg_IP)) | l -treebank gt timeunitRange (NumDigits (IDig ?)) (NumDigits (IDig ?)) second_Timeunit | l -treebank gt timeunitAdv (NumDigits (IDig ?)) second_Timeunit | l -treebank gt SelfNP (UsePron ? ) |l -treebank - gt RelCN (UseN apple_N) (UseRCl ? PPos (RelSlash IdRP (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))))) | l -treebank +gt bottle_of_CN (MassNP (UseN wine_N)) | l -treebank +gt glass_of_CN (MassNP (UseN wine_N)) | l -treebank +gt cup_of_CN (MassNP (UseN silver_N)) | l -treebank +gt UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron ?) (ComplSlash (SlashV2a drink_V2) (DetCN (DetQuant DefArt (NumCard (NumDigits (IDig D_2)))) (cup_of_CN (MassNP (UseN water_N)) )))) | l -treebank +gt n_units_of_NP (NumNumeral (num (pot3plus (pot1as2 pot110) (pot2plus pot01 pot111)))) (UseN cap_N) (MassNP (UseN water_N)) | l -treebank +gt n_unit_CN (NumNumeral (num (pot2as3 (pot1as2 pot110)))) (UseN cap_N) (bottle_of_CN (MassNP (UseN water_N))) |l -treebank +gt UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron ?) (ComplSlash (SlashV2a drink_V2) (MassNP (n_unit_CN (NumNumeral (num (pot2as3 (pot1as2 pot110)))) (UseN cap_N) (bottle_of_CN (MassNP (UseN water_N))))) )) | l -treebank +gt UseSlash (TTAnt TCond AAnter) ? (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))) |l -treebank +gt SlashVS (MassNP (UseN baby_N)) know_VS ( UseSlash (TTAnt TCond AAnter) ? (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))) ) | l -treebank +gt RelSlash IdRP ( SlashVS (MassNP (UseN baby_N)) know_VS ( UseSlash (TTAnt TCond AAnter) ? (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))) ) ) | l -treebank +gt UseRCl (TTAnt TPast ASimul) ? (RelSlash IdRP ( SlashVS (MassNP (UseN baby_N)) know_VS ( UseSlash (TTAnt TCond AAnter) ? (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))) ) ) ) | l -treebank +gt RelCN (UseN house_N) (UseRCl (TTAnt TPast ASimul) ? (RelSlash IdRP ( SlashVS (MassNP (UseN baby_N)) know_VS ( UseSlash (TTAnt TCond AAnter) ? (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))) ) ) ) )| l -treebank +gt RelCN (UseN woman_N) (UseRCl (TTAnt TPast ASimul) ? (RelSlash IdRP ( SlashVS (MassNP (UseN baby_N)) know_VS ( UseSlash (TTAnt TCond AAnter) ? (SlashVP (UsePN john_PN) (Slash3V3 talk_V3 (UsePN paris_PN))) ) ) ) )| l -treebank +gt UseCl (TTAnt TPres AAnter) PPos (ExistNP everything_NP) | l -treebank +gt SSubjS (UseCl (TTAnt TPres AAnter) PPos (ExistNP everything_NP)) because_Subj (UseCl (TTAnt TPres AAnter) PPos (ExistNP everything_NP)) | l -treebank +gt UseQCl (TTAnt TPres ASimul) PPos (QuestSlash whatSg_IP (AdvSlash (SlashVP (UsePN john_PN) (VPSlashPrep (UseV walk_V) for_Prep)) here_Adv ) ) | l -treebank + +gt ImpVP (AdvVP (AdVVP always_AdV (SelfAdvVP hungry_VP)) (weekdayNextAdv friday_Weekday)) |l -treebank + +gt PredSCVP (EmbedQS (UseQCl (TTAnt TCond AAnter) PNeg (QuestIAdv (AdvIAdv how8much_IAdv everywhere_Adv) (ExistNP nobody_NP)))) hungry_VP | l -treebank +gt RelCl (PredSCVP (EmbedQS (UseQCl (TTAnt TCond AAnter) PNeg (QuestIAdv (AdvIAdv how8much_IAdv everywhere_Adv) (ExistNP nobody_NP)))) hungry_VP) | l -treebank + +gt RelCl (PredSCVP (EmbedQS (UseQCl (TTAnt TCond AAnter) PNeg (QuestIAdv (AdvIAdv how8much_IAdv everywhere_Adv) (ExistNP nobody_NP)))) hungry_VP) | l -treebank +gt UseRCl (TTAnt TPres ASimul) PPos (RelCl (PredSCVP (EmbedQS (UseQCl (TTAnt TCond AAnter) PNeg (QuestIAdv (AdvIAdv how8much_IAdv everywhere_Adv) (ExistNP nobody_NP)))) hungry_VP) ) | l -treebank +gt RelS (UseCl (TTAnt TPres ASimul) PNeg (GenericCl scared_VP)) (UseRCl (TTAnt TPres ASimul) PPos (RelCl (PredSCVP (EmbedQS (UseQCl (TTAnt TCond AAnter) PNeg (QuestIAdv (AdvIAdv how8much_IAdv everywhere_Adv) (ExistNP nobody_NP)))) hungry_VP) )) | l -treebank + +gt UseCl (TTAnt ? ASimul) ? (GenericCl (ReflVP (SlashV2A paint_V2A (PositA young_A)))) | l -treebank +gt ImpP3 (MassNP (UseN woman_N)) (ReflVP (SlashV2A paint_V2A (PositA young_A))) | l -treebank +gt ImpPl1 (ReflVP (SlashV2A paint_V2A (PositA young_A))) | l -treebank + +gt UseCl (TTAnt TCond AAnter) ? (PredVP (MassNP (UseN heart_N)) (PassV2 squeeze_V2) ) | l -treebank +gt UseCl (TTAnt TCond AAnter) ? (PredVP (MassNP (UseN heart_N)) ( ComplVV ? (PassV2 squeeze_V2) ) ) | l -treebank +gt ComplVS hope_VS ( UseCl (TTAnt ? AAnter) ? (have_name_Cl (UsePron he_Pron) (UsePN john_PN)) ) | l -treebank +gt UseCl (TTAnt TPast ASimul) PPos (ImpersCl (ComplSlash (VPSlashPrep ill_VP possess_Prep) (UsePron we_Pron))) | l -treebank + +gt UseQCl (TTAnt ? ASimul) PPos (what_name_QCl (UsePron youSg_Pron)) | l -treebank + +gt UseA2 easy_A2V | l -treebank +gt SentAP (UseA2 easy_A2V) ( EmbedVP (ComplSlash (VPSlashPrep hungry_VP possess_Prep) (UsePron we_Pron)) ) | l -treebank +gt ComplVA become_VA ( SentAP (UseA2 easy_A2V) ( EmbedVP (ComplSlash (VPSlashPrep (UseV fall_V) possess_Prep) (UsePron we_Pron)) )) | l -treebank + +gt EmbedVP ( UseV ? ) | l -treebank +gt SentCN (UseN apple_N) (EmbedVP ( UseV fall_V ) ) | l -treebank +gt MassNP ( SentCN (UseN apple_N) (EmbedVP (UseV fall_V)) ) | l -treebank +gt UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlash (SlashV2a learn_V2) (DetCN (DetQuant DefArt NumSg) (SentCN (UseN apple_N) (EmbedVP (ProgrVP (UseV fall_V))))))) |l -treebank + +gt UseCl (TTAnt TPres ASimul) ? (PredVP (UsePron he_Pron) (ComplVQ know_VQ (UseQCl (TTAnt TPres ASimul) ? (QuestCl (PredVP (DetCN (DetQuant DefArt NumSg) (UseN apple_N)) (UseV fall_V)))))) | l -treebank +gt UseCl (TTAnt TPres ASimul) ? (PredVP (UsePron he_Pron) (ComplVQ know_VQ (UseQCl (TTAnt ? ASimul) ? (QuestCl (PredVP (DetCN (DetQuant DefArt NumSg) (UseN apple_N)) (AdVVP always_AdV (UseV fall_V))))))) | l -treebank + +gt UseCl (TTAnt TPres ASimul) PPos (PredVP (AdvNP (UsePron he_Pron) here_Adv) (UseV fall_V)) | l -treebank +gt UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (AdvVP (UseV fall_V) here_Adv)) | l -treebank +gt UttS (UseCl (TTAnt ? ASimul) ? (PredVP (UsePron he_Pron) (ComplVV want_VV (UseV fall_V)))) | l -treebank +gt UttS (UseCl (TTAnt TPres AAnter) PPos (PredVP (UsePron he_Pron) (ComplSlash (VPSlashPrep (ComplSlash (VPSlashPrep (UseV sit_V) possess_Prep) (UsePron she_Pron)) part_Prep) (DetCN (DetQuant DefArt NumPl) (UseN window_N))))) | l -treebank +gt UttS (UseCl (TTAnt TPres AAnter) PPos (PredVP (UsePron he_Pron) (ComplSlash (SlashV2a wait_V2) (MassNP (PartNP (AdvCN (UseN car_N) (PrepNP possess_Prep (UsePron she_Pron))) (DetCN (DetQuant DefArt NumPl) (UseN window_N))))))) | l -treebank +gt UttS (UseCl (TTAnt ? AAnter) ? (PredVP (UsePron he_Pron) (ComplSlash (VPSlashPrep (ComplSlash (VPSlashPrep (ComplSlash (SlashV2a count_V2) (DetCN (DetQuant IndefArt NumPl) (UseN car_N))) possess_Prep) (DetNP (DetQuant (PossPron she_Pron) NumPl))) part_Prep) (DetCN (DetQuant IndefArt NumPl) (UseN window_N))))) | l -treebank + +gt UttS (UseCl (TTAnt TCond AAnter) PNeg (PredVP (MassNP (UseN worm_N)) (ComplSlash (VPSlashPrep (UseV sit_V) in_Prep) (MassNP (PossNP (AdjCN (PositA red_A) (UseN apple_N)) (DetNP (DetQuant (PossPron he_Pron) NumSg))))))) + +gt UttS (UseCl (TTAnt TCond AAnter) PNeg (PredVP (MassNP (UseN worm_N)) (ComplSlash (VPSlashPrep (UseV sit_V) in_Prep) (MassNP (PossNP (AdjCN (CAdvAP less_CAdv (PositA full_A) (MassNP (UseN2 brother_N2))) (UseN apple_N)) (DetNP (DetQuant (PossPron he_Pron) NumSg))))))) + +gt TFullStop (PhrUtt NoPConj (UttImpSg ? (ImpVP (ComplSlash (SlashV2a do_V2) (MassNP (UseN apple_N))))) NoVoc) TEmpty |l -treebank +gt TQuestMark (PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (ImpersCl (ComplSlash (SlashV2a do_V2) (MassNP (UseN car_N))))))) NoVoc) TEmpty |l -treebank +gt TExclMark (PhrUtt NoPConj (UttImpSg ?2 (ImpVP (ComplSlash (SlashV2a do_V2) (MassNP (UseN car_N))))) (VocNP (UsePN john_PN))) TEmpty | l -treebank +gt TQuestMark (PhrUtt NoPConj (UttIP (IdetCN how8many_IDet (UseN apple_N))) NoVoc) TEmpty | l -treebank +gt TQuestMark (PhrUtt NoPConj (UttIP (IdetCN how8many_IDet (AdvCN (UseN apple_N) (PrepNP possess_Prep (UsePN john_PN))))) NoVoc) TEmpty | l -treebank +gt TQuestMark (PhrUtt NoPConj (UttQS (UseQCl (TTAnt TFut AAnter) PPos (QuestIAdv how8much_IAdv (ImpersCl (AdvVP UseCopula (PrepNP part_Prep (DetCN (DetQuant IndefArt NumPl) (UseN apple_N)))))))) NoVoc) TEmpty |l -treebank +gt TQuestMark (PhrUtt NoPConj (UttQS (UseQCl (TTAnt ? AAnter) ? (QuestIAdv how8much_IAdv (ImpersCl (AdvVP (AdvVP UseCopula (PrepNP part_Prep (DetCN (DetQuant IndefArt NumPl) (UseN apple_N)))) (PrepNP possess_Prep (UsePN john_PN))))))) NoVoc) TEmpty | l -treebank +gt TQuestMark (PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestVP whatSg_IP (AdvVP (UseV fly_V) here_Adv)))) NoVoc) TEmpty |l -treebank +gt TQuestMark (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (SelfAdVVP (UseV fly_V))))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres AAnter) PPos (PredVP (DetCN (DetQuant DefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN apple_N)) (UseV fall_V)))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres AAnter) PPos (PredVP (DetCN (DetQuant DefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN bird_N)) (ComplSlash (SlashV2a love_V2) (UsePN john_PN))))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres AAnter) PPos (PredVP (PredetNP all_Predet (DetCN (DetQuant IndefArt NumPl) (UseN bird_N))) (ComplSlash (SlashV2a love_V2) (UsePN john_PN))))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres AAnter) PNeg (PredVP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01))))))) (UseN bird_N)) (ComplSlash (SlashV2a love_V2) (UsePN john_PN))))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (ConjS and_Conj (BaseS (UseCl (TTAnt TPres AAnter) PPos (PredVP (UsePron youSg_Pron) (UseV fall_V))) (UseCl (TTAnt TPres AAnter) PPos (GenericCl (ComplSlash (VPSlashPrep (UseV sing_V) on_Prep) (MassNP (UseN window_N)))))))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttCN (AdjCN (PositA red_A) (UseN apple_N))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres AAnter) PPos (PredVP (RelNP (MassNP (UseN apple_N)) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePN john_PN) (SlashV2a eat_V2))))) (UseComp (CompAP (PositA young_A)))))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttNP (MassNP (AdvCN (RelCN (UseN apple_N) (UseRCl (TTAnt TPast AAnter) PPos (RelSlash IdRP (SlashVP (UsePN john_PN) (SlashV2a eat_V2))))) here_Adv))) NoVoc) TEmpty | l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPast AAnter) PPos (PredVP (RelNP (MassNP (UseN apple_N)) (UseRCl (TTAnt TPast AAnter) PPos (RelSlash IdRP (SlashVP (UsePN john_PN) (SlashV2a eat_V2))))) (AdvVP (UseV fall_V) here_Adv)))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPast AAnter) PPos (PredVP (RelNP (MassNP (bottle_of_CN (MassNP (UseN beer_N)))) (UseRCl (TTAnt TPast AAnter) PPos (RelSlash IdRP (SlashVP (UsePN john_PN) (SlashV2a drink_V2))))) (AdvVP (UseV fall_V) here_Adv)))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron it_Pron) (ReflVP (SlashV2a teach_V2))))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) ? (PredVP (UsePron ?) (SelfAdvVP (ReflVP (SlashV2a learn_V2)))))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TFut ASimul) ? (PredVP (UsePron he_Pron) (AdvVP (PassV2 learn_V2) (weekdayPunctualAdv ?))))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TFut ASimul) ? (PredVP (UsePron he_Pron) (AdvVP (PassV2 learn_V2) (weekdayNextAdv ?))))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) ? (PredVP (UsePron he_Pron) (AdvVP (PassV2 learn_V2) (weekdayLastAdv ?))))) NoVoc) TEmpty |l -treebank +gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TFut AAnter) PPos (PredVP (UsePron ?) (AdvVP (PassV2 teach_V2) (yearAdv (intYear 2024)))))) NoVoc) TEmpty |l -treebank + +gt UseComp (CompAdv here_Adv) | l -treebank +gt PredSCVP (EmbedVP (UseV think_V)) thirsty_VP | l -treebank + + -- these below sound unnatural + +gt QuestCl ( PredSCVP (EmbedVP (UseV play_V)) thirsty_VP ) | l -treebank +gt UseQCl ? ? ( QuestCl (PredSCVP (EmbedVP (UseV play_V)) thirsty_VP) ) | l -treebank +gt UseQCl (TTAnt TCond AAnter) ? (QuestCl (PredSCVP (EmbedVP (UseV play_V)) thirsty_VP)) | l -treebank +gt UttQS ( UseQCl (TTAnt TCond AAnter) ? (QuestCl (PredSCVP (EmbedVP (UseV play_V)) thirsty_VP)) ) | l -treebank +gt ComplVQ know_VQ ( UseQCl (TTAnt TCond AAnter) ? (QuestCl (PredSCVP (EmbedVP (UseV play_V)) thirsty_VP)) ) | l -treebank + +gt EmbedVP (ComplSlash (VPSlashPrep hungry_VP possess_Prep) (UsePron we_Pron)) | l -treebank +gt SentCN (UseN apple_N) (EmbedVP (ComplSlash (VPSlashPrep hungry_VP possess_Prep) (UsePron we_Pron))) | l -treebank +gt PredSCVP (EmbedVP (ComplSlash (VPSlashPrep hungry_VP possess_Prep) (UsePron we_Pron))) ( PassV2 count_V2 ) | l -treebank +gt UseQCl ? ? ( QuestCl (PredSCVP (EmbedVP (ComplSlash (VPSlashPrep hungry_VP possess_Prep) (UsePron we_Pron))) ( PassV2 count_V2 )) ) | l -treebank + + +gt PredVP (somebody_NP) (ComplVA become_VA ( SentAP (UseA2 easy_A2V) ( EmbedVP (ComplSlash (VPSlashPrep (UseV fall_V) possess_Prep) (UsePron we_Pron)) ))) |l -treebank +gt UseCl ? ? (PredVP (somebody_NP) (ComplVA become_VA ( SentAP (UseA2 easy_A2V) ( EmbedVP (ComplSlash (VPSlashPrep (UseV fall_V) possess_Prep) (UsePron we_Pron)) ))) )|l -treebank + +gt PredSCVP (EmbedVP (UseV play_V)) (UseComp (CompAP (PositA clean_A)) ) | l -treebank +gt UseCl ? ? ( PredSCVP (EmbedVP (UseV play_V)) (UseComp (CompAP (PositA clean_A)) ) ) |l -treebank + +gt UseCl (TTAnt TPres ASimul) PPos (PredSCVP (EmbedVP (UseV play_V)) (UseComp (CompCN (AdjCN (PositA clean_A) (UseN war_N))))) | l -treebank + diff --git a/src/russian/todo.txt b/src/russian/todo.txt index eb7e745dc..a2b4a4402 100644 --- a/src/russian/todo.txt +++ b/src/russian/todo.txt @@ -1,22 +1,49 @@ -# Some problematic places +# Some problematic situations + +## Possessive pronouns over a list/conjunction of CNs + +With what should be correct approach, produces: + +> l DetCN (DetQuant (PossPron i_Pron) NumSg) (ConjCN and_Conj (ConsCN (UseN grammar_N) (BaseCN (UseN apple_N) (UseN flower_N)))) +мой грамматика , яблоко и цветок + +Correct text requires AdvNP tricks. Resulting trees are quite artificial, one example: + +> l ConjNP and_Conj (ConsNP (AdvNP (DetNP (DetQuant (PossPron i_Pron) NumPl)) (PrepNP obj_no_Prep (DetCN (DetQuant DefArt NumSg) (UseN grammar_N)))) (BaseNP (MassNP (UseN apple_N)) (MassNP (UseN flower_N)))) +мои грамматика , яблоко и цветок + +Proper resolution? It's hard to go through Dets and Quants (and will make them more complex). Probably, correct solution would be to make the same as if possessive pronoun is an adjective: + +> l MassNP (AdjCN (PositA red_A) (ConjCN and_Conj (ConsCN (UseN grammar_N) (BaseCN (UseN apple_N) (UseN flower_N))))) +красные грамматика , яблоко и цветок + +This would require some Russian-specific (though quite straightforwward) Pron -> AP addition. + +## Not clear > l UttS (AdvS (AdAdv quite_Adv (ComparAdvAdj less_CAdv narrow_A everything_NP)) (UseCl (TTAnt TPres ASimul) PNeg (ExistNP something_NP))) довольно менее узко , чем всё что &+ -то не существует -> l UseCl (TTAnt TPres AAnter) PNeg (CleftNP (PredetNP not_Predet (CountNP somePl_Det everybody_NP)) (UseRCl (TTAnt TFut AAnter) PNeg (RelVP IdRP ready_VP))) -это не некоторые из всех не , не которые будут готовыми - -> l UseCl (TTAnt TPres AAnter) PNeg (CleftNP (PredetNP only_Predet (CountNP somePl_Det everybody_NP)) (UseRCl (TTAnt TFut AAnter) PNeg (RelVP IdRP ready_VP))) -это единственные некоторые из всех не , не которые будут готовыми +## Prepositions change depending on next word > l PrepNP above_Prep (UsePron i_Pron) над мной (should be: надо мной) -- verb zv index does not support "*", it figures forms out from 3 given examples instead. Most of the time. +## Note + +Verb zv index does not support "*", it figures forms out from 3 given examples instead. Most of the time. + +## Past particle limited to short form, not always fit AllRusAbs: UttImpPol PPos (ImpVP (ComplSlash (Slash2V3 add_V3 everybody_NP) (PPartNP somebody_NP drink_V2))) AllRus: складываем &+ те всех в кого &+ -то пит -Inherent number for nouns. eg, for geonames or pluralia tantum. +gt UttS (UseCl (TTAnt ? AAnter) ? (PredVP (DetCN (DetQuant IndefArt NumSg) (UseN worm_N)) (ComplSlash (VPSlashPrep (UseV sit_V) in_Prep) (MassNP (PossNP (AdjCN (PositA red_A) (UseN apple_N)) (DetNP (DetQuant (PossPron he_Pron) NumSg))))))) |l -treebank +AllRus: червь не сиде &+ ло бы в его красном яблоке + +AllRusAbs: TQuestMark (PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres AAnter) PNeg (QuestIAdv how8much_IAdv (ImpersCl (AdvVP (AdvVP UseCopula (PrepNP part_Prep (DetCN (DetQuant IndefArt NumPl) (UseN apple_N)))) (PrepNP possess_Prep (UsePN john_PN))))))) NoVoc) TEmpty +AllRus: сколько не является яблок у Ивана ? +AllRusAbs: TQuestMark (PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres AAnter) PPos (QuestIAdv how8much_IAdv (ImpersCl (AdvVP (AdvVP UseCopula (PrepNP part_Prep (DetCN (DetQuant IndefArt NumPl) (UseN apple_N)))) (PrepNP possess_Prep (UsePN john_PN))))))) NoVoc) TEmpty +AllRus: сколько является яблок у Ивана ?