diff options
| author | janna <unknown> | 2003-11-25 16:34:42 +0000 |
|---|---|---|
| committer | janna <unknown> | 2003-11-25 16:34:42 +0000 |
| commit | 61507ef2de1577fd2224fa1675934c50d0f08121 (patch) | |
| tree | ea6296dba2dc17516738340ce3195f5b385e5a2b | |
| parent | 73103e5dd8bcfd321af9ef41d06bc6cbb7b8a37a (diff) | |
*** empty log message ***
| -rw-r--r-- | grammars/resource/russian/DatabaseRus.gf | 61 | ||||
| -rw-r--r-- | grammars/resource/russian/Morpho.gf | 1027 | ||||
| -rw-r--r-- | grammars/resource/russian/Paradigms.gf | 362 | ||||
| -rw-r--r-- | grammars/resource/russian/Predication.gf | 35 | ||||
| -rw-r--r-- | grammars/resource/russian/ResRus.gf | 230 | ||||
| -rw-r--r-- | grammars/resource/russian/RestaurantRus.gf | 30 | ||||
| -rw-r--r-- | grammars/resource/russian/Russian.gf | 3 | ||||
| -rw-r--r-- | grammars/resource/russian/Syntax.gf | 898 | ||||
| -rw-r--r-- | grammars/resource/russian/TestRus.gf | 40 | ||||
| -rw-r--r-- | grammars/resource/russian/Types.gf | 288 |
10 files changed, 2974 insertions, 0 deletions
diff --git a/grammars/resource/russian/DatabaseRus.gf b/grammars/resource/russian/DatabaseRus.gf new file mode 100644 index 000000000..289e002a1 --- /dev/null +++ b/grammars/resource/russian/DatabaseRus.gf @@ -0,0 +1,61 @@ +concrete DatabaseRus of Database = open Prelude,Syntax,English,Predication,Paradigms in {
+
+flags lexer=text ; unlexer=text ; coding=utf8 ;
+
+lincat
+ Phras = SS1 Bool ; -- long or short form
+ Subject = NP ;
+ Noun = CN ;
+ Property = AP ;
+ Comparison = AdjDeg ;
+ Relation = Adj2 ;
+ Feature = Fun ;
+ Value = NP ;
+ Name = ProperName ;
+
+lin
+ LongForm sent = ss (sent.s ! True ++ "?") ;
+ ShortForm sent = ss (sent.s ! False ++ "?") ;
+
+oper
+ mkSent : SS -> SS -> SS1 Bool = \long, short ->
+ {s = table {b => if_then_else Str b long.s short.s}} ;
+
+ mkSentPrel : Str -> SS -> SS1 Bool = \prel, matter ->
+ mkSent (ss (prel ++ matter.s)) matter ;
+
+ mkSentSame : SS -> SS1 Bool = \s ->
+ mkSent s s ;
+
+lin
+ WhichAre A B = mkSent (defaultQuestion (IntVP (NounIPMany A) (PosA B)))
+ (defaultNounPhrase (IndefManyNP (ModAdj B A))) ;
+
+ IsIt Q A = mkSentSame (defaultQuestion (QuestVP Q (PosA A))) ;
+
+ MoreThan = ComparAdjP ;
+ TheMost = SuperlNP ;
+ Relatively C _ = PositAdjP C ;
+
+ RelatedTo = ComplAdj ;
+
+ FeatureOf = appFun1 ;
+ ValueOf F V = appFun1 F (UsePN V) ;
+
+ WithProperty A B = ModAdj B A ;
+
+ Individual = UsePN ;
+
+ AllN = DetNP AllDet ;
+ MostN = DetNP MostDet ;
+ EveryN = DetNP EveryDet ;
+
+-- only these are language-dependent
+
+ Any = detNounPhrase anyPlDet ; --- in the sense "some", not "all"
+
+ IsThere A = mkSentPrel ["есть ли"] (defaultNounPhrase (IndefOneNP A)) ;
+ AreThere A = mkSentPrel ["есть ли"] (defaultNounPhrase (IndefManyNP A)) ;
+
+ WhatIs V = mkSentPrel ["какой"] (defaultNounPhrase V) ;
+};
diff --git a/grammars/resource/russian/Morpho.gf b/grammars/resource/russian/Morpho.gf new file mode 100644 index 000000000..9e48e86e6 --- /dev/null +++ b/grammars/resource/russian/Morpho.gf @@ -0,0 +1,1027 @@ +--1 A Simple Russian Resource Morphology
+--
+-- Aarne Ranta, Janna Khegai 2003
+--
+-- This resource morphology contains definitions of the lexical entries
+-- needed in the resource syntax.
+-- It moreover contains copies of the most usual inflectional patterns.
+--
+-- We use the parameter types and word classes defined for morphology.
+--
+-- Note: mkPassive operation is at the moment incorrect. Low-level ending-analysis
+-- is needed to fix the operation.
+
+resource Morpho = Types ** open (Predef=Predef), Prelude in {
+flags coding=utf8 ;
+
+--2 Personal (together with possesive) pronouns.
+oper pronYa: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "я" ;
+ PF Gen _ NonPoss => "меня" ;
+ PF Dat _ NonPoss => "мне" ;
+ PF Acc _ NonPoss => "меня" ;
+ PF Inst _ NonPoss => "мной" ;
+ PF Prepos _ NonPoss => "мне" ;
+ PF Nom _ (Poss (ASg Masc)) => "мой" ;
+ PF Gen _ (Poss (ASg Masc)) => "моего" ;
+ PF Dat _ (Poss (ASg Masc)) => "моему" ;
+ PF Acc _ (Poss (ASg Masc)) => "моего" ;
+ PF Inst _ (Poss (ASg Masc)) => "моим" ;
+ PF Prepos _ (Poss (ASg Masc)) => "моём" ;
+ PF Nom _ (Poss (ASg Fem)) => "моя" ;
+ PF Gen _ (Poss (ASg Fem)) => "моей" ;
+ PF Dat _ (Poss (ASg Fem)) => "моей" ;
+ PF Acc _ (Poss (ASg Fem)) => "мою" ;
+ PF Inst _ (Poss (ASg Fem)) => "моею" ;
+ PF Prepos _ (Poss (ASg Fem)) => "моей" ;
+ PF Nom _ (Poss (ASg Neut)) => "моё" ;
+ PF Gen _ (Poss (ASg Neut)) => "моего" ;
+ PF Dat _ (Poss (ASg Neut)) => "моему" ;
+ PF Acc _ (Poss (ASg Neut)) => "моё" ;
+ PF Inst _ (Poss (ASg Neut)) => "моим" ;
+ PF Prepos _ (Poss (ASg Neut)) => "моём" ;
+ PF Nom _ (Poss APl) => "мои" ;
+ PF Gen _ (Poss APl)=> "моих" ;
+ PF Dat _ (Poss APl) => "моим" ;
+ PF Acc _ (Poss APl) => "моих" ;
+ PF Inst _ (Poss APl) => "моими" ;
+ PF Prepos _ (Poss APl) => "моих"
+ } ;
+ g = PNoGen ;
+ n = Sg ;
+ p = P1 ;
+ pron = True
+ } ;
+
+oper pronTu: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "ты" ;
+ PF Gen _ NonPoss => "тебя" ;
+ PF Dat _ NonPoss => "тебе" ;
+ PF Acc _ NonPoss => "тебя" ;
+ PF Inst _ NonPoss => "тобой" ;
+ PF Prepos _ NonPoss => ["о тебе"] ;
+ PF Nom _ (Poss (ASg Masc)) => "твой" ;
+ PF Gen _ (Poss (ASg Masc)) => "твоего" ;
+ PF Dat _ (Poss (ASg Masc)) => "твоему" ;
+ PF Acc _ (Poss (ASg Masc)) => "твоего" ;
+ PF Inst _ (Poss (ASg Masc)) => "твоим" ;
+ PF Prepos _ (Poss (ASg Masc)) => "твоём" ;
+ PF Nom _ (Poss (ASg Fem)) => "твоя" ;
+ PF Gen _ (Poss (ASg Fem)) => "твоей" ;
+ PF Dat _ (Poss (ASg Fem)) => "твоей" ;
+ PF Acc _ (Poss (ASg Fem)) => "твою" ;
+ PF Inst _ (Poss (ASg Fem)) => "твоею" ;
+ PF Prepos _ (Poss (ASg Fem)) => "твоей" ;
+ PF Nom _ (Poss (ASg Neut)) => "твоё" ;
+ PF Gen _ (Poss (ASg Neut)) => "твоего" ;
+ PF Dat _ (Poss (ASg Neut)) => "твоему" ;
+ PF Acc _ (Poss (ASg Neut)) => "твоё" ;
+ PF Inst _ (Poss (ASg Neut)) => "твоим" ;
+ PF Prepos _ (Poss (ASg Neut)) => "твоём" ;
+ PF Nom _ (Poss APl) => "твои" ;
+ PF Gen _ (Poss APl)=> "твоих" ;
+ PF Dat _ (Poss APl) => "твоим" ;
+ PF Acc _ (Poss APl) => "твоих" ;
+ PF Inst _ (Poss APl) => "твоими" ;
+ PF Prepos _ (Poss APl) => "твоих"
+ } ;
+ g = PNoGen ;
+ n = Sg ;
+ p = P2 ;
+ pron = True
+ } ;
+
+oper pronOn: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "он" ;
+ PF Gen No NonPoss => "его" ;
+ PF Gen Yes NonPoss => "него" ;
+ PF Dat No NonPoss => "ему" ;
+ PF Dat Yes NonPoss => "нему" ;
+ PF Acc No NonPoss => "его" ;
+ PF Acc Yes NonPoss => "него" ;
+ PF Inst No NonPoss => "им" ;
+ PF Inst Yes NonPoss => "ним" ;
+ PF Prepos _ NonPoss => ["о нем"] ;
+ PF _ _ (Poss _) => "его"
+ } ;
+ g = PGen Masc ;
+ n = Sg ;
+ p = P3 ;
+ pron = True
+ } ;
+
+oper pronOna: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "она" ;
+ PF Gen No NonPoss => "её" ;
+ PF Gen Yes NonPoss => "неё" ;
+ PF Dat No NonPoss => "ей" ;
+ PF Dat Yes NonPoss => "ней" ;
+ PF Acc No NonPoss => "её" ;
+ PF Acc Yes NonPoss => "неё" ;
+ PF Inst No NonPoss => "ей" ;
+ PF Inst Yes NonPoss => "ней" ;
+ PF Prepos _ NonPoss => ["о ней"] ;
+ PF _ _ (Poss _ ) => "её"
+
+ } ;
+ g = PGen Fem ;
+ n = Sg ;
+ p = P3 ;
+ pron = True
+ } ;
+
+oper pronMu: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "мы" ;
+ PF Gen _ NonPoss => "нас" ;
+ PF Dat _ NonPoss => "нам" ;
+ PF Acc _ NonPoss => "нас" ;
+ PF Inst _ NonPoss => "нами" ;
+ PF Prepos _ NonPoss => ["о нас"] ;
+ PF Nom _ ((Poss (ASg Masc))) => "наш" ;
+ PF Gen _ (Poss (ASg Masc)) => "нашего" ;
+ PF Dat _ ((Poss (ASg Masc))) => "нашему" ;
+ PF Acc _ ((Poss (ASg Masc))) => "нашего" ;
+ PF Inst _ (Poss (ASg Masc)) => "нашим" ;
+ PF Prepos _ (Poss (ASg Masc)) => "нашем" ;
+ PF Nom _ (Poss (ASg Fem)) => "наша" ;
+ PF Gen _ (Poss (ASg Fem)) => "нашей" ;
+ PF Dat _ (Poss (ASg Fem)) => "нашей" ;
+ PF Acc _ (Poss (ASg Fem)) => "нашу" ;
+ PF Inst _ (Poss (ASg Fem)) => "нашею" ;
+ PF Prepos _ (Poss (ASg Fem)) => "нашей" ;
+ PF Nom _ (Poss (ASg Neut)) => "наше" ;
+ PF Gen _ (Poss (ASg Neut)) => "нашего" ;
+ PF Dat _ (Poss (ASg Neut)) => "нашему" ;
+ PF Acc _ (Poss (ASg Neut)) => "наше" ;
+ PF Inst _ (Poss (ASg Neut)) => "нашим" ;
+ PF Prepos _ (Poss (ASg Neut)) => "нашем" ;
+ PF Nom _ (Poss APl) => "наши" ;
+ PF Gen _ (Poss APl)=> "наших" ;
+ PF Dat _ (Poss APl) => "нашим" ;
+ PF Acc _ (Poss APl) => "наших" ;
+ PF Inst _ (Poss APl) => "нашими" ;
+ PF Prepos _ (Poss APl) => "наших"
+ };
+ g = PNoGen ;
+ n = Pl ;
+ p = P1 ;
+ pron = True
+ } ;
+
+oper pronVu: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "вы" ;
+ PF Gen _ NonPoss => "вас" ;
+ PF Dat _ NonPoss => "вам" ;
+ PF Acc _ NonPoss => "вас" ;
+ PF Inst _ NonPoss => "вами" ;
+ PF Prepos _ NonPoss => "вас" ;
+ PF Nom _ (Poss (ASg Masc)) => "ваш" ;
+ PF Gen _ (Poss (ASg Masc)) => "вашего" ;
+ PF Dat _ (Poss (ASg Masc)) => "вашему" ;
+ PF Acc _ (Poss (ASg Masc)) => "вашего" ;
+ PF Inst _ (Poss (ASg Masc)) => "вашим" ;
+ PF Prepos _ (Poss (ASg Masc)) => "вашем" ;
+ PF Nom _ (Poss (ASg Fem)) => "ваша" ;
+ PF Gen _ (Poss (ASg Fem)) => "вашей" ;
+ PF Dat _ (Poss (ASg Fem)) => "вашей" ;
+ PF Acc _ (Poss (ASg Fem)) => "вашу" ;
+ PF Inst _ (Poss (ASg Fem)) => "вашею" ;
+ PF Prepos _ (Poss (ASg Fem)) => "вашей" ;
+ PF Nom _ (Poss (ASg Neut)) => "ваше" ;
+ PF Gen _ (Poss (ASg Neut)) => "вашего" ;
+ PF Dat _ (Poss (ASg Neut)) => "вашему" ;
+ PF Acc _ (Poss (ASg Neut)) => "ваше" ;
+ PF Inst _ (Poss (ASg Neut)) => "вашим" ;
+ PF Prepos _ (Poss (ASg Neut)) => "вашем" ;
+ PF Nom _ (Poss APl) => "ваши" ;
+ PF Gen _ (Poss APl)=> "ваших" ;
+ PF Dat _ (Poss APl) => "вашим" ;
+ PF Acc _ (Poss APl) => "ваших" ;
+ PF Inst _ (Poss APl) => "вашими" ;
+ PF Prepos _ (Poss APl) => "ваших"
+ };
+ g = PNoGen ;
+ n = Pl ;
+ p = P2 ;
+ pron = True
+ } ;
+
+oper pronOni: Pronoun =
+ { s = table {
+ PF Nom _ NonPoss => "они" ;
+ PF Gen No NonPoss => "их" ;
+ PF Gen Yes NonPoss => "них" ;
+ PF Dat No NonPoss => "им" ;
+ PF Dat Yes NonPoss => "ним" ;
+ PF Acc No NonPoss => "их" ;
+ PF Acc Yes NonPoss => "них" ;
+ PF Inst No NonPoss => "ими" ;
+ PF Inst Yes NonPoss => "ними" ;
+ PF Prepos _ NonPoss => ["о них"] ;
+ PF _ _ (Poss _) => "их"
+ } ;
+ g = PNoGen ;
+ n = Pl ;
+ p = P3 ;
+ pron = True
+ } ;
+
+--2 Nouns
+
+-- Help type SubstFormDecl is introduced to reduce repetition in
+-- the declination definitions. It allows us to define a declination type,
+-- namely, the String component "s" of the CommNoun type
+-- without any reference to the Gender parameter "g".
+
+oper SubstFormDecl = SS1 SubstForm ;
+
+oper muzhchina : CommNoun = (aEndAnimateDecl "мужчин") ** { g = Masc ; anim = Animate } ;
+oper zhenchina : CommNoun = (aEndAnimateDecl "женщин") ** { g = Fem ; anim = Animate } ;
+oper mama : CommNoun = (aEndAnimateDecl "мам")**{ g = Fem ; anim = Animate } ;
+oper cena : CommNoun = (aEndAnimateDecl "цен") ** { g = Fem ; anim = Inanimate } ;
+
+oper aEndAnimateDecl: Str -> SubstFormDecl = \muzhchin ->
+{s = table {
+ SF Sg Nom => muzhchin+"а" ;
+ SF Sg Gen => muzhchin+"ы" ;
+ SF Sg Dat => muzhchin+"е" ;
+ SF Sg Acc => muzhchin+"у" ;
+ SF Sg Inst => muzhchin+"ой" ;
+ SF Sg Prepos => muzhchin +"е" ;
+ SF Pl Nom => muzhchin +"ы" ;
+
SF Pl Gen => muzhchin ;
+ SF Pl Dat => muzhchin+"ам" ;
+ SF Pl Acc => muzhchin ;
+ SF Pl Inst => muzhchin+"ами" ;
+ SF Pl Prepos => muzhchin+"ах" }
+ } ;
+
+oper stomatolog : CommNoun = nullEndAnimateDecl "стоматолог" ;
+oper nullEndAnimateDecl: Str -> CommNoun = \stomatolog ->
+ {s = table
+ { SF Sg Nom => stomatolog ;
+ SF Sg Gen => stomatolog+"а" ;
+ SF Sg Dat => stomatolog+"у" ;
+ SF Sg Acc => stomatolog +"а" ;
+ SF Sg Inst => stomatolog+"ом" ;
+ SF Sg Prepos => stomatolog+"е" ;
+ SF Pl Nom => stomatolog+"и" ;
+ SF Pl Gen => stomatolog+"ов" ;
+ SF Pl Dat => stomatolog+"ам" ;
+ SF Pl Acc => stomatolog+"ов" ;
+ SF Pl Inst => stomatolog+"ами" ;
+ SF Pl Prepos => stomatolog+"ах" } ;
+ g = Masc ; anim = Animate
+ } ;
+
+oper gripp : CommNoun = nullEndInAnimateDecl1 "грипп" ;
+oper bar : CommNoun = nullEndInAnimateDecl1 "бар" ;
+oper telefon: CommNoun = nullEndInAnimateDecl1 "телефон" ;
+oper restoran : CommNoun = nullEndInAnimateDecl1 "ресторан" ;
+
+-- Note: Plural form of the "грипп" (influenza) is a bit doubious
+-- However, according to http://starling.rinet.ru/morph.htm it exists.
+-- so we also keep it.
+oper nullEndInAnimateDecl1: Str -> CommNoun = \gripp ->
+ {s = table
+ { SF Sg Nom => gripp ;
+ SF Sg Gen => gripp+"а" ;
+ SF Sg Dat => gripp+"у" ;
+ SF Sg Acc => gripp ;
+ SF Sg Inst => gripp+"ом" ;
+ SF Sg Prepos => gripp+"е" ;
+ SF Pl Nom => gripp+"ы" ;
+ SF Pl Gen => gripp+"ов" ;
+ SF Pl Dat => gripp+"ам" ;
+ SF Pl Acc => gripp +"ы";
+ SF Pl Inst => gripp+"ами" ;
+ SF Pl Prepos => gripp+"ах"
+ } ;
+ g = Masc ; anim = Inanimate
+
+ } ;
+
+oper adres: CommNoun = nullEndInAnimateDecl2 "адрес" ;
+oper dom : CommNoun = nullEndInAnimateDecl2 "дом" ;
+oper svet : CommNoun = nullEndInAnimateDecl2 "свет" ;
+oper nullEndInAnimateDecl2: Str -> CommNoun = \gripp ->
+ {s = table
+ { SF Sg Nom => gripp ;
+ SF Sg Gen => gripp+"а" ;
+ SF Sg Dat => gripp+"у" ;
+ SF Sg Acc => gripp ;
+ SF Sg Inst => gripp+"ом" ;
+ SF Sg Prepos => gripp+"е" ;
+ SF Pl Nom => gripp+"а" ;
+ SF Pl Gen => gripp+"ов" ;
+ SF Pl Dat => gripp+"ам" ;
+ SF Pl Acc => gripp +"а";
+ SF Pl Inst => gripp+"ами" ;
+ SF Pl Prepos => gripp+"ах"
+ } ;
+ g = Masc ; anim = Inanimate
+ } ;
+
+oper obezbolivauchee : CommNoun = eeEndInAnimateDecl "обезболивающ" ;
+oper eeEndInAnimateDecl: Str -> CommNoun = \obezbolivauch ->
+ { s = table
+ { SF Sg Nom => obezbolivauch +"ее";
+ SF Sg Gen => obezbolivauch+"его" ;
+ SF Sg Dat => obezbolivauch+"ему" ;
+ SF Sg Acc => obezbolivauch +"ее";
+ SF Sg Inst => obezbolivauch+"им" ;
+ SF Sg Prepos => obezbolivauch+"ем" ;
+ SF Pl Nom => obezbolivauch+"ие" ;
+ SF Pl Gen => obezbolivauch+"их" ;
+ SF Pl Dat => obezbolivauch+"им" ;
+ SF Pl Acc => obezbolivauch+"ие" ;
+ SF Pl Inst => obezbolivauch+"ими" ;
+ SF Pl Prepos => obezbolivauch+"их"
+ } ;
+ g = Neut ; anim = Inanimate
+ } ;
+
+oper proizvedenie : CommNoun = eEndInAnimateDecl "произведени" ;
+oper eEndInAnimateDecl: Str -> CommNoun = \proizvedeni ->
+ { s = table
+ { SF Sg Nom => proizvedeni +"е";
+ SF Sg Gen => proizvedeni+"я" ;
+ SF Sg Dat => proizvedeni+"ю" ;
+ SF Sg Acc => proizvedeni +"е";
+ SF Sg Inst => proizvedeni+"ем" ;
+ SF Sg Prepos => proizvedeni+"и" ;
+ SF Pl Nom => proizvedeni+"я" ;
+ SF Pl Gen => proizvedeni+"й" ;
+ SF Pl Dat => proizvedeni+"ям" ;
+ SF Pl Acc => proizvedeni+"я" ;
+ SF Pl Inst => proizvedeni+"ями" ;
+ SF Pl Prepos => proizvedeni+"ях"
+ } ;
+ g = Neut ; anim = Inanimate
+ } ;
+oper chislo : CommNoun = oEndInAnimateDecl "числ" ;
+oper oEndInAnimateDecl: Str -> CommNoun = \chisl ->
+ let { chis = Predef.tk 1 chisl ; ending = Predef.dp 3 chisl } in
+ oEndInAnimateDecl3 chisl (chis+"e"+ending) ;
+oper oEndInAnimateDecl3: Str -> Str -> CommNoun = \chisl, chisel ->
+ { s = table
+ { SF Sg Nom => chisl +"о";
+ SF Sg Gen => chisl+"а" ;
+ SF Sg Dat => chisl+"у" ;
+ SF Sg Acc => chisl +"о";
+ SF Sg Inst => chisl+"ом" ;
+ SF Sg Prepos => chisl+"е" ;
+ SF Pl Nom => chisl+"а" ;
+ SF Pl Gen => chisel;
+ SF Pl Dat => chisl+"ам" ;
+ SF Pl Acc => chisl+"а" ;
+ SF Pl Inst => chisl+"ами" ;
+ SF Pl Prepos => chisl+"ах"
+ } ;
+ g = Neut ; anim = Inanimate
+ } ;
+
+oper malaria : CommNoun = i_yaEndDecl "маляри" ;
+oper i_yaEndDecl: Str -> CommNoun = \malar ->
+ { s = table
+ { SF Sg Nom => malar+"я" ;
+ SF Sg Gen => malar+"и" ;
+ SF Sg Dat => malar+"и" ;
+ SF Sg Acc => malar+"ю" ;
+ SF Sg Inst => malar+"ей" ;
+ SF Sg Prepos => malar+"и" ;
+ SF Pl Nom => malar+"и" ;
+ SF Pl Gen => malar+"й" ;
+ SF Pl Dat => malar+"ям" ;
+ SF Pl Acc => malar+"и" ;
+ SF Pl Inst => malar+"ями" ;
+ SF Pl Prepos => malar+"ях"
+ } ;
+ g = Fem ; anim = Inanimate
+ } ;
+
+oper bol : CommNoun = softSignEndDeclFem "бол" ;
+oper nol : CommNoun = softSignEndDeclMasc "нол" ;
+oper uroven : CommNoun = EN_softSignEndDeclMasc "уровен" ;
+oper softSignEndDeclFem: Str -> CommNoun = \bol ->
+ {s = table
+ { SF Sg Nom => bol+"ь" ;
+ SF Sg Gen => bol+"и" ;
+ SF Sg Dat => bol+"и" ;
+ SF Sg Acc => bol+"ь" ;
+
+ SF Sg Inst => bol+"ью" ;
+ SF Sg Prepos => bol+"и" ;
+ SF Pl Nom => bol+"и" ;
+ SF Pl Gen => bol+"ей" ;
+ SF Pl Dat => bol+"ям" ;
+ SF Pl Acc => bol+"и" ;
+ SF Pl Inst => bol+"ями" ;
+
SF Pl Prepos => bol+"ях"
+ } ;
+ g = Fem ; anim = Inanimate
+ } ;
+oper softSignEndDeclMasc: Str -> CommNoun = \nol ->
+ {s = table
+ { SF Sg Nom => nol+"ь" ;
+ SF Sg Gen => nol+"я" ;
+ SF Sg Dat => nol+"ю" ;
+ SF Sg Acc => nol+"ь" ;
+ SF Sg Inst => nol+"ем" ;
+ SF Sg Prepos => nol+"е" ;
+ SF Pl Nom => nol+"и" ;
+ SF Pl Gen => nol+"ей" ;
+ SF Pl Dat => nol+"ям" ;
+ SF Pl Acc => nol+"и" ;
+ SF Pl Inst => nol+"ями" ;
+ SF Pl Prepos => nol+"ях"
+ } ;
+ g = Masc ; anim = Inanimate
+ } ;
+
+oper EN_softSignEndDeclMasc: Str -> CommNoun = \rem ->
+ {s = table
+ { SF Sg Nom => rem+"ень" ;
+ SF Sg Gen => rem+"ня" ;
+ SF Sg Dat => rem+"ню" ;
+ SF Sg Acc => rem+"ень" ;
+ SF Sg Inst => rem+"нем" ;
+ SF Sg Prepos => rem+"не" ;
+ SF Pl Nom => rem+"ни" ;
+ SF Pl Gen => rem+"ней" ;
+ SF Pl Dat => rem+"ням" ;
+ SF Pl Acc => rem+"ни" ;
+ SF Pl Inst => rem+"нями" ;
+ SF Pl Prepos => rem+"нях"
+ } ;
+ g = Masc ; anim = Inanimate
+ } ;
+
+oper noga : CommNoun = aEndG_K_KH_Decl "ног" ;
+oper dvojka : CommNoun = aEndG_K_KH_Decl "двойк" ;
+oper aEndG_K_KH_Decl: Str -> CommNoun = \nog ->
+{ s = table {
+ SF Sg Nom => nog+"а" ;
+ SF Sg Gen => nog+"и" ;
+ SF Sg Dat => nog+"е" ;
+ SF Sg Acc => nog+"у" ;
+ SF Sg Inst => nog+"ой" ;
+ SF Sg Prepos => nog+"е" ;
+ SF Pl Nom => nog+"и" ;
+ SF Pl Gen => nog ;
+ SF Pl Dat => nog+"ам" ;
+ SF Pl Acc => nog+ "и" ;
+ SF Pl Inst => nog+"ами" ;
+ SF Pl Prepos => nog+"ах"
+ } ;
+ g = Fem ; anim = Inanimate
+} ;
+
+oper golova : CommNoun = aEndInanimateDecl "голов" ;
+oper mashina : CommNoun = aEndInanimateDecl "машин" ;
+oper temperatura : CommNoun = aEndInanimateDecl "температур" ;
+oper edinica : CommNoun = ej_aEndInanimateDecl "единиц" ;
+
+oper aEndInanimateDecl: Str -> CommNoun = \golov ->
+ { s = table
+ { SF Sg Nom => golov+"а" ;
+ SF Sg Gen => golov+"ы" ;
+ SF Sg Dat => golov+"е" ;
+ SF Sg Acc => golov+"у" ;
+ SF Sg Inst => golov+"ой" ;
+ SF Sg Prepos => golov+"е" ;
+ SF Pl Nom => golov+"ы" ;
+ SF Pl Gen => golov ;
+ SF Pl Dat => golov+"ам" ;
+ SF Pl Acc => golov+ "ы" ;
+ SF Pl Inst => golov+"ами" ;
+ SF Pl Prepos => golov+"ах"
+ } ;
+ g = Fem ; anim = Inanimate
+ } ;
+oper ej_aEndInanimateDecl: Str -> CommNoun = \ediniz ->
+ { s = table
+ { SF Sg Nom => ediniz+"а" ;
+ SF Sg Gen => ediniz+"ы" ;
+ SF Sg Dat => ediniz+"е" ;
+ SF Sg Acc => ediniz+"у" ;
+ SF Sg Inst => ediniz+"ей" ;
+ SF Sg Prepos => ediniz+"е" ;
+ SF Pl Nom => ediniz+"ы" ;
+ SF Pl Gen => ediniz ;
+ SF Pl Dat => ediniz+"ам" ;
+ SF Pl Acc => ediniz+ "ы" ;
+ SF Pl Inst => ediniz+"ами" ;
+ SF Pl Prepos => ediniz+"ах"
+ } ;
+ g = Fem ; anim = Inanimate
+ } ;
+
+
+oper dyadya : CommNoun = (yaEndAnimateDecl "дяд") ** {g = Masc; anim = Animate} ;
+oper yaEndAnimateDecl: Str -> SubstFormDecl = \nyan ->
+{s = table {
+ SF Sg Nom => nyan + "я" ;
+ SF Sg Gen => nyan + "и" ;
+ SF Sg Dat => nyan + "е" ;
+ SF Sg Acc => nyan + "ю" ;
+ SF Sg Inst => nyan + "ей" ;
+ SF Sg Prepos => nyan + "е" ;
+ SF Pl Nom => nyan + "и" ;
+ SF Pl Gen => nyan + "ей" ;
+ SF Pl Inst => nyan + "ями" ;
+ SF Pl Prepos => nyan + "ях" ;
+ SF Pl Dat => nyan + "ям" ;
+ SF Pl Acc => nyan + "ей"
+ }
+ } ;
+
+oper oEnd_Decl: Str -> CommNoun = \bolshinstv ->
+{ s = table {
+ SF Sg Nom => bolshinstv+"о" ;
+ SF Sg Gen => bolshinstv+"а" ;
+ SF Sg Dat => bolshinstv+"у" ;
+ SF Sg Acc => bolshinstv+"о" ;
+ SF Sg Inst => bolshinstv+"ом" ;
+ SF Sg Prepos => bolshinstv+"е" ;
+ SF Pl Nom => bolshinstv+"а" ;
+ SF Pl Gen => bolshinstv ;
+ SF Pl Dat => bolshinstv+"ам" ;
+ SF Pl Acc => bolshinstv+ "а" ;
+ SF Pl Inst => bolshinstv+"ами" ;
+ SF Pl Prepos => bolshinstv+"ах"
+ } ;
+ g = Neut ; anim = Inanimate
+} ;
+
+oper oEnd_SgDecl: Str -> CommNoun = \bolshinstv ->
+{ s = table {
+ SF _ Nom => bolshinstv+"о" ;
+ SF _ Gen => bolshinstv+"а" ;
+ SF _ Dat => bolshinstv+"у" ;
+ SF _ Acc => bolshinstv+"о" ;
+ SF _ Inst => bolshinstv+"ом" ;
+ SF _ Prepos => bolshinstv+"е"
+ } ;
+ g = Neut ; anim = Inanimate
+} ;
+
+-- Note: Now we consider only the plural form of the pronoun "все" (all)
+-- treated as an adjective (see AllDetPl definition).
+-- The meaning "entire" is not considered, which allows us to form
+-- the pronoun-adjective from the substantive form below:
+
+oper eEnd_Decl: Str -> CommNoun = \vs ->
+{ s = table {
+ SF Sg Nom => vs+"е" ;
+ SF Sg Gen => vs+"ех" ;
+ SF Sg Dat => vs+"ем" ;
+ SF Sg Acc => vs+"ех" ;
+ SF Sg Inst => vs+"еми" ;
+ SF Sg Prepos => vs+"ех" ;
+ SF Pl Nom => vs+"е" ;
+ SF Pl Gen => vs +"ех";
+ SF Pl Dat => vs+"ем" ;
+ SF Pl Acc => vs+ "ех" ;
+ SF Pl Inst => vs+"еми" ;
+ SF Pl Prepos => vs+"ех"
+ } ;
+ g = Neut ; anim = Inanimate
+} ;
+
+--2 Adjectives
+
+-- Type Adjective only has positive degree while AdjDegr type
+-- includes also comparative and superlative forms.
+-- The later entries can be converted into the former using
+-- "extAdjective" operation defined in the syntax module
+-- and vice verca using "mkAdjDeg" operation.
+
+oper
+ kazhdujDet: Adjective = uy_j_EndDecl "кажд" ;
+ samuj: Adjective = uy_j_EndDecl "сам" ;
+ lubojDet: Adjective = uy_oj_EndDecl "люб" ;
+ kotorujDet: Adjective = uy_j_EndDecl "котор";
+ takoj: Adjective = i_oj_EndDecl "так" [];
+ kakojNibudDet: Adjective = i_oj_EndDecl "как" "-нибудь";
+ kakojDet: Adjective = i_oj_EndDecl "как" [];
+ bolshinstvoDet: Adjective = extAdjFromSubst (oEnd_SgDecl "большинств");
+ vseDetPl: Adjective = extAdjFromSubst (eEnd_Decl "вс") ;
+ extAdjFromSubst: CommNoun -> Adjective = \ vse ->
+ {s = \\af => vse.s ! SF (numAF af) (caseAF af) } ;
+
+
+oper mkAdjDeg: Adjective -> Str -> AdjDegr = \adj, s ->
+ { s = table
+ {
+ Pos => adj.s ;
+ Comp => \\af => s ;
+ Super => \\af => samuj.s !af ++ adj.s ! af
+ }
+ };
+oper uzhasnuj: AdjDegr = mkAdjDeg (uy_j_EndDecl "ужасн") "ужаснее";
+oper deshevuj: AdjDegr = mkAdjDeg (uy_j_EndDecl "дешев") "дешевле";
+oper staruj: AdjDegr = mkAdjDeg (uy_j_EndDecl "стар") "старше";
+oper uy_j_EndDecl : Str -> Adjective = \s ->{s = table {
+ AF Nom _ (ASg Masc) => s+"ый";
+ AF Nom _ (ASg Fem) => s+"ая";
+ AF Nom _ (ASg Neut) => s+"ое";
+ AF Nom _ APl => s+"ые";
+ AF Acc Inanimate (ASg Masc) => s+"ый";
+ AF Acc Animate (ASg Masc) => s+"ого";
+ AF Acc _ (ASg Fem) => s+"ую";
+ AF Acc _ (ASg Neut) => s+"ое";
+ AF Acc Inanimate APl => s+"ые";
+ AF Acc Animate APl => s+"ых";
+ AF Gen _ (ASg Masc) => s+"ого";
+ AF Gen _ (ASg Fem) => s+"ой";
+ AF Gen _ (ASg Neut) => s+"ого";
+ AF Gen _ APl => s+"ых";
+ AF Inst _ (ASg Masc) => s+"ым";
+ AF Inst _ (ASg Fem) => s+"ой";
+ AF Inst _ (ASg Neut) => s+"ым";
+ AF Inst _ APl => s+"ыми";
+ AF Dat _ (ASg Masc) => s+"ому";
+ AF Dat _ (ASg Fem) => s+"ой";
+ AF Dat _ (ASg Neut) => s+"ому";
+ AF Dat _ APl => s+"ым";
+ AF Prepos _ (ASg Masc) => s+"ом";
+ AF Prepos _ (ASg Fem) => s+"ой";
+ AF Prepos _ (ASg Neut) => s+"ом";
+ AF Prepos _ APl => s+"ых"
+ }
+ } ;
+oper indijskij: Adjective = ij_EndK_G_KH_Decl "индийск" ;
+oper francuzskij: Adjective = ij_EndK_G_KH_Decl "французск" ;
+oper russkij: Adjective = ij_EndK_G_KH_Decl "русск" ;
+oper italyanskij: Adjective = ij_EndK_G_KH_Decl "итальянск" ;
+oper yaponskij: Adjective = ij_EndK_G_KH_Decl "японск" ;
+oper malenkij: AdjDegr = mkAdjDeg (ij_EndK_G_KH_Decl "маленьк") "меньше" ;
+oper vusokij: AdjDegr = mkAdjDeg (ij_EndK_G_KH_Decl "высок") "выше";
+oper ij_EndK_G_KH_Decl : Str -> Adjective = \s ->{s = table {
+ AF Nom _ (ASg Masc) => s+"ий";
+ AF Nom _ (ASg Fem) => s+"ая";
+ AF Nom _ (ASg Neut) => s+"ое";
+ AF Nom _ APl => s+"ие";
+ AF Acc Animate (ASg Masc) => s+"ого";
+ AF Acc Inanimate (ASg Masc) => s+"ий";
+ AF Acc _ (ASg Fem) => s+"ую";
+ AF Acc _ (ASg Neut) => s+"ое";
+ AF Acc Animate APl => s+"их";
+ AF Acc Inanimate APl => s+"ие";
+ AF Gen _ (ASg Masc) => s+"ого";
+ AF Gen _ (ASg Fem) => s+"ой";
+ AF Gen _ (ASg Neut) => s+"ого";
+ AF Gen _ APl => s+"их";
+ AF Inst _ (ASg Masc) => s+"им";
+ AF Inst _ (ASg Fem) => s+"ой";
+ AF Inst _ (ASg Neut) => s+"им";
+ AF Inst _ APl => s+"ими";
+ AF Dat _ (ASg Masc) => s+"ому";
+ AF Dat _ (ASg Fem) => s+"ой";
+ AF Dat _ (ASg Neut) => s+"ому";
+ AF Dat _ APl => s+"им";
+ AF Prepos _ (ASg Masc) => s+"ом";
+ AF Prepos _ (ASg Fem) => s+"ой";
+ AF Prepos _ (ASg Neut) => s+"ом";
+ AF Prepos _ APl => s+"их"
+ }
+ } ;
+
+oper bolshoj: AdjDegr = mkAdjDeg (i_oj_EndDecl "больш" []) "больше";
+oper dorogoj: AdjDegr = mkAdjDeg (i_oj_EndDecl "дорог" []) "дороже";
+oper i_oj_EndDecl : Str -> Str -> Adjective = \s, chastica ->{s = table {
+ AF Nom _ (ASg Masc) => s+"ой" + chastica ;
+ AF Nom _ (ASg Fem) => s+"ая"+ chastica ;
+ AF Nom _ (ASg Neut) => s+"ое"+ chastica ;
+ AF Nom _ APl => s+"ие"+ chastica ;
+ AF Acc Animate (ASg Masc) => s+"ого"+ chastica ;
+ AF Acc Inanimate (ASg Masc) => s+"ое"+ chastica ;
+ AF Acc _ (ASg Fem) => s+"ую"+ chastica ;
+ AF Acc _ (ASg Neut) => s+"ое"+ chastica ;
+ AF Acc Animate APl => s+"их"+ chastica ;
+ AF Acc Inanimate APl => s+"ие"+ chastica ;
+ AF Gen _ (ASg Masc) => s+"ого"+ chastica ;
+ AF Gen _ (ASg Fem) => s+"ой"+ chastica ;
+ AF Gen _ (ASg Neut) => s+"ого"+ chastica ;
+ AF Gen _ APl => s+"их"+ chastica ;
+
AF Inst _ (ASg Masc) => s+"им"+ chastica ;
+ AF Inst _ (ASg Fem) => s+"ой"+ chastica ;
+ AF Inst _ (ASg Neut) => s+"им"+ chastica ;
+ AF Inst _ APl => s+"ими"+ chastica ;
+ AF Dat _ (ASg Masc) => s+"ому"+ chastica ;
+ AF Dat _ (ASg Fem) => s+"ой"+ chastica ;
+ AF Dat _ (ASg Neut) => s+"ому"+ chastica ;
+ AF Dat _ APl => s+"им"+ chastica ;
+ AF Prepos _ (ASg Masc) => s+"ом"+ chastica ;
+ AF Prepos _ (ASg Fem) => s+"ой"+ chastica ;
+ AF Prepos _ (ASg Neut) => s+"ом"+ chastica ;
+ AF Prepos _ APl => s+"их" + chastica
+ }
+ } ;
+oper molodoj: AdjDegr = mkAdjDeg (uy_oj_EndDecl "молод") "моложе";
+oper uy_oj_EndDecl : Str -> Adjective = \s ->{s = table {
+ AF Nom _ (ASg Masc) => s+"ой";
+ AF Nom _ (ASg Fem) => s+"ая";
+ AF Nom _ (ASg Neut) => s+"ое";
+ AF Nom _ APl => s+"ые";
+ AF Acc Animate (ASg Masc) => s+"ого";
+ AF Acc Inanimate (ASg Masc) => s+"ой";
+ AF Acc _ (ASg Fem) => s+"ую";
+ AF Acc _ (ASg Neut) => s+"ое";
+ AF Acc Animate APl => s+"ых";
+ AF Acc Inanimate APl => s+"ые";
+ AF Gen _ (ASg Masc) => s+"ого";
+ AF Gen _ (ASg Fem) => s+"ой";
+ AF Gen _ (ASg Neut) => s+"ого";
+ AF Gen _ APl => s+"ых";
+ AF Inst _ (ASg Masc) => s+"ым";
+ AF Inst _ (ASg Fem) => s+"ой";
+ AF Inst _ (ASg Neut) => s+"ым";
+ AF Inst _ APl => s+"ыми";
+ AF Dat _ (ASg Masc) => s+"ому";
+ AF Dat _ (ASg Fem) => s+"ой";
+ AF Dat _ (ASg Neut) => s+"ому";
+ AF Dat _ APl => s+"ым";
+ AF Prepos _ (ASg Masc) => s+"ом";
+ AF Prepos _ (ASg Fem) => s+"ой";
+ AF Prepos _ (ASg Neut) => s+"ом";
+ AF Prepos _ APl => s+"ых"
+ }
+ } ;
+oper prostuzhen: Adjective = shortDecl1 "простужен" ;
+oper beremenen: Adjective = shortDecl "беремен" ;
+oper need: Adjective = shortDecl "нуж" ;
+oper shortDecl1 : Str -> Adjective = \s ->{s = table {
+ AF _ _ (ASg Masc) => s;
+ AF _ _ (ASg Fem) => s+"а";
+ AF _ _ (ASg Neut) => s+"о";
+ AF _ _ APl => s+"ы"
+ }
+ } ;
+oper shortDecl : Str -> Adjective = \s ->{s = table {
+ AF _ _ (ASg Masc) => s +"ен";
+ AF _ _ (ASg Fem) => s+"на";
+ AF _ _ (ASg Neut) => s+"но";
+ AF _ _ APl => s+"ны"
+ }
} ;
+
+-- 2 Adverbs
+
+oper vsegda: Adverb = { s = "всегда" } ;
+oper chorosho: Adverb = { s = "хорошо" } ;
+
+-- 2 Verbs
+
+-- Dummy verbum "have" that corresponds to the phrases like
+-- "I have a headache" in English. The corresponding sentence
+-- in Russian doesn't contain a verb:
+
+oper have: Verbum = {s=\\ vf => "-" ; asp = Imperfective} ;
+
+-- There are two common conjugations
+-- (according to the number and the person of the subject)
+-- patterns in the present tense in the indicative mood.
+
+param Conjugation = First | Second ;
+
+--3 First conjugation (in Present) verbs :
+
+oper verbGulyat : Verbum = verbDecl Imperfective First "гуля" "ю" "гулял" "гуляй" "гулять";
+oper verbVkluchat : Verbum = verbDecl Imperfective First "включа" "ю" "включал" "включай" "включать";
+oper verbVukluchat : Verbum = verbDecl Imperfective First "выключа" "ю" "выключал" "выключай" "выключать";
+oper verbZhdat : Verbum = verbDecl Imperfective First "жд" "у" "ждал" "жди" "ждать" ;
+oper verbBegat : Verbum = verbDecl Imperfective First "бега" "ю" "бегал" "бегай" "бегать";
+oper verbPrinimat : Verbum = verbDecl Imperfective First "принима" "ю" "принимал" "принимай" "принимать";
+oper verbDokazuvat : Verbum = verbDecl Imperfective First "доказыва" "ю" "доказывал" "доказывай" "доказывать";
+oper verbOtpravlyat : Verbum = verbDecl Imperfective First "отправля" "ю" "отправлял" "отправляй" "отправлять";
+oper verbSlomat : Verbum = verbDecl Perfective First "слома" "ю" "сломал" "сломай" "сломать";
+oper verbByut : Verbum = verbDecl Perfective First "буд" "у" "был" "будь" "быть";
+
+--3 Second conjugation (in Present) verbs :
+
+oper verbLubit : Verbum = verbDecl Imperfective Second "люб" "лю" "любил" "люби" "любить";
+oper verbGovorit : Verbum = verbDecl Imperfective Second "говор" "ю" "говорил" "говори" "говорить";
+
oper verbBolet_2 : Verbum = verbDecl Imperfective Second "бол" "ю" "болел" "боли" "болеть";
+oper verbPoranit : Verbum = verbDecl Perfective Second "поран" "ю" "поранил" "порань" "поранить";
+
+-- To reduces the redundancies in the definitions
+-- we introduce some intermediate types,
+-- so that the full type can be described as a combination
+-- of the intermediate types. For example "AspectVoice"
+-- is a type for defining a pattern for a particular
+-- aspect and voice.
+
+oper AspectVoice: Type = { s : VerbConj => Str ; asp: Aspect } ;
+
+-- "PresentVerb" takes care of the present tense conjugation.
+
+param PresentVF = PRF Number Person ;
+oper PresentVerb : Type = PresentVF => Str ;
+
+oper presentConj2: Str -> Str -> PresentVerb = \del, sgP1End ->
+ table {
+ PRF Sg P1 => del+ sgP1End ;
+ PRF Sg P2 => del+ "ишь" ;
+ PRF Sg P3 => del+ "ит" ;
+ PRF Pl P1 => del+ "им" ;
+ PRF Pl P2 => del+ "ите'" ;
+ PRF Pl P3 => del+ "ят"
+ };
+oper presentConj1: Str -> Str -> PresentVerb = \del, sgP1End ->
+ table {
+ PRF Sg P1 => del+ sgP1End ;
+ PRF Sg P2 => del+ "ешь" ;
+ PRF Sg P3 => del+ "ет" ;
+ PRF Pl P1 => del+ "ем" ;
+ PRF Pl P2 => del+ "ете'" ;
+ PRF Pl P3 => del+ sgP1End + "т"
+ };
+
+-- "PastVerb" takes care of the past tense conjugation.
+
+param PastVF = PSF GenNum ;
+oper PastVerb : Type = PastVF => Str ;
+oper pastConj: Str -> PastVerb = \del ->
+ table {
+ PSF (ASg Masc) => del ;
+ PSF (ASg Fem) => del +"а" ;
+ PSF (ASg Neut) => del+"о" ;
+ PSF APl => del+ "и"
+ };
+
+-- "verbDecl" sorts out verbs according to the aspect and voice parameters.
+-- It produces the full conjugation table for a verb entry
+
+oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum =
+ \a, c, del, sgP1End, sgMascPast, imperSgP2, inf -> case a of
+{ Perfective => case c of {
+ First => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
+ Second => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast)
+} ;
+ Imperfective => case c of {
+ First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
+ Second => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast)
+ }
+};
+
+-- "mkVerb" produce the passive forms from
+-- the active forms using the "mkPassive" method.
+-- Passive is expressed in Russian by so called reflexive verbs,
+-- which are formed from the active form by suffixation.
+
+
oper mkVerb : AspectVoice -> PastVerb -> Verbum = \av1, pv ->
+ { s = table {
+ VFORM Act vf => av1.s !vf;
+ VFORM Pass vf => (mkPassive av1 pv ).s ! vf
+ } ;
+ asp = av1.asp
+};
+
+ vowels : Strs = strs {
+ "а" ; "е" ; "ё" ; "и" ; "о" ; "у" ;
+ "ы" ; "э" ; "ю" ; "я"
+ } ;
+
+oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv ->
+ { s = table {
+ VINF => av.s ! VINF + "ся";
+ VIMP Sg P1 => av.s ! (VIMP Sg P1) +"сь" ;
+ VIMP Pl P1 => av.s ! (VIMP Pl P1) +"ся";
+ VIMP Sg P2 => av.s ! (VIMP Sg P2 ) +"сь";
+ VIMP Pl P2 => av.s! (VIMP Pl P2) +"сь";
+ VIMP Sg P3 => av.s ! (VIMP Sg P3) +"ся";
+ VIMP Pl P3 => av.s ! (VIMP Pl P3) +"ся";
+ VSUB (ASg Masc) => pv ! (PSF (ASg Masc)) + "ся"+[" бы"];
+ VSUB (ASg Fem) => pv ! (PSF (ASg Fem)) + "сь"+[" бы"];
+ VSUB (ASg Neut) => pv ! (PSF (ASg Neut)) + "сь"+[" бы"];
+ VSUB APl => pv ! (PSF APl) + "сь"+[" бы"] ;
+ VIND (VPresent Sg P1) =>
+ -- case av.asp of { Imperfective =>
+ av.s ! (VIND (VPresent Sg P1)) + "сь" ;
+ -- Perfective = > nonExist
+ -- } ;
+ VIND (VPresent Sg P2) => av.s ! (VIND (VPresent Sg P2))+ "ся" ;
+ VIND (VPresent Sg P3) => av.s ! (VIND (VPresent Sg P3))+ "ся" ;
+ VIND (VPresent Pl P1) => av.s !( VIND (VPresent Pl P1)) + "ся" ;
+ VIND (VPresent Pl P2) => av.s !( VIND (VPresent Pl P2)) + "сь'" ;
+ VIND (VPresent Pl P3) => av.s !( VIND (VPresent Pl P3)) + "ся" ;
+ VIND (VFuture Sg P1) => av.s ! (VIND (VFuture Sg P1)) + "сь";
+ VIND (VFuture Sg P2) => av.s! (VIND (VFuture Sg P2) )+ "ся";
+ VIND (VFuture Sg P3) => av.s! (VIND (VFuture Sg P3)) + "ся";
+ VIND (VFuture Pl P1) => av.s! (VIND (VFuture Pl P1) )+ "ся";
+ VIND (VFuture Pl P2) => av.s! (VIND (VFuture Pl P2) )+ "сь";
+ VIND (VFuture Pl P3) => av.s! (VIND (VFuture Pl P3)) + "ся";
+ VIND (VPast (ASg Masc)) => av.s ! (VIND (VPast (ASg Masc) )) + "ся";
+ VIND (VPast (ASg Fem)) => av.s ! (VIND (VPast (ASg Fem) )) + "сь";
+ VIND (VPast (ASg Neut)) => av.s ! (VIND (VPast (ASg Neut)) ) + "сь";
+ VIND (VPast APl) => av.s ! (VIND (VPast APl)) + "сь"
+ } ;
+ asp = av.asp
+};
+
+-- Generation the imperfective active pattern given
+-- a number of basic conjugation forms.
+
+oper
+ imperfectiveActivePattern : Str -> Str -> PresentVerb -> PastVerb -> AspectVoice =
+ \inf, imper, presentFuture, past -> { s= table {
+ VINF => inf ;
+ VIMP Sg P1 => ["давайте "]+ inf ;
+ VIMP Pl P1 => ["давайте "] + inf ;
+ VIMP Sg P2 => imper ;
+ VIMP Pl P2 => imper+"те" ;
+ VIMP Sg P3 => ["пускай "] + presentFuture ! (PRF Sg P3) ;
+ VIMP Pl P3 => ["пускай "] + presentFuture ! (PRF Pl P3) ;
+ VSUB (ASg Masc) => past ! (PSF (ASg Masc)) +[" бы"];
+ VSUB (ASg Fem) => past ! (PSF (ASg Fem)) +[" бы"];
+
+ VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"];
+ VSUB APl => past ! (PSF APl) +[" бы"];
+ VIND (VPresent Sg P1) => presentFuture ! ( PRF Sg P1);
+ VIND (VPresent Sg P2) => presentFuture! (PRF Sg P2) ;
+ VIND (VPresent Sg P3) => presentFuture ! (PRF Sg P3) ;
+ VIND (VPresent Pl P1) => presentFuture ! (PRF Pl P1);
+ VIND (VPresent Pl P2) => presentFuture ! (PRF Pl P2);
+ VIND (VPresent Pl P3) => presentFuture ! (PRF Pl P3);
+ VIND (VFuture Sg P1) => ["буду "] + presentFuture ! (PRF Sg P1) ;
+ VIND (VFuture Sg P2) => ["будешь"] + presentFuture ! (PRF Sg P2) ;
+ VIND (VFuture Sg P3) => ["будет "] + presentFuture ! (PRF Sg P3) ;
+ VIND (VFuture Pl P1) => ["будем "] + presentFuture ! (PRF Pl P1) ;
+ VIND (VFuture Pl P2) => ["будете "] + presentFuture ! (PRF Pl P2) ;
+ VIND (VFuture Pl P3) => ["будут "] + presentFuture ! (PRF Pl P3) ;
+
+ VIND (VPast (ASg Masc)) => past ! (PSF (ASg Masc)) ;
+ VIND (VPast (ASg Fem)) => past ! (PSF (ASg Fem) ) ;
+ VIND (VPast (ASg Neut) ) => past ! (PSF (ASg Neut)) ;
+ VIND (VPast APl) => past ! (PSF APl)
+ } ;
+ asp = Imperfective
+} ;
+
+ oper perfectiveActivePattern: Str -> Str -> PresentVerb -> PastVerb -> AspectVoice =
+ \inf, imper, presentFuture, past -> { s= table {
+ VINF => inf ;
+ VIMP Sg P1 => ["давайте "]+ presentFuture ! (PRF Sg P1);
+ VIMP Pl P1 => ["давайте "] + presentFuture ! (PRF Pl P1);
+ VIMP Sg P2 => imper ;
+ VIMP Pl P2 => imper+"те" ;
+ VIMP Sg P3 => ["пускай "] + presentFuture ! (PRF Sg P3) ;
+ VIMP Pl P3 => ["пускай "] + presentFuture ! (PRF Pl P3) ;
+ VSUB (ASg Masc) => past ! (PSF (ASg Masc)) +[" бы"];
+ VSUB (ASg Fem) => past ! (PSF (ASg Fem)) +[" бы"];
+
+ VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"];
+ VSUB APl => past ! (PSF APl) +[" бы"];
+ VIND (VPresent Sg P1) => [] ;
+ VIND (VPresent Sg P2) => [] ;
+ VIND (VPresent Sg P3) => [] ;
+ VIND (VPresent Pl P1) => nonExist ;
+ VIND (VPresent Pl P2) => nonExist ;
+ VIND (VPresent Pl P3) => [] ;
+ VIND (VFuture Sg P1) => presentFuture ! (PRF Sg P1) ;
+ VIND (VFuture Sg P2) => presentFuture ! (PRF Sg P2) ;
+ VIND (VFuture Sg P3) => presentFuture ! (PRF Sg P3) ;
+ VIND (VFuture Pl P1) => presentFuture ! (PRF Pl P1) ;
+ VIND (VFuture Pl P2) => presentFuture ! (PRF Pl P2) ;
+ VIND (VFuture Pl P3) => presentFuture ! (PRF Pl P3) ;
+ VIND (VPast (ASg Masc)) => past ! (PSF (ASg Masc)) ;
+ VIND (VPast (ASg Fem)) => past ! (PSF (ASg Fem) ) ;
+ VIND (VPast (ASg Neut) ) => past ! (PSF (ASg Neut)) ;
+ VIND (VPast APl) => past ! (PSF APl)
+ } ;
+ asp = Perfective
+} ;
+
+--2 Proper names are a simple kind of noun phrases.
+
+ ProperName : Type = {s : Case => Str ; g : Gender ; anim : Animacy} ;
+
+ mkProperNameMasc : Str -> Animacy -> ProperName = \ivan, anim ->
+ { s = table { Nom => ivan ;
+ Gen => ivan + "а";
+ Dat => ivan + "у";
+ Acc => case anim of
+ { Animate => ivan + "а";
+ Inanimate => ivan
+ };
+ Inst => ivan + "ом";
+ Prepos => ivan + "е" } ;
+ g = Masc; anim = anim };
+
+ mkProperNameFem : Str -> Animacy -> ProperName = \masha, anim ->
+ { s = table { Nom => masha + "а";
+ Gen => masha + "и";
+ Dat => masha + "е";
+ Acc => masha + "у";
+ Inst => masha + "ей";
+ Prepos => masha + "е" } ;
+ g = Fem ; anim = anim };
+ };
+
diff --git a/grammars/resource/russian/Paradigms.gf b/grammars/resource/russian/Paradigms.gf new file mode 100644 index 000000000..d574e4793 --- /dev/null +++ b/grammars/resource/russian/Paradigms.gf @@ -0,0 +1,362 @@ +--# -path=.:../abstract:../../prelude
+
+--1 Russian Lexical Paradigms
+--
+-- Aarne Ranta, Janna Khegai 2003
+--
+-- This is an API to the user of the resource grammar
+-- for adding lexical items. It give shortcuts for forming
+-- expressions of basic categories: nouns, adjectives, verbs.
+--
+-- Closed categories (determiners, pronouns, conjunctions) are
+-- accessed through the resource syntax API, $resource.Abs.gf$.
+--
+--
+-- The following files are presupposed:
+
+resource Paradigms = open (Predef=Predef), Prelude, Syntax, Russian in {
+
+flags coding=utf8 ;
+
+--2 Parameters
+--
+-- To abstract over gender names, we define the following identifiers.
+
+oper
+ masculine : Gender ;
+ feminine : Gender ;
+ neuter : Gender ;
+
+-- To abstract over case names, we define the following.
+
+ nominative : Case ;
+ genitive : Case ;
+ dative : Case ;
+ accusative : Case ;
+ instructive : Case ;
+ prepositional : Case ;
+
+-- In some (written in English) textbooks accusative case
+-- is put on the second place. However, we follow the case order
+-- standard for Russian textbooks.
+
+-- To abstract over number names, we define the following.
+
+ singular : Number ;
+ plural : Number ;
+
+--2 Nouns
+
+-- Best case: indeclinabe nouns: "кофе", "пальто", "ВУЗ".
+
+ mkIndeclinableNoun: Str -> Gender -> Animacy -> N ;
+
+-- Worst case - give six singular forms:
+-- Nominative, Genetive, Dative, Accusative, Instructive and Prepositional;
+-- corresponding six plural forms and the gender.
+-- May be the number of forms needed can be reduced,
+-- but this requires a separate investigation.
+-- Animacy parameter (determining whether the Accusative form is equal
+-- to the Nominative or the Genetive one) is actually of no help,
+-- since there are a lot of exceptions and the gain is just one form less.
+
+ mkN : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Animacy -> N ;
+
+ -- мужчина, мужчины, мужчине, мужчину, мужчиной, мужчине
+ -- мужчины, мужчин, мужчинам, мужчин, мужчинами, мужчинах
+
+
+-- Here are some common patterns. The list is far from complete.
+
+-- Feminine patterns.
+
+ nMashina : Str -> N ; -- feminine, inanimate, ending with "-а", Inst -"машин-ой"
+ nEdinica : Str -> N ; -- feminine, inanimate, ending with "-а", Inst -"единиц-ей"
+ nZhenchina : Str -> N ; -- feminine, animate, ending with "-a"
+ nNoga : Str -> N ; -- feminine, inanimate, ending with "г_к_х-a"
+ nMalyariya : Str -> N ; -- feminine, inanimate, ending with "-ия"
+ nTetya : Str -> N ; -- feminine, animate, ending with "-я"
+ nBol : Str -> N ; -- feminine, inanimate, ending with "-ь"(soft sign)
+
+-- Neuter patterns.
+
+ nObezbolivauchee : Str -> N ; -- neutral, inanimate, ending with "-ee"
+ nProizvedenie : Str -> N ; -- neutral, inanimate, ending with "-e"
+ nChislo : Str -> N ; -- neutral, inanimate, ending with "-o"
+
+-- Masculine patterns.
+
+ nStomatolog : Str -> N ; -- masculine, animate, ending with consonant
+
+ -- the next two differ only in
+ -- plural nominative (= accusative) form(s) :
+ nAdres : Str -> N ; -- адрес-а
+ nTelefon : Str -> N ; -- телефон-ы
+ -- masculine, inanimate, ending with consonant
+
+ nNol : Str -> N ; -- masculine, inanimate, ending with "-ь" (soft sign)
+ nUroven : Str -> N ; -- masculine, inanimate, ending with "-ень"
+
+-- Nouns used as functions need a preposition. The most common is with Genitive.
+
+ mkFun : N -> Preposition -> Case -> Fun ;
+ funGen : N -> Fun ;
+
+-- Proper names.
+
+ mkPN : Str -> Gender -> Animacy -> PN ; -- "Иван", "Маша"
+
+-- On the top level, it is maybe $CN$ that is used rather than $N$, and
+-- $NP$ rather than $PN$.
+
+ mkCN : N -> CN ;
+ mkNP : Str -> Gender -> Animacy -> NP ;
+
+
+--2 Adjectives
+
+-- Non-comparison (only positive degree) one-place adjectives need 28 (4 by 7)
+-- forms in the worst case:
+
+
+-- Masculine | Feminine | Neutral | Plural
+-- Nominative
+-- Genitive
+-- Dative
+-- Accusative Inanimate
+-- Accusative Animate
+-- Instructive
+-- Prepositional
+
+
+-- Notice that 4 short forms, which exist for some adjectives are not included
+-- in the current description, otherwise there would be 32 forms for
+-- positive degree.
+
+-- mkAdj1 : ( : Str) -> Adj1 ;
+
+-- Invariable adjective is a special case.
+
+ adjInvar : Str -> Adj1 ; -- khaki, mini, hindi, netto
+
+-- Some regular patterns depending on the ending.
+
+ adj1Staruyj : Str -> Adj1 ; -- ending with "-ый"
+ adj1Malenkij : Str -> Adj1 ; -- endign with "-ий"
+ adj1Molodoj : Str -> Adj1 ; -- ending with "-ой",
+ -- plural - молод-ые"
+ adj1Kakoj_Nibud : Str -> Str -> Adj1 ; -- ending with "-ой",
+ -- plural - "как-ие"
+
+-- Two-place adjectives need a preposition and a case as extra arguments.
+
+ mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- "делим на"
+
+-- Comparison adjectives need a positive adjective
+-- (28 forms without short forms).
+-- Taking only one comparative form (non-syntaxic) and
+-- only one superlative form (syntaxic) we can produce the
+-- comparison adjective with only one extra argument -
+-- non-syntaxic comparative form.
+-- Syntaxic forms are based on the positive forms.
+
+
+ mkAdjDeg : Adj1 -> Str -> AdjDeg ;
+
+-- On top level, there are adjectival phrases. The most common case is
+-- just to use a one-place adjective.
+
+ ap : Adj1 -> IsPostfixAdj -> AP ;
+
+
+--2 Verbs
+--
+-- In our lexicon description ("Verbum") there are 62 forms:
+-- 2 (Voice) by { 1 (infinitive) + [2(number) by 3 (person)](imperative) +
+-- [ [2(Number) by 3(Person)](present) + [2(Number) by 3(Person)](future) +
+-- 4(GenNum)(past) ](indicative)+ 4 (GenNum) (subjunctive) }
+-- Participles (Present and Past) and Gerund forms are not included,
+-- since they fuction more like Adjectives and Adverbs correspondingly
+-- rather than verbs. Aspect regarded as an inherent parameter of a verb.
+-- Notice, that some forms are never used for some verbs. Actually,
+-- the majority of verbs do not have many of the forms.
+
+-- The worst case need 6 forms of the present tense in indicative mood
+-- ("я бегу", "ты бежишь", "он бежит", "мы бежим", "вы бежите", "они бегут"),
+-- a past form (singular, masculine: "я бежал"), an imperative form
+-- (singular, second person: "беги"), an infinitive ("бежать").
+-- Inherent aspect should also be specified.
+
+ mkVerbum : Aspect -> (_,_,_,_,_,_,_,_,_ : Str) -> Verbum ;
+
+-- Common conjugation patterns are two conjugations:
+-- first - verbs ending with "-ать/-ять" and second - "-ить/-еть".
+-- Instead of 6 present forms of the worst case, we only need
+-- a present stem and one ending (singular, first person):
+-- "я люб-лю", "я жд-у", etc. To determine where the border
+-- between stem and ending lies it is sufficient to compare
+-- first person from with second person form:
+-- "я люб-лю", "ты люб-ишь". Stems shoud be the same.
+-- So the definition for verb "любить" looks like:
+-- mkRegVerb Imperfective Second "люб" "лю" "любил" "люби" "любить";
+
+ mkRegVerb :Aspect -> Conjugation -> (_,_,_,_,_ : Str) -> Verbum ;
+
+-- For writing an application grammar one usualy doesn't need
+-- the whole inflection table, since each verb is used in
+-- a particular context that determines some of the parameters
+-- (Tense and Voice while Aspect is fixed from the beginning) for certain usage.
+-- The "V" type, that have these parameters fixed.
+-- We can extract the "V" from the lexicon.
+
+ mkV: Verbum -> Voice -> Tense -> V ;
+ mkPresentV: Verbum -> Voice -> V ;
+
+
+-- Two-place verbs, and the special case with direct object. Notice that
+-- a particle can be included in a $V$.
+
+ mkTV : V -> Str -> Case -> TV ; -- "войти в дом"; "в", accusative
+ tvDir : V -> TV ; -- "видеть", "любить"
+
+-- The definitions should not bother the user of the API. So they are
+-- hidden from the document.
+--.
+
+
+ masculine = Masc ;
+ feminine = Fem ;
+ neuter = Neut ;
+ nominative = Nom ;
+ accusative = Acc ;
+ dative = Dat ;
+ genitive = Gen ;
+ instructive = Inst ;
+ prepositional = Prepos ;
+ singular = Sg ;
+ plural = Pl ;
+
+-- Noun definitions
+
+ mkIndeclinableNoun = \s,g, anim ->
+ {
+ s = table { SF _ _ => s } ;
+ g = g ;
+ anim = anim
+ } ;
+
+
+ mkN = \nomSg, genSg, datSg, accSg, instSg, preposSg,
+ nomPl, genPl, datPl, accPl, instPl, preposPl, g, anim ->
+ {
+ s = table {
+ SF Sg Nom => nomSg ;
+ SF Sg Gen => genSg ;
+ SF Sg Dat => datSg ;
+ SF Sg Acc => accSg ;
+ SF Sg Inst => instSg ;
+ SF Sg Prepos => preposSg ;
+ SF Pl Nom => nomPl ;
+ SF Pl Gen => genPl ;
+ SF Pl Dat => datPl ;
+ SF Pl Acc => accPl ;
+ SF Pl Inst => instPl ;
+ SF Pl Prepos => preposPl
+ } ;
+ g = g ;
+ anim = anim
+ } ;
+
+ nMashina = \s -> aEndInanimateDecl s;
+ nEdinica = \s -> ej_aEndInanimateDecl s;
+ nZhenchina = \s -> (aEndAnimateDecl s) ** { g = Fem } ;
+ nNoga = \s -> aEndG_K_KH_Decl s ;
+ nMalyariya = \s -> i_yaEndDecl s ;
+ nTetya = \s -> (yaEndAnimateDecl s) ** {g = Fem} ;
+ nBol = \s -> softSignEndDeclFem s ;
+
+-- Neuter patterns.
+
+ nObezbolivauchee = \s -> eeEndInAnimateDecl s ;
+ nProizvedenie = \s -> eEndInAnimateDecl s ;
+ nChislo = \s -> oEndInAnimateDecl s ;
+
+
+-- Masculine patterns.
+
+ nStomatolog = \s -> nullEndAnimateDecl s ;
+
+ nAdres = \s -> nullEndInAnimateDecl2 s ;
+ nTelefon = \s -> nullEndInAnimateDecl1 s ;
+
+ nNol = \s -> softSignEndDeclMasc s ;
+ nUroven = \s -> EN_softSignEndDeclMasc s ;
+
+-- mkFun defined in syntax.RusU
+-- funGen defined in syntax.RusU
+
+ mkPN = \ivan, g, anim ->
+ case g of {
+ Masc => mkProperNameMasc ivan anim ;
+ _ => mkProperNameFem ivan anim
+ } ;
+ mkCN = UseN ;
+ mkNP = \x,y,z -> UsePN (mkPN x y z) ;
+
+-- Adjective definitions
+
+ adjInvar = \s -> { s = \\af => s };
+
+ adj1Staruyj = uy_j_EndDecl ;
+ adj1Malenkij = ij_EndK_G_KH_Decl ;
+ adj1Molodoj = uy_oj_EndDecl ;
+ adj1Kakoj_Nibud = i_oj_EndDecl ;
+
+ mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c} ;
+
+ -- mkAdjDeg defined in morpho.RusU
+
+ ap = \a,p -> a ** { p = p } ;
+
+-- Verb definitions
+
+ mkVerbum = \asp, sgP1, sgP2, sgP3, plP1, plP2, plP3,
+ sgMascPast, imperSgP2, inf -> case asp of {
+ Perfective =>
+ mkVerb (perfectiveActivePattern inf imperSgP2
+ (presentConj sgP1 sgP2 sgP3 plP1 plP2 plP3) (pastConj sgMascPast))
+ (pastConj sgMascPast);
+ Imperfective =>
+ mkVerb (imperfectiveActivePattern inf imperSgP2
+ (presentConj sgP1 sgP2 sgP3 plP1 plP2 plP3) (pastConj sgMascPast))
+ (pastConj sgMascPast)
+ };
+
+ oper presentConj: (_,_,_,_,_,_: Str) -> PresentVerb =
+ \sgP1, sgP2, sgP3, plP1, plP2, plP3 ->
+ table {
+ PRF Sg P1 => sgP1 ;
+ PRF Sg P2 => sgP2 ;
+ PRF Sg P3 => sgP3 ;
+ PRF Pl P1 => plP1 ;
+ PRF Pl P2 => plP2 ;
+ PRF Pl P3 => plP3
+ };
+
+
+ mkRegVerb = verbDecl ; -- defined in morpho.RusU.gf
+
+ mkV = extVerb ; -- defined in types.RusU.gf
+
+ mkPresentV = \aller, vox ->
+ { s = table {
+ VFin gn p => aller.s ! VFORM vox (VIND (VPresent (numGNum gn) p)) ;
+ VImper n p => aller.s ! VFORM vox (VIMP n p) ;
+ VInf => aller.s ! VFORM vox VINF ;
+ VSubj gn => aller.s ! VFORM vox (VSUB gn)
+ }; t = Present ; a = aller.asp ; v = vox } ;
+
+ mkTV = mkTransVerb ; -- defined in syntax.RusU.gf
+ tvDir = mkDirectVerb; -- defined in syntax.RusU.gf
+
+} ;
diff --git a/grammars/resource/russian/Predication.gf b/grammars/resource/russian/Predication.gf new file mode 100644 index 000000000..1fab240c4 --- /dev/null +++ b/grammars/resource/russian/Predication.gf @@ -0,0 +1,35 @@ +-- predication library, built on resource grammar. AR 2002--2003
+
+-- Users of the library should *not* look into this file, but only into
+-- $predication.Types.gf$.
+
+resource Predication = open Russian in {
+
+
+oper
+ predV1 = \F, x -> PredVP x (PosV F) ;
+ predV2 = \F, x, y -> PredVP x (PosTV F y) ;
+ predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ;
+ predA1 = \F, x -> PredVP x (PosA F) ;
+ predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ;
+ predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ;
+ predAColl = \F, x, y -> PredVP (conjNP x y) (PosA F) ;
+ predN1 = \F, x -> PredVP x (PosCN (UseN F)) ;
+ predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ;
+ predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ;
+
+ appFun1 = \f, x -> DefOneNP (AppFun f x) ;
+ appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ;
+
+ appFam1 = \F, x -> AppFun F x ;
+ appFamColl = \F, x, y -> AppFun F (conjNP x y) ;
+
+ conjS = \A, B -> ConjS AndConj (TwoS A B) ;
+ disjS = \A, B -> ConjS OrConj (TwoS A B) ;
+ implS = \A, B -> SubjS IfSubj A B ;
+
+ constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ;
+
+ conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ;
+
+};
diff --git a/grammars/resource/russian/ResRus.gf b/grammars/resource/russian/ResRus.gf new file mode 100644 index 000000000..9be1fc835 --- /dev/null +++ b/grammars/resource/russian/ResRus.gf @@ -0,0 +1,230 @@ +--# -path=.:../abstract:../../prelude
+
+--1 The Top-Level Russian Resource Grammar
+--
+-- Janna Khegai 2003
+-- on the basis of code for other languages by Aarne Ranta
+--
+-- This is the Russian concrete syntax of the multilingual resource
+-- grammar. Most of the work is done in the file $syntax.RusU.gf$.
+-- However, for the purpose of documentation, we make here explicit the
+-- linearization types of each category, so that their structures and
+-- dependencies can be seen.
+-- Another substantial part is the linearization rules of some
+-- structural words.
+--
+-- The users of the resource grammar should not look at this file for the
+-- linearization rules, which are in fact hidden in the document version.
+-- They should use $resource.Abs.gf$ to access the syntactic rules.
+-- This file can be consulted in those, hopefully rare, occasions in which
+-- one has to know how the syntactic categories are
+-- implemented. The parameter types are defined in $types.RusU.gf$.
+
+concrete ResRus of ResAbs = open Prelude, Syntax in {
+flags
+ coding=utf8 ;
+ startcat=Phr ;
+ lexer=text ;
+ unlexer=text ;
+
+lincat
+
+ N = CommNoun ;
+ -- = {s : SubstForm => Str ; g : Gender ; anim : Animacy } ;
+ CN = CommNounPhrase ;
+ -- = {s : Number => Case => Str; g : Gender; anim : Animacy} ;
+ NP = NounPhrase ;
+ -- = { s : PronForm => Str ; n : Number ; p : Person ;
+ -- g: Gender ; anim : Animacy ; pron: Bool} ;
+ PN = ProperName ;
+ -- = {s : Case => Str ; g : Gender ; anim : Animacy} ;
+ Adj1 = Adjective ;
+ -- = {s : AdjForm => Str} ;
+ Det = Determiner ;
+ -- = Adjective ** { n: Number; c : Case } ;
+ Adj2 = AdjCompl ;
+ -- = Adjective ** Complement ;
+ AdjDeg = AdjDegr ;
+ -- = {s : Degree => AdjForm => Str} ;
+ AP = AdjPhrase ;
+ -- = Adjective ** {p : IsPostfixAdj} ;
+ Fun = Function ;
+ -- = CommNounPhrase ** Complement ;
+
+ V = Verb ;
+ -- = {s : VF => Str ; t: Tense ; a : Aspect ; v: Voice} ;
+ VP = VerbPhrase ;
+ -- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
+ -- negBefore: Bool} ;
+ TV = TransVerb ;
+ -- = Verb ** {s2 : Preposition ; c: Case } ;
+ VS = SentenceVerb ;
+ -- = Verb ;
+ AdV = Adverb ;
+ -- = {s : Str} ;
+
+ S = Sentence ;
+ -- = {s : Str} ;
+ Slash = SentenceSlashNounPhrase ;
+ -- = Sentence ** Complement ;
+
+ RP = RelPron ;
+ -- = {s : GenNum => Case => Animacy => Str} ;
+ RC = RelClause ;
+ -- = RelPron ;
+
+ IP = IntPron ;
+ -- = NounPhrase ;
+ Qu = Question ;
+ -- = {s : QuestForm => Str} ;
+ Imp = Imperative ;
+ -- = { s: Gender => Number => Str } ;
+ Phr = Utterance ;
+ -- = {s : Str} ;
+
+ Conj = Conjunction ;
+ -- = {s : Str ; n : Number} ;
+ ConjD = ConjunctionDistr ;
+ -- = {s1,s2 : Str ; n : Number} ;
+
+ ListS = ListSentence ;
+ -- = {s1,s2 : Mode => Str} ;
+ ListAP = ListAdjPhrase ;
+ -- = {s1,s2 : AdjForm => Str ; p : Bool} ;
+ ListNP = ListNounPhrase ;
+ -- = { s1,s2 : PronForm => Str ; g: Gender ; anim : Animacy ;
+ -- n : Number ; p : Person ; pron : Bool } ;
+
+--.
+lin
+ UsePN = nameNounPhrase ;
+ ComplAdj = complAdj ;
+ PredVP = predVerbPhrase ;
+ PosTV = complTransVerb True ;
+ NegTV = complTransVerb False ;
+ AdjP1 = adj2adjPhrase ;
+ ModAdj = modCommNounPhrase ;
+ PosA = predAdjective True ;
+ NegA = predAdjective False ;
+
+ UseN = noun2CommNounPhrase ;
+ ModGenOne = npGenDet Sg ;
+ ModGenMany = npGenDet Pl ;
+ UseFun = funAsCommNounPhrase ;
+ AppFun = appFunComm ;
+ PositAdjP = positAdjPhrase ;
+ ComparAdjP = comparAdjPhrase ;
+ SuperlNP = superlNounPhrase ;
+
+ DetNP = detNounPhrase ;
+ IndefOneNP = indefNounPhrase Sg ;
+ IndefManyNP = indefNounPhrase Pl ;
+ DefOneNP = defNounPhrase Sg ;
+ DefManyNP = defNounPhrase Pl ;
+
+ PosV = predVerb True ;
+ NegV = predVerb False ;
+ PosCN = predCommNoun True ;
+ NegCN = predCommNoun False ;
+ PosNP = predNounPhrase True ;
+ NegNP = predNounPhrase False ;
+ PosVS = complSentVerb True ;
+ NegVS = complSentVerb False ;
+
+ AdvVP = adVerbPhrase ;
+ LocNP = locativeNounPhrase ;
+ AdvCN = advCommNounPhrase ;
+
+ PosSlashTV = slashTransVerb True ;
+ NegSlashTV = slashTransVerb False ;
+
+ IdRP = identRelPron ;
+ FunRP = funRelPron ;
+ RelVP = relVerbPhrase ;
+ RelSlash = relSlash ;
+ ModRC = modRelClause ;
+ RelSuch = relSuch ;
+
+ WhoOne = intPronKto Sg ;
+ WhoMany = intPronKto Pl ;
+ WhatOne = intPronChto Sg ;
+ WhatMany = intPronChto Pl ;
+ FunIP = funIntPron ;
+ NounIPOne = nounIntPron Sg ;
+ NounIPMany = nounIntPron Pl ;
+
+ QuestVP = questVerbPhrase ;
+ IntVP = intVerbPhrase ;
+ IntSlash = intSlash ;
+ QuestAdv = questAdverbial ;
+
+ ImperVP = imperVerbPhrase ;
+
+ IndicPhrase = indicUtt ;
+ QuestPhrase = interrogUtt ;
+ ImperOne = imperUtterance Masc Sg ;
+ ImperMany = imperUtterance Masc Pl ;
+
+ TwoS = twoSentence ;
+ ConsS = consSentence ;
+ ConjS = conjunctSentence ;
+ ConjDS = conjunctDistrSentence ;
+
+ TwoAP = twoAdjPhrase ;
+ ConsAP = consAdjPhrase ;
+ ConjAP = conjunctAdjPhrase ;
+ ConjDAP = conjunctDistrAdjPhrase ;
+
+ TwoNP = twoNounPhrase ;
+ ConsNP = consNounPhrase ;
+ ConjNP = conjunctNounPhrase ;
+ ConjDNP = conjunctDistrNounPhrase ;
+
+ SubjS = subjunctSentence ;
+ SubjImper = subjunctImperative ;
+ SubjQu = subjunctQuestion ;
+
+ PhrNP = useNounPhrase ;
+ PhrOneCN = useCommonNounPhrase Sg ;
+ PhrManyCN = useCommonNounPhrase Pl ;
+ PhrIP ip = postfixSS "?" ip ;
+ PhrIAdv ia = postfixSS "?" ia ;
+
+
+ INP = pron2NounPhrase pronYa Animate;
+ ThouNP = pron2NounPhrase pronTu Animate;
+ HeNP = pron2NounPhrase pronOn Animate;
+ SheNP = pron2NounPhrase pronOna Animate;
+ WeNP = pron2NounPhrase pronMu Animate;
+ YeNP = pron2NounPhrase pronVu Animate;
+ YouNP = pron2NounPhrase pronVu Animate;
+ TheyNP = pron2NounPhrase pronOni Animate;
+
+ EveryDet = kazhdujDet ** {n = Sg ; c= Nom} ;
+ AllDet = vseDetPl ** {n = Pl; c= Nom} ;
+ WhichDet = kotorujDet ** {n = Sg; c= Nom} ; -- a singular version only
+ MostDet = bolshinstvoDet ** {n = Pl; c= Gen} ;
+
+ HowIAdv = ss "как" ;
+ WhenIAdv = ss "когда" ;
+ WhereIAdv = ss "где" ;
+ WhyIAdv = ss "почему" ;
+
+ AndConj = ss "и" ** {n = Pl} ;
+ OrConj = ss "или" ** {n = Sg} ;
+ BothAnd = sd2 "как" [", так"] ** {n = Pl} ;
+ EitherOr = sd2 "либо" [", либо"] ** {n = Sg} ;
+
+-- In case of "neither.. no" expression double negation is not
+-- only possible, but also required in Russian.
+-- There is no means of control for this however in the resource grammar.
+
+ NeitherNor = sd2 "ни" [", ни"] ** {n = Sg} ;
+
+ IfSubj = ss "если" ;
+ WhenSubj = ss "когда" ;
+
+ PhrYes = ss ["да ."] ;
+ PhrNo = ss ["нет ."] ;
+
+} ;
diff --git a/grammars/resource/russian/RestaurantRus.gf b/grammars/resource/russian/RestaurantRus.gf new file mode 100644 index 000000000..fa07e4afd --- /dev/null +++ b/grammars/resource/russian/RestaurantRus.gf @@ -0,0 +1,30 @@ +--# -path=.:../abstract:../../prelude
+
+concrete RestaurantRus of Restaurant =
+ DatabaseRus ** open Prelude,Paradigms in {
+flags coding=utf8 ;
+lin
+ Restaurant = n2n restoran;
+ Bar = n2n bar ;
+ French = AdjP1 francuzskij ;
+ Italian = AdjP1 italyanskij ;
+ Indian = AdjP1 indijskij ;
+ Japanese = AdjP1 yaponskij ;
+
+ address = funGen adres ;
+ phone = funGen telefon ;
+ priceLevel = funGen (commNounPhrase2CommNoun(appFunComm urovenFun cenu)) ;
+
+ Cheap = deshevuj;
+ Expensive = dorogoj ;
+
+ WhoRecommend rest = mkSentSame (ss2 ["кто порекомендовал"] (rest.s ! Acc)) ;
+ WhoHellRecommend rest =
+ mkSentSame (ss2 ["кто, черт возьми, порекомендовал"] (rest.s ! Acc)) ;
+
+ LucasCarton = mkProperNameMasc ["Лукас Картун"] Inanimate;
+
+oper
+ urovenFun : Function = funGen uroven ;
+ cenu : NounPhrase = mkNounPhrase Pl (n2n cena) ;
+};
diff --git a/grammars/resource/russian/Russian.gf b/grammars/resource/russian/Russian.gf new file mode 100644 index 000000000..52265b556 --- /dev/null +++ b/grammars/resource/russian/Russian.gf @@ -0,0 +1,3 @@ +--# -path=.:../abstract:../../prelude + +resource Russian = reuse ResRus ; diff --git a/grammars/resource/russian/Syntax.gf b/grammars/resource/russian/Syntax.gf new file mode 100644 index 000000000..4b43f39e3 --- /dev/null +++ b/grammars/resource/russian/Syntax.gf @@ -0,0 +1,898 @@ +--1 A Small Russian Resource Syntax
+--
+-- Aarne Ranta, Janna Khegai 2003
+--
+-- This resource grammar contains definitions needed to construct
+-- indicative, interrogative, and imperative sentences in Russian.
+--
+-- The following files are presupposed:
+resource Syntax = Morpho ** open Prelude, (CO = Coordination) in {
+flags coding=utf8 ;
+
+--2 Common Nouns
+--
+--
+--3 Common noun phrases
+--
+-- Complex common nouns ($Comm'NounPhrase$) have in principle
+-- the same parameters as simple ones.
+
+oper
+ CommNounPhrase: Type = {s : Number => Case => Str; g : Gender; anim : Animacy} ;
+
+ noun2CommNounPhrase : CommNoun -> CommNounPhrase = \sb ->
+ {s = \\n,c => sb.s ! SF n c ;
+ g = sb.g ;
+ anim = sb.anim
+ } ;
+
+ commNounPhrase2CommNoun : CommNounPhrase -> CommNoun = \sb ->
+ {s = \\sf => sb.s ! (numSF sf) ! (caseSF sf) ;
+ g = sb.g ;
+ anim = sb.anim
+ } ;
+
+ n2n = noun2CommNounPhrase;
+ n2n2 = commNounPhrase2CommNoun ;
+
+--2 Noun Phrases
+--
+
+oper
+
+ NounPhrase : Type = { s : PronForm => Str ; n : Number ;
+ p : Person ; g: Gender ; anim : Animacy ; pron: Bool} ;
+
+ -- A function specific for Russian for setting the gender for
+ -- personal pronouns in first and second person, singular :
+ setNPGender : Gender -> NounPhrase -> NounPhrase = \gen, pronI ->
+ { s = pronI.s ; g = gen ; anim = pronI.anim ;
+ n = pronI.n ; nComp = pronI.nComp ; p = pronI.p ; pron = pronI.pron } ;
+
+
+ mkNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,chelovek ->
+ {s = \\cas => chelovek.s ! n ! (extCase cas) ;
+ n = n ; g = chelovek.g ; p = P3 ; pron =False ;
+ anim = chelovek.anim
+ } ;
+ pron2NounPhrase : Pronoun -> Animacy -> NounPhrase = \ona, anim ->
+ {s = ona.s ; n = ona.n ; g = pgen2gen ona.g ;
+ pron = ona.pron; p = ona.p ; anim = anim } ;
+
+ nameNounPhrase : ProperName -> NounPhrase =
+ \masha -> {s = \\c => masha.s ! (extCase c) ;
+ p = P3; g = masha.g ; anim = masha.anim ;
+ n = Sg; nComp = Sg; pron = False} ;
+
+
+--2 Determiners
+--
+-- Determiners (only determinative pronouns in Russian) are inflected
+-- according to the gender of nouns they determine.
+-- The determined noun has the case parameter specific for the determiner:
+
+ Determiner : Type = Adjective ** { n: Number; c : Case } ;
+
+ anyPlDet = kakojNibudDet ** {n = Pl; c= Nom} ;
+
+ detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \kazhduj, okhotnik ->
+ {s = \\c => case kazhduj.c of {
+ Nom =>
+ kazhduj.s ! AF (extCase c) okhotnik.anim (gNum okhotnik.g kazhduj.n) ++
+ okhotnik.s ! kazhduj.n ! (extCase c) ;
+ _ =>
+ kazhduj.s ! AF (extCase c) okhotnik.anim (gNum okhotnik.g kazhduj.n) ++
+ okhotnik.s ! kazhduj.n ! kazhduj.c };
+ n = kazhduj.n ;
+ p = P3 ;
+ pron = False;
+ g = okhotnik.g ;
+ anim = okhotnik.anim
+ } ;
+
+ indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mashina ->
+ {s = \\c => mashina.s ! n ! (extCase c) ;
+ n = n ; p = P3 ; g = mashina.g ; anim = mashina.anim ;
+ pron = False
+ } ;
+
+ defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mashina ->
+ { s = \\c => mashina.s ! n ! (extCase c) ;
+ n = n ; p = P3 ; g = mashina.g ;anim = mashina.anim ; pron = False } ;
+
+-- Genitives of noun phrases can be used like determiners,
+-- to build noun phrases.
+-- The number argument makes the difference between "мой дом" - "мои дома".
+--
+-- The variation like in "the car of John / John's car" in English is
+-- not equally natural for proper names and pronouns and the rest of nouns.
+-- Compare "дверца машины" and "машины дверца", while
+-- "Ванина мама" and "мама Вани" or "моя мама" and "мама моя".
+-- Here we have to make a choice of a universal form, which will be
+-- "моя мама" - "Вани мама" - "машины дверца", which sounds
+-- the best for pronouns, a little worse for proper names and
+-- the worst for the rest of nouns. The reason is the fact that
+-- possession/genetive is more a human category and pronouns are
+-- used very often, so we try to suit this case in the first place.
+
+ npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase =
+ \n,masha,mashina ->
+ {s = \\c => case masha.pron of
+ { True => masha.s ! (mkPronForm Nom No (Poss (gNum mashina.g n))) ++
+ mashina.s ! n ! (extCase c) ;
+ False => masha.s ! (mkPronForm Gen No (Poss (gNum mashina.g n))) ++
+ mashina.s ! n ! (extCase c)
+ } ;
+ n = n ; p = P3 ; g = mashina.g ; anim = mashina.anim ; pron = False
+ } ;
+
+--2 Adjectives
+--3 Simple adjectives
+--
+-- A special type of adjectives just having positive forms
+-- (for semantic reasons) is useful, e.g. "русский".
+
+oper
+
+ extAdjective : AdjDegr -> Adjective = \adj ->
+ { s = \\af => adj.s ! Pos ! af } ;
+
+ -- Coercions between the compound gen-num type and gender and number:
+
+ gNum : Gender -> Number -> GenNum = \g,n ->
+ case n of {Sg => case g of
+ { Fem => ASg Fem ;
+ Masc => ASg Masc ;
+ Neut => ASg Neut
+ -- _ => variants {ASg Masc ; ASg Fem}
+ } ; Pl => APl} ;
+
+
+
+--3 Adjective phrases
+--
+-- An adjective phrase may contain a complement, e.g. "моложе Риты".
+-- Then it is used as postfix in modification, e.g. "человек, моложе Риты".
+
+ IsPostfixAdj = Bool ;
+
+ AdjPhrase : Type = Adjective ** {p : IsPostfixAdj} ;
+
+-- Simple adjectives are not postfix:
+
+ adj2adjPhrase : Adjective -> AdjPhrase = \novuj -> novuj ** {p = False} ;
+
+--3 Comparison adjectives
+--
+-- Each of the comparison forms has a characteristic use:
+--
+-- Positive forms are used alone, as adjectival phrases ("большой").
+
+ positAdjPhrase : AdjDegr -> AdjPhrase = \bolshoj ->
+ adj2adjPhrase (extAdjective bolshoj) ;
+
+-- Comparative forms are used with an object of comparison, as
+-- adjectival phrases ("больше тебя").
+
+ comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \bolshoj, tu ->
+ {s = \\af => bolshoj.s ! Comp ! af ++ tu.s ! (mkPronForm Gen Yes NonPoss) ;
+ p = True
+ } ;
+
+-- Superlative forms are used with a modified noun, picking out the
+-- maximal representative of a domain ("самый большой дом").
+
+ superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \bolshoj, dom ->
+ {s = \\pf => bolshoj.s ! Super ! AF (extCase pf) dom.anim (gNum dom.g Sg) ++
+ dom.s ! Sg ! (extCase pf) ;
+ n = Sg ;
+ p = P3 ;
+ pron = False;
+ anim = dom.anim ;
+ g = dom.g
+ } ;
+
+
+--3 Two-place adjectives
+--
+-- A two-place adjective is an adjective with a preposition used before
+-- the complement. (Rem. $Complement = {s2 : Preposition ; c : Case} $).
+
+
+ AdjCompl = Adjective ** Complement ;
+
+ complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \vlublen,tu ->
+ {s = \\af => vlublen.s ! af ++ vlublen.s2 ++
+ tu.s ! (mkPronForm vlublen.c No NonPoss) ;
+ p = True
+ } ;
+
+--3 Complements
+--
+
+ Complement = {s2 : Preposition ; c : Case} ;
+
+ complement : Str -> Complement = \cherez ->
+ {s2 = cherez ; c = Nom} ;
+
+ complementDir : Complement = complement [] ;
+
+ complementCas : Case -> Complement = \c ->
+ {s2 = [] ; c = c} ;
+
+--2 Individual-valued functions
+
+-- An individual-valued function is a common noun together with the
+-- preposition prefixed to its argument ("ключ от дома").
+-- The situation is analogous to two-place adjectives and transitive verbs.
+--
+-- We allow the genitive construction to be used as a variant of
+-- all function applications. It would definitely be too restrictive only
+-- to allow it when the required case is genitive. We don't know if there
+-- are counterexamples to the liberal choice we've made.
+
+ Function = CommNounPhrase ** Complement ;
+
+
+-- The application of a function gives, in the first place, a common noun:
+-- "ключ от дома". From this, other rules of the resource grammar
+-- give noun phrases, such as "ключи от дома", "ключи от дома
+-- и от машины", and "ключ от дома и машины" (the
+-- latter two corresponding to distributive and collective functions,
+-- respectively). Semantics will eventually tell when each
+-- of the readings is meaningful.
+
+ appFunComm : Function -> NounPhrase -> CommNounPhrase = \mama,ivan ->
+ {s = \\n, cas =>
+ mama.s ! n ! cas ++ mama.s2 ++
+ ivan.s ! (mkPronForm mama.c No (Poss (gNum mama.g n)));
+ g = mama.g ;
+ anim = mama.anim
+ } ;
+
+-- It is possible to use a function word as a common noun; the semantics is
+-- often existential or indexical.
+
+ funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ;
+
+ mkFun : CommNoun -> Preposition -> Case -> Function = \f,p,c ->
+ (n2n f) ** {s2 = p ; c = c} ;
+
+-- The following is an aggregate corresponding to the original function application
+-- producing "детство Ивана" and "Иваново детство". It does not appear in the
+-- resource abstract syntax any longer.
+-- Both versions return "детсво Ивана" although "Иваново детство"
+-- must also be included
+-- Such possesive form is only possible with proper names in Russian :
+
+ appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll,detstvo, ivan ->
+ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
+ variants {
+ defNounPhrase nf (appFunComm detstvo ivan) ; -- detstvoIvana
+ npGenDet nf ivan detstvo
+ } ;
+
+
+-- The commonest cases are functions with Genitive.
+
+ funGen : CommNoun -> Function = \urovenCen ->
+ mkFun urovenCen [] Gen ;
+
+--3 Modification of common nouns
+--
+-- The two main functions of adjective are in predication ("Иван - молод")
+-- and in modification ("молодой человек"). Predication will be defined
+-- later, in the chapter on verbs.
+
+ modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase =
+ \khoroshij,novayaMashina ->
+ {s = \\n, c =>
+ khoroshij.s ! AF c novayaMashina.anim (gNum novayaMashina.g n) ++
+ novayaMashina.s ! n ! c ;
+ g = novayaMashina.g ;
+ anim = novayaMashina.anim
+ } ;
+
+--2 Verbs
+
+--3 Transitive verbs
+--
+-- Transitive verbs are verbs with a preposition for the complement,
+-- in analogy with two-place adjectives and functions.
+-- One might prefer to use the term "2-place verb", since
+-- "transitive" traditionally means that the inherent preposition is empty
+-- and the case is accusative.
+-- Such a verb is one with a *direct object*.
+-- Note: Direct verb phrases where the Genitive case is also possible
+-- ("купить хлеба", "не читать газет") are overlooked in mkDirectVerb
+-- and can be expressed via more a general rule mkTransVerb.
+
+ TransVerb : Type = Verb ** {s2 : Preposition ; c: Case } ;
+
+ complementOfTransVerb : TransVerb -> Complement = \v -> {s2 = v.s2 ; c = v.c} ;
+ verbOfTransVerb : TransVerb -> Verb = \v ->
+ {s = v.s; t = v.t; a = v.a ; v = v.v } ;
+
+ mkTransVerb : Verb -> Preposition -> Case -> TransVerb = \v,p,cas ->
+ v ** {s2 = p ; c = cas } ;
+
+ mkDirectVerb : Verb -> TransVerb = \v ->
+ mkTransVerb v nullPrep Acc;
+
+ nullPrep : Preposition = [] ;
+
+-- The rule for using transitive verbs is the complementization rule:
+
+ complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = \b,se,tu ->
+ {s = se.s ; a = se.a ; t = se.t ; v = se.v ; s2 = negation b ;
+ s3 = \\_,_ => se.s2 ++ tu.s ! (mkPronForm se.c No NonPoss) ;
+ negBefore = True } ;
+
+--3 Verb phrases
+--
+-- Verb phrases are discontinuous: the parts of a verb phrase are
+-- (s) an inflected verb, (s2) verb adverbials (such as negation), and
+-- (s3) complement. This discontinuity is needed in sentence formation
+-- to account for word order variations.
+
+ VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
+ negBefore: Bool} ;
+
+-- A simple verb can be made into a verb phrase with an empty complement.
+-- There are two versions, depending on if we want to negate the verb.
+
+ predVerb : Bool -> Verb -> VerbPhrase = \b,vidit ->
+ vidit ** {
+ s2 = negation b ;
+ s3 = \\_,_ => [] ;
+ negBefore = True
+ } ;
+
+ negation : Bool -> Str = \b -> if_then_else Str b [] "не" ;
+
+-- Sometimes we want to extract the verb part of a verb phrase.
+
+ verbOfPhrase : VerbPhrase -> Verb = \v ->
+ {s = v.s; t = v.t ; a = v.a ; v =v.v} ;
+
+
+-- Verb phrases can also be formed from adjectives ("- молод"),
+-- common nouns ("- человек"), and noun phrases ("- самый молодой").
+-- The third rule is overgenerating: "- каждый человек" has to be ruled out
+-- on semantic grounds.
+-- Note: in some case we can even omit a dash "-" :
+-- "Я думаю, что это хорошая машина".
+
+ predAdjective : Bool -> Adjective -> VerbPhrase = \b,zloj ->
+ { s= \\_ => "-" ;
+ t = Present ;
+ a = Imperfective ;
+ v = Act ;
+ s2 = negation b ;
+ s3 = \\g,n => case n of {
+ Sg => zloj.s ! AF Nom Animate (ASg g) ;
+ Pl => zloj.s ! AF Nom Animate APl
+ } ;
+ negBefore = False
+ } ;
+
+ predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,chelovek ->
+ { s= \\_ => "-" ;
+ t = Present ;
+ a = Imperfective ;
+ v = Act ;
+ s2 = negation b ;
+ s3 = \\_,n => (indefNounPhrase n chelovek ).s ! (mkPronForm Nom No NonPoss) ;
+ negBefore = False
+ } ;
+
+ predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,masha ->
+ { s= \\_ => "-" ;
+ t = Present ;
+ a = Imperfective ;
+ v = Act ;
+ s2 = negation b ;
+ s3 = \\_,_ => masha.s ! (mkPronForm Nom No NonPoss) ;
+ negBefore = False
+ } ;
+
+ -- A function specific for Russian :
+ predNeedShortAdjective: Bool -> NounPhrase -> CommNounPhrase -> Sentence =
+ \ b, Jag, Dig -> { s =
+ let {
+ mne = Jag.s ! (mkPronForm Dat No NonPoss) ;
+ nuzhen = need.s ! AF Nom Inanimate (gNum Dig.g Sg) ;
+ doctor = Dig.s ! Sg ! Nom ;
+ ne = negation b
+ } in
+ mne ++ ne ++ nuzhen ++ doctor
+ } ;
+
+--2 Adverbials
+--
+ adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \poet, khorosho ->
+ {s = \\vf => khorosho.s ++ poet.s ! vf ; s2 = poet.s2; s3 = poet.s3;
+ a = poet.a; v = poet.v; t = poet.t ; negBefore = poet.negBefore } ;
+
+-- Adverbials are typically generated by prefixing prepositions.
+-- The rule for creating locative noun phrases by the preposition "в"
+-- is a little shaky: "в России" but "на острове".
+
+ locativeNounPhrase : NounPhrase -> Adverb = \ivan ->
+ {s = "в" ++ ivan.s ! (mkPronForm Prepos Yes NonPoss) } ;
+
+-- This is a source of the "man with a telescope" ambiguity, and may produce
+-- strange things, like "машины всегда".
+-- Semantics will have to make finer distinctions among adverbials.
+
+ advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \chelovek,uTelevizora ->
+ {s = \\n,c => chelovek.s ! n ! c ++ uTelevizora.s ;
+ g = chelovek.g ;
+ anim = chelovek.anim
+ } ;
+
+
+--2 Sentences
+--
+-- We do not introduce the word order parameter for sentences in Russian
+-- although there exist several word orders, but they are too specific
+-- to capture on the level we work here.
+
+oper
+ Sentence : Type = { s : Str } ;
+
+-- This is the traditional $S -> NP VP$ rule.
+
+ predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence =
+ \Ya, tebyaNeVizhu -> { s =
+ let
+ { ya = Ya.s ! (mkPronForm Nom No NonPoss);
+ ne = tebyaNeVizhu.s2;
+ vizhu = tebyaNeVizhu.s ! VFin (gNum Ya.g Ya.n) Ya.p;
+ tebya = tebyaNeVizhu.s3 ! Ya.g ! Ya.n
+ }
+ in
+ if_then_else Str tebyaNeVizhu.negBefore
+ (ya ++ ne ++ vizhu ++ tebya)
+ (ya ++ vizhu ++ ne ++ tebya)
+
+ } ;
+
+ -- A function specific for Russian:
+ U_predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
+ \b,Ser,Jag,Dig -> { s =
+ let {
+ menya = Jag.s ! (mkPronForm Gen Yes NonPoss) ;
+ bolit = Ser.s ! VFin (gNum Dig.g Dig.n) Dig.p ;
+ golova = Dig.s ! (mkPronForm Nom No NonPoss) ;
+ ne = negation b
+ } in
+ "у" ++ menya ++ ne ++ bolit ++ golova
+ } ;
+
+
+-- This is a macro for simultaneous predication and complementation.
+
+ predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
+ \b,vizhu,ya,tu -> predVerbPhrase ya (complTransVerb b vizhu tu) ;
+
+--3 Sentence-complement verbs
+--
+-- Sentence-complement verbs take sentences as complements.
+
+ SentenceVerb : Type = Verb ;
+
+-- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет":
+
+ complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase =
+ \b,vidit,tuUlubaeshsya ->
+ {s = vidit.s ; s2 = negation b ; s3 = \\_,_ => [", что"] ++
+ tuUlubaeshsya.s ;
+ t = vidit.t ; v = vidit.v ; a = vidit.a ; negBefore = True } ;
+
+
+--2 Sentences missing noun phrases
+--
+-- This is one instance of Gazdar's *slash categories*, corresponding to his
+-- $S/NP$.
+-- We cannot have - nor would we want to have - a productive slash-category former.
+-- Perhaps a handful more will be needed.
+--
+-- Notice that the slash category has the same relation to sentences as
+-- transitive verbs have to verbs: it's like a *sentence taking a complement*.
+
+ SentenceSlashNounPhrase = Sentence ** Complement ;
+
+ slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase =
+ \b,ivan,lubit ->
+ predVerbPhrase ivan (predVerb b (verbOfTransVerb lubit)) **
+ complementOfTransVerb lubit ;
+
+
+--2 Coordination
+--
+-- Coordination is to some extent orthogonal to the rest of syntax, and
+-- has been treated in a generic way in the module $CO$ in the file
+-- $coordination.gf$. The overall structure is independent of category,
+-- but there can be differences in parameter dependencies.
+--
+--3 Conjunctions
+--
+-- Coordinated phrases are built by using conjunctions, which are either
+-- simple ("и", "или") or distributed ("как - так", "либо - либо").
+--
+-- The conjunction has an inherent number, which is used when conjoining
+-- noun phrases: "Иван и Маша поют" vs. "Иван или Маша поет"; in the
+-- case of "или", the result is however plural if any of the disjuncts is.
+
+ Conjunction = CO.Conjunction ** {n : Number} ;
+ ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ;
+
+--2 Relative pronouns and relative clauses
+--
+
+oper
+ identRelPron : RelPron = { s = \\gn, c, anim =>
+ kotorujDet.s ! (AF c anim gn )} ;
+
+ funRelPron : Function -> RelPron -> RelPron = \mama, kotoruj ->
+ {s = \\gn,c, anim => let {nu = numGNum gn} in
+ mama.s ! nu ! c ++
+ mama.s2 ++ kotoruj.s ! gn ! mama.c ! anim
+ } ;
+
+-- Relative clauses can be formed from both verb phrases ("видит Машу") and
+-- slash expressions ("я вижу").
+
+ RelClause : Type = RelPron ;
+
+ relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \kotoruj, gulyaet ->
+ { s = \\gn, c, anim => let { nu = numGNum gn } in
+ kotoruj.s ! gn ! c ! anim ++ gulyaet.s2 ++ gulyaet.s ! VFin gn P3 ++
+ gulyaet.s3 ! genGNum gn ! nu
+ } ;
+
+ relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause =
+ \kotoruj, yaVizhu ->
+ {s = \\gn, _ , anim => yaVizhu.s2 ++ kotoruj.s ! gn ! yaVizhu.c ! anim
+ ++ yaVizhu.s
+ } ;
+
+-- A 'degenerate' relative clause is the one often used in mathematics, e.g.
+-- "число x, такое что x - четное".
+
+ relSuch : Sentence -> RelClause = \A ->
+ {s = \\gn,c, anim => takoj.s ! AF c anim gn ++ "что" ++ A.s } ;
+
+-- The main use of relative clauses is to modify common nouns.
+-- The result is a common noun, out of which noun phrases can be formed
+-- by determiners. A comma is used before the relative clause.
+
+ modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase =
+ \chelovek,kotorujSmeetsya ->
+ { s = \\n,c => chelovek.s ! n ! c ++ "," ++
+ kotorujSmeetsya.s ! gNum chelovek.g n ! Nom ! chelovek.anim;
+ g = chelovek.g ;
+ anim = chelovek.anim
+ } ;
+
+
+--2 Interrogative pronouns
+--
+-- If relative pronouns are adjective-like, interrogative pronouns are
+-- noun-phrase-like. Actually we can use the very same type!
+
+ IntPron : Type = NounPhrase ;
+
+-- In analogy with relative pronouns, we have a rule for applying a function
+-- to a relative pronoun to create a new one. We can reuse the rule applying
+-- functions to noun phrases!
+
+ funIntPron : Function -> IntPron -> IntPron =
+ appFun False ;
+
+-- There is a variety of simple interrogative pronouns:
+-- "какая машина", "кто", "что".
+
+ nounIntPron : Number -> CommNounPhrase -> IntPron = \n, x ->
+ detNounPhrase (kakojDet ** {n = n; c= Nom}) x ;
+
+ intPronKto : Number -> IntPron = \num ->
+ { s = table {
+ PF Nom _ _ => "кто" ;
+ PF Gen _ _ => "кого" ;
+ PF Dat _ _ => "кому" ;
+ PF Acc _ _ => "кого" ;
+ PF Inst _ _ => "кем" ;
+ PF Prepos _ _ => ["о ком"]
+ } ;
+ g = Masc ;
+ anim = Animate ;
+ n = num ;
+ p = P3 ;
+ pron = False
+ } ;
+
+
+
+ intPronChto : Number -> IntPron = \num ->
+ { s = table {
+ PF Nom _ _ => "что" ;
+ PF Gen _ _ => "чего" ;
+ PF Dat _ _ => "чему" ;
+ PF Acc _ _ => "что" ;
+ PF Inst _ _ => "чем" ;
+ PF Prepos _ _=> ["о чем"]
+ } ;
+ g = Neut ;
+ anim = Inanimate ;
+ n = num ;
+ p = P3 ;
+ pron = False
+ } ;
+
+
+--2 Utterances
+
+-- By utterances we mean whole phrases, such as
+-- 'can be used as moves in a language game': indicatives, questions, imperative,
+-- and one-word utterances. The rules are far from complete.
+--
+-- N.B. we have not included rules for texts, which we find we cannot say much
+-- about on this level. In semantically rich GF grammars, texts, dialogues, etc,
+-- will of course play an important role as categories not reducible to utterances.
+-- An example is proof texts, whose semantics show a dependence between premises
+-- and conclusions. Another example is intersentential anaphora.
+
+ Utterance = SS ;
+
+ indicUtt : Sentence -> Utterance = \x -> postfixSS "." (defaultSentence x) ;
+ interrogUtt : Question -> Utterance = \x -> postfixSS "?" (defaultQuestion x) ;
+
+--2 Questions
+--
+-- Questions are either direct ("Ты счастлив?")
+-- or indirect ("Потом он спросил счастлив ли ты").
+
+param
+ QuestForm = DirQ | IndirQ ;
+
+oper
+ Question = SS1 QuestForm ;
+
+--3 Yes-no questions
+--
+-- Yes-no questions are used both independently ("Ты взял мяч?")
+-- and after interrogative adverbials ("Почему ты взял мяч?").
+
+-- Note: The particle "ли" can also be used in direct questions:
+-- Видел ли ты что-нибудь подобное?
+-- but we are not considering this case.
+
+ questVerbPhrase : NounPhrase -> VerbPhrase -> Question =
+ \tu,spish ->
+ let { vu = tu.s ! (mkPronForm Nom No NonPoss);
+ spish = spish.s ! VFin (gNum tu.g tu.n) tu.p
+ ++ spish.s2 ++ spish.s3 ! tu.g ! tu.n } in
+ { s = table {
+ DirQ => vu ++ spish ;
+ IndirQ => spish ++ "ли" ++ vu
+ }
+ } ;
+
+--3 Wh-questions
+--
+-- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences,
+-- others that are like $S/NP - NP$ sentences.
+
+ intVerbPhrase : IntPron -> VerbPhrase -> Question = \kto,spit ->
+ {s = table { _ => (predVerbPhrase kto spit).s }
+ } ;
+
+ intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \Kto, yaGovoru ->
+ let { kom = Kto.s ! (mkPronForm yaGovoru.c No NonPoss) ; o = yaGovoru.s2 } in
+ {s = table { _ => o ++ kom ++ yaGovoru.s }
+ } ;
+
+--3 Interrogative adverbials
+--
+-- These adverbials will be defined in the lexicon: they include
+-- "когда", "где", "как", "почему", etc, which are all invariant one-word
+-- expressions. In addition, they can be formed by adding prepositions
+-- to interrogative pronouns, in the same way as adverbials are formed
+-- from noun phrases. N.B. we rely on record subtyping when ignoring the
+-- position component.
+
+ IntAdverb = SS ;
+
+-- A question adverbial can be applied to anything, and whether this makes
+-- sense is a semantic question.
+
+ questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question =
+ \kak, tu, pozhivaesh ->
+ {s = \\q => kak.s ++ tu.s ! (mkPronForm Nom No NonPoss) ++
+ pozhivaesh.s2 ++ pozhivaesh.s ! VFin (gNum tu.g tu.n) tu.p ++
+ pozhivaesh.s3 ! tu.g ! tu.n } ;
+
+--2 Imperatives
+--
+-- We only consider second-person imperatives.
+
+ Imperative: Type = { s: Gender => Number => Str } ;
+
+ imperVerbPhrase : VerbPhrase -> Imperative = \budGotov ->
+ {s = \\g, n => budGotov.s ! VImper n P2 ++ budGotov.s2 ++ budGotov.s3 ! g ! n} ;
+
+ imperUtterance : Gender -> Number -> Imperative -> Utterance = \g,n,I ->
+ ss (I.s ! g ! n ++ "!") ;
+
+--3 Coordinating sentences
+--
+-- We need a category of lists of sentences. It is a discontinuous
+-- category, the parts corresponding to 'init' and 'last' segments
+-- (rather than 'head' and 'tail', because we have to keep track of the slot between
+-- the last two elements of the list). A list has at least two elements.
+
+ ListSentence : Type = SD2 ;
+
+ twoSentence : (_,_ : Sentence) -> ListSentence = CO.twoSS ;
+
+ consSentence : ListSentence -> Sentence -> ListSentence =
+ CO.consSS CO.comma ;
+
+-- To coordinate a list of sentences by a simple conjunction, we place
+-- it between the last two elements; commas are put in the other slots,
+-- e.g. "ты куришь, вы пьете и я ем".
+
+ conjunctSentence : Conjunction -> ListSentence -> Sentence = \c,xs ->
+ ss (CO.conjunctX c xs) ;
+
+-- To coordinate a list of sentences by a distributed conjunction, we place
+-- the first part (e.g. "как") in front of the first element, the second
+-- part ("так и") between the last two elements, and commas in the other slots.
+-- For sentences this is really not used.
+
+ conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence =
+ \c,xs ->
+ ss (CO.conjunctDistrX c xs) ;
+
+--3 Coordinating adjective phrases
+--
+-- The structure is the same as for sentences. The result is a prefix adjective
+-- if and only if all elements are prefix.
+
+ ListAdjPhrase : Type =
+ {s1,s2 : AdjForm => Str ; p : Bool} ;
+
+ twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
+ CO.twoTable AdjForm x y ** {p = andB x.p y.p} ;
+
+ consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
+ CO.consTable AdjForm CO.comma xs x ** {p = andB xs.p x.p} ;
+
+ conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs ->
+ CO.conjunctTable AdjForm c xs ** {p = xs.p} ;
+
+ conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs ->
+ CO.conjunctDistrTable AdjForm c xs ** {p = xs.p} ;
+
+
+--3 Coordinating noun phrases
+--
+-- The structure is the same as for sentences. The result is either always plural
+-- or plural if any of the components is, depending on the conjunction.
+
+ ListNounPhrase : Type = { s1,s2 : PronForm => Str ; g: Gender ;
+ anim : Animacy ; n : Number ; p : Person ; pron : Bool } ;
+
+ twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y ->
+ CO.twoTable PronForm x y ** {n = conjNumber x.n y.n ;
+ g = conjGender x.g y.g ; p = conjPerson x.p y.p ;
+ pron = conjPron x.pron y.pron ; anim = conjAnim x.anim y.anim } ;
+
+ consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x ->
+ CO.consTable PronForm CO.comma xs x **
+ {n = conjNumber xs.n x.n ; g = conjGender x.g xs.g ;
+ anim = conjAnim x.anim xs.anim ;
+ p = conjPerson xs.p x.p; pron = conjPron xs.pron x.pron} ;
+
+ conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs ->
+ CO.conjunctTable PronForm c xs ** {n = conjNumber c.n xs.n ;
+ anim = xs.anim ;
+ p = xs.p; g = xs.g ; pron = xs.pron} ;
+
+ conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase =
+ \c,xs ->
+ CO.conjunctDistrTable PronForm c xs ** {n = conjNumber c.n xs.n ;
+ p = xs.p ; pron = xs.pron ; anim = xs.anim ;
+ g = xs.g } ;
+
+-- We have to define a calculus of numbers of persons. For numbers,
+-- it is like the conjunction with $Pl$ corresponding to $False$.
+
+ conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of {
+ <Sg,Sg> => Sg ;
+ _ => Pl
+ } ;
+
+-- For persons, we let the latter argument win ("либо ты, либо я пойду"
+-- but "либо я, либо ты пойдешь"). This is not quite clear.
+
+ conjPerson : Person -> Person -> Person = \_,p ->
+ p ;
+
+-- For pron, we let the latter argument win - "Маша или моя мама" (Nominative case)
+-- but - "моей или Машина мама" (Genetive case) both corresponds to
+-- "Masha's or my mother"), which is actually not exactly correct, since
+-- different cases should be used - "Машина или моя мама".
+
+ conjPron : Bool -> Bool -> Bool = \_,p ->
+ p ;
+
+-- For gender in a similar manner as for person:
+-- Needed for adjective predicates like:
+-- "Маша или Оля - красивая", "Антон или Олег - красивый",
+-- "Маша или Олег - красивый".
+-- The later is not totally correct, but there is no correct way to say that.
+
+ conjGender : Gender -> Gender -> Gender = \_,m -> m ;
+
+ conjAnim : Animacy -> Animacy -> Animacy = \_,m -> m ;
+
+--2 Subjunction
+--
+-- Subjunctions ("когда", "если", etc)
+-- are a different way to combine sentences than conjunctions.
+-- The main clause can be a sentence, an imperative, or a question,
+-- but the subjoined clause must be a sentence.
+--
+-- There are uniformly two variant word orders, e.g.
+-- "если ты закуришь, я рассержусь"
+-- and "я рассержусь, если ты закуришь".
+
+ Subjunction = SS ;
+
+ subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence =
+ \if, A, B ->
+ ss (subjunctVariants if A.s B.s) ;
+
+ subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative =
+ \if, A, B ->
+ {s = \\g,n => subjunctVariants if A.s (B.s ! g ! n)} ;
+
+ subjunctQuestion : Subjunction -> Sentence -> Question -> Question =
+ \if, A, B ->
+ {s = \\q => subjunctVariants if A.s (B.s ! q)} ;
+
+ subjunctVariants : Subjunction -> Str -> Str -> Str = \if,A,B ->
+ variants {if.s ++ A ++ "," ++ B ; B ++ "," ++ if.s ++ A} ;
+
+--2 One-word utterances
+--
+-- An utterance can consist of one phrase of almost any category,
+-- the limiting case being one-word utterances. These
+-- utterances are often (but not always) in what can be called the
+-- default form of a category, e.g. the nominative.
+-- This list is far from exhaustive.
+
+ useNounPhrase : NounPhrase -> Utterance = \masha ->
+ postfixSS "." (defaultNounPhrase masha) ;
+
+ useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,mashina ->
+ useNounPhrase (indefNounPhrase n mashina) ;
+
+ useRegularName : Gender -> SS -> NounPhrase = \g, masha ->
+ nameNounPhrase (case g of { Masc => mkProperNameMasc masha.s Animate;
+ _ => mkProperNameFem masha.s Animate }) ;
+
+-- Here are some default forms.
+
+ defaultNounPhrase : NounPhrase -> SS = \masha ->
+ ss (masha.s ! PF Nom No NonPoss) ;
+
+ defaultQuestion : Question -> SS = \ktoTu ->
+ ss (ktoTu.s ! DirQ) ;
+
+ defaultSentence : Sentence -> Utterance = \x ->
+ x ;
+};
diff --git a/grammars/resource/russian/TestRus.gf b/grammars/resource/russian/TestRus.gf new file mode 100644 index 000000000..f3d2a5cb4 --- /dev/null +++ b/grammars/resource/russian/TestRus.gf @@ -0,0 +1,40 @@ +-- use this path to read the grammar from the same directory
+--# -path=.:../abstract:../../prelude
+
+concrete TestRus of TestAbs = ResRus ** open Syntax in {
+
+flags
+ coding=utf8 ;
+ startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
+
+-- a random sample from the lexicon
+
+lin
+ Big = bolshoj ;
+ Small = malenkij ;
+ Old = staruj ;
+ Young = molodoj ;
+ Man = muzhchina ;
+ Woman = zhenchina ;
+ Car = mashina ;
+ House = dom ;
+ Light = svet ;
+ Walk = extVerb verbGulyat Act Present ;
+ Run = extVerb verbBegat Act Present ;
+ Love = mkDirectVerb (extVerb verbLubit Act Present ) ;
+ Send = mkDirectVerb (extVerb verbOtpravlyat Act Present ) ;
+ Wait = mkDirectVerb (extVerb verbZhdat Act Present );
+ Say = extVerb verbGovorit Act Present ; --- works in present tense...
+ Prove = extVerb verbDokazuvat Act Present ;
+ SwitchOn = mkDirectVerb (extVerb verbVkluchat Act Present ) ;
+ SwitchOff = mkDirectVerb (extVerb verbVukluchat Act Present ) ;
+
+ Mother = funGen mama ;
+ Uncle = funGen dyadya ;
+
+ Always = vsegda ;
+ Well = chorosho ;
+
+ John = mkProperNameMasc "Иван" Animate ;
+ Mary = mkProperNameFem "Маш" Animate ;
+};
diff --git a/grammars/resource/russian/Types.gf b/grammars/resource/russian/Types.gf new file mode 100644 index 000000000..64ed69e66 --- /dev/null +++ b/grammars/resource/russian/Types.gf @@ -0,0 +1,288 @@ +--1 Russian Word Classes and Morphological Parameters
+--
+-- Aarne Ranta, Janna Khegai 2003
+--
+-- This is a resource module for Russian morphology, defining the
+-- morphological parameters and word classes of Russian. It is aimed
+-- to be complete w.r.t. the description of word forms.
+-- However, it does not include those parameters that are not needed for
+-- analysing individual words: such parameters are defined in syntax modules.
+--
+
+resource Types = open Prelude in {
+
+flags coding=utf8 ;
+
+--2 Enumerated parameter types
+--
+-- These types are the ones found in school grammars.
+-- Their parameter values are atomic.
+
+param
+ Gender = Masc | Fem | Neut ;
+ Number = Sg | Pl ;
+ Case = Nom | Gen | Dat | Acc | Inst | Prepos ;
+ Voice = Act | Pass ;
+ Aspect = Imperfective | Perfective ;
+ Tense = Present | Past ;
+ Degree = Pos | Comp | Super ;
+ Person = P1 | P2 | P3 ;
+ AfterPrep = Yes | No ;
+ Possessive = NonPoss | Poss GenNum ;
+ Animacy = Animate | Inanimate ;
+
+-- A number of Russian nouns have common gender. They can
+-- denote both males and females: "умница" (a clever person), "инженер" (an engineer).
+-- We overlook this phenomenon for now.
+
+-- The AfterPrep parameter is introduced in order to describe
+-- the variations of the third person personal pronoun forms
+-- depending on whether they come after a preposition or not.
+
+-- The Possessive parameter is introduced in order to describe
+-- the possessives of personal pronouns, which are used in the
+-- Genetive constructions like "мама моя" (my mother) instead of
+-- "мама меня" (the mother of mine).
+
+--2 Word classes and hierarchical parameter types
+--
+-- Real parameter types (i.e. ones on which words and phrases depend)
+-- are mostly hierarchical. The alternative would be cross-products of
+-- simple parameters, but this would usually overgenerate.
+
+-- However, we use the cross-products in complex cases
+-- (for example, aspect and tense parameter in the verb description)
+-- where the relationship between the parameters are non-trivial
+-- even though we aware that some combinations do not exist
+-- (for example, present perfective does not exist, but removing
+-- this combination would lead to having different descriptions
+-- for perfective and imperfective verbs, which we do not want for the
+-- sake of uniformity).
+
+--3 Nouns
+--
+-- Common nouns decline according to number and case.
+-- For the sake of shorter description these parameters are
+-- combined in the type SubstForm.
+
+
+param SubstForm = SF Number Case ;
+
+-- Substantives moreover have an inherent gender.
+
+oper
+ CommNoun : Type = {s : SubstForm => Str ; g : Gender ; anim : Animacy } ;
+ numSF: SubstForm -> Number = \sf -> case sf of
+ {
+ SF Sg _ => Sg ;
+ _ => Pl
+ } ;
+
+ caseSF: SubstForm -> Case = \sf -> case sf of
+ {
+ SF _ Nom => Nom ;
+ SF _ Gen => Gen ;
+ SF _ Dat => Dat ;
+ SF _ Inst => Inst ;
+ SF _ Acc => Acc ;
+ SF _ Prepos => Prepos
+ } ;
+
+--
+--3 Pronouns
+--
+
+oper
+ Pronoun : Type = { s : PronForm => Str ; n : Number ;
+ p : Person ; g: PronGen ; pron: Bool} ;
+
+param PronForm = PF Case AfterPrep Possessive;
+
+-- Gender is not morphologically determined for first
+-- and second person pronouns.
+
+ PronGen = PGen Gender | PNoGen ;
+
+-- The following coercion is useful:
+
+oper
+ pgen2gen : PronGen -> Gender = \p -> case p of {
+ PGen g => g ;
+ PNoGen => variants {Masc ; Fem} --- the best we can do for ya, tu
+ } ;
+
+oper
+ extCase: PronForm -> Case = \pf -> case pf of
+ { PF Nom _ _ => Nom ;
+ PF Gen _ _ => Gen ;
+ PF Dat _ _ => Dat ;
+ PF Inst _ _ => Inst ;
+ PF Acc _ _ => Acc ;
+ PF Prepos _ _ => Prepos
+ } ;
+
+ mkPronForm: Case -> AfterPrep -> Possessive -> PronForm =
+ \c,n,p -> PF c n p ;
+
+--3 Adjectives
+--
+-- Adjectives is a very complex class.
+-- The major division is between the comparison degrees.
+
+param
+ AdjForm = AF Case Animacy GenNum ;
+
+-- Declination forms depend on Case, Animacy , Gender:
+-- "большие дома" - "больших домов" (big houses - big houses'),
+-- Animacy plays role only in the Accusative case:
+-- "я люблю большие дома"-"я люблю больших мужчин"
+-- (I love big houses - I love big men);
+-- and on Number: "большой дом" - "большие дома"
+-- (a big house - big houses).
+-- The plural never makes a gender distinction.
+
+ GenNum = ASg Gender | APl ;
+
+oper numGNum : GenNum -> Number = \gn ->
+ case gn of { APl => Pl ; _ => Sg } ;
+
+oper genGNum : GenNum -> Gender = \gn ->
+ case gn of { ASg Fem => Fem; _ => Masc } ;
+
+oper numAF: AdjForm -> Number = \af ->
+ case af of { AF _ _ gn => (numGNum gn) } ;
+
+oper caseAF: AdjForm -> Case = \af ->
+ case af of { AF c _ _ => c } ;
+
+-- The Degree parameter should also be more complex, since most Russian
+-- adjectives have two comparative forms:
+-- attributive (syntactic (compound), declinable) -
+-- "более высокий" (corresponds to "more high")
+-- and predicative (indeclinable)- "выше" (higher) and more than one
+-- superlative forms: "самый высокий" (corresponds to "the most high") -
+-- "наивысший" (the highest).
+
+-- Even one more parameter independent of the degree can be added,
+-- since Russian adjectives in the positive degree also have two forms:
+-- long (attributive and predicative) - "высокий" (high) and short (predicative) - "высок"
+-- although this parameter will not be exactly orthogonal to the
+-- degree parameter.
+-- Short form has no case declension, so in principle
+-- it can be considered as an additional case.
+
+-- Note: although the predicative usage of the long
+-- form is perfectly grammatical, it can have a slightly different meaning
+-- compared to the short form.
+-- For example: "он - больной" (long, predicative) vs.
+-- "он - болен" (short, predicative).
+
+oper
+ AdjDegr : Type = {s : Degree => AdjForm => Str} ;
+
+-- Adjective type includes both non-degree adjective classes:
+-- possesive ("мамин"[mother's], "лисий" [fox'es])
+-- and relative ("русский" [Russian]) adjectives.
+
+ Adjective : Type = {s : AdjForm => Str} ;
+
+
+--3 Verbs
+
+-- Mood is the main verb classification parameter.
+-- The verb mood can be infinitive, subjunctive, imperative, and indicative.
+
+-- Note: subjunctive mood is analytical, i.e. formed from the past form of the
+-- indicative mood plus the particle "бы". That is why they have the same GenNum
+-- parameter. We choose to keep the "redundant" form in order to indicate
+-- the presence of the subjunctive mood in Russian verbs.
+
+-- Aspect and Voice parameters are present in every mood, so Voice is put
+-- before the mood parameter in verb form description the hierachy.
+-- Moreover Aspect is regarded as an inherent parameter of a verb entry.
+-- The primary reason for that is that one imperfective form can have several
+-- perfective forms: "ломать" - "с-ломать" - "по-ломать" (to break).
+-- Besides, the perfective form could be formed from imperfective
+-- by prefixation, but also by taking a completely different stem:
+-- "говорить"-"сказать" (to say). In the later case it is even natural to
+-- regard them as different verb entries.
+-- Another reason is that looking at the Aspect as an inherent verb parameter
+-- seem to be customary in other similar projects:
+-- http://starling.rinet.ru/morph.htm
+
+-- Note: Of course, the whole inflection table has many redundancies
+-- in a sense that many verbs do not have all grammatically possible
+-- forms. For example, passive does not exist for the verb
+-- "любить" (to love), but exists for the verb "ломать" (to break).
+
+-- Depending on the tense verbs conjugate according to combinations
+-- of gender, person and number of the verb objects.
+-- Participles (Present and Past) and Gerund forms are not included in the
+-- current description. This is the verb type used in the lexicon:
+
+oper Verbum : Type = { s: VerbForm => Str ; asp : Aspect };
+
+param
+
+ VerbForm = VFORM Voice VerbConj ;
+ VerbConj = VIND VTense | VIMP Number Person | VINF | VSUB GenNum ;
+ VTense = VPresent Number Person | VPast GenNum | VFuture Number Person ;
+
+-- For writing an application grammar one usually doesn't need
+-- the whole inflection table, since each verb is used in
+-- a particular context that determines some of the parameters
+-- (Tense and Voice while Aspect is fixed from the beginning) for certain usage.
+-- So we define the "Verb" type, that have these parameters fixed.
+-- The conjugation parameters left (Gender, Number, Person)
+-- are combined in the "VF" type:
+
+param VF =
+ VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum;
+
+oper
+ Verb : Type = {s : VF => Str ; t: Tense ; a : Aspect ; v: Voice} ;
+
+ extVerb : Verbum -> Voice -> Tense -> Verb = \aller, vox, t ->
+ { s = table {
+ VFin gn p => case t of {
+ Present => aller.s ! VFORM vox (VIND (VPresent (numGNum gn) p)) ;
+ Past => aller.s ! VFORM vox (VIND (VPast gn))
+ } ;
+ VImper n p => aller.s ! VFORM vox (VIMP n p) ;
+ VInf => aller.s ! VFORM vox VINF ;
+ VSubj gn => aller.s ! VFORM vox (VSUB gn)
+ }; t = t ; a = aller.asp ; v = vox } ;
+
+
+--3 Other open classes
+--
+-- Proper names and adverbs are the remaining open classes.
+
+oper
+ PNm : Type = {s : Case => Str ; g : Gender} ;
+
+-- Adverbials are not inflected (we ignore comparison, and treat
+-- compared adverbials as separate expressions; this could be done another way).
+
+ Adverb : Type = SS ;
+
+
+--3 Closed classes
+--
+-- The rest of the Russian word classes are closed, i.e. not extensible by new
+-- lexical entries. Thus we don't have to know how to build them, but only
+-- how to use them, i.e. which parameters they have.
+--
+
+--3 Relative pronouns
+--
+-- Relative pronouns are inflected in
+-- gender, number, and case just like adjectives.
+
+ RelPron : Type = {s : GenNum => Case => Animacy => Str} ;
+
+
+--3 Prepositions are just strings.
+
+ Preposition = Str ;
+};
|
