diff --git a/lib/resource/russian/AllResourceRus.gf b/lib/resource/russian/AllResourceRus.gf index 6d6c3096b..f81e9040e 100644 --- a/lib/resource/russian/AllResourceRus.gf +++ b/lib/resource/russian/AllResourceRus.gf @@ -1,2 +1,4 @@ +--# -path=.:../abstract:../../prelude + concrete AllResourceRus of AllResource = RulesRus, StructuralRus ** {} ; diff --git a/lib/resource/russian/CategoriesRus.gf b/lib/resource/russian/CategoriesRus.gf index e99472398..bded5686e 100644 --- a/lib/resource/russian/CategoriesRus.gf +++ b/lib/resource/russian/CategoriesRus.gf @@ -54,21 +54,22 @@ lincat Num = Numeral ; -- = {s : Case => Gender => Str} ; - V = Verb ; - -- = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ; + V = Verbum ; + -- = {s : VerbForm => Str ; asp : Aspect } ; VG = VerbGroup ; - -- = Verb ; + -- = Verbum ** { w: Voice; s2 : Bool => Str ; + -- s3 : Gender => Number => Str ; negBefore: Bool} ; VP = VerbPhrase ; -- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ; -- negBefore: Bool} ; V2 = TransVerb ; - -- = Verb ** {s2 : Str ; c: Case } ; + -- = Verbum ** {s2 : Str ; c: Case } ; V3 = DitransVerb ; -- = TransVerb ** {s4 : Str; c2: Case} ; VS = SentenceVerb ; - -- = Verb ; + -- = Verbum ; VV = VerbVerb ; - -- = Verb ; + -- = Verbum ; AdV = Adverb ; @@ -110,10 +111,9 @@ lincat -- = { s1,s2 : PronForm => Str ; g: Gender ; anim : Animacy ; -- n : Number ; p : Person ; pron : Bool } ; --- From CombinationsRus: Text = {s : Str} ; --- From Swedish: PP = Adverb ; --- From Swedish: Cl = Clause ; - -- = {s : Bool => SForm => Order => Str} ; + PP = Adverb ; + Cl = Clause ; + -- = {s : Bool => ClForm => Str} ; } diff --git a/lib/resource/russian/MorphoRus.gf b/lib/resource/russian/MorphoRus.gf index 360b79b77..99735eb94 100644 --- a/lib/resource/russian/MorphoRus.gf +++ b/lib/resource/russian/MorphoRus.gf @@ -918,7 +918,7 @@ oper totDet: Adjective = {s = table { AF Inst _ (ASg Fem) => "той"; AF Inst _ (ASg Neut) => "тем"; AF Inst _ APl => "теми"; - AF Dat _ (ASg Masc) => "тому"; + AF Dat _ (ASg Masc) => "тому"; AF Dat _ (ASg Fem) => "той"; AF Dat _ (ASg Neut) => "тому"; AF Dat _ APl => "тем"; @@ -1003,7 +1003,7 @@ oper uy_j_EndDecl : Str -> Adjective = \s ->{s = table { AF Gen _ (ASg Masc) => s+"ого"; AF Gen _ (ASg Fem) => s+"ой"; AF Gen _ (ASg Neut) => s+"ого"; - AF Gen _ APl => s+"ых"; + AF Gen _ APl => s+"ых"; AF Inst _ (ASg Masc) => s+"ым"; AF Inst _ (ASg Fem) => s+"ой"; AF Inst _ (ASg Neut) => s+"ым"; @@ -1343,26 +1343,26 @@ oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv -> VSUB (ASg Fem) => pv ! (PSF (ASg Fem)) + "сь"+[" бы"]; VSUB (ASg Neut) => pv ! (PSF (ASg Neut)) + "сь"+[" бы"]; VSUB APl => pv ! (PSF APl) + "сь"+[" бы"] ; - VIND (VPresent Sg P1) => + VIND (ASg _) (VPresent P1) => -- case av.asp of { Imperfective => - av.s ! (VIND (VPresent Sg P1)) + "сь" ; + av.s ! (VIND (ASg Masc) (VPresent 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)) + "сь" + VIND (ASg _) (VPresent P2) => av.s ! (VIND (ASg Masc) (VPresent P2))+ "ся" ; + VIND (ASg _) (VPresent P3) => av.s ! (VIND (ASg Masc) (VPresent P3))+ "ся" ; + VIND APl (VPresent P1) => av.s !( VIND APl (VPresent P1)) + "ся" ; + VIND APl (VPresent P2) => av.s !( VIND APl (VPresent P2)) + "сь" ; + VIND APl (VPresent P3) => av.s !( VIND APl (VPresent P3)) + "ся" ; + VIND (ASg _) (VFuture P1) => av.s ! (VIND (ASg Masc) (VFuture P1)) + "сь"; + VIND (ASg _) (VFuture P2) => av.s! (VIND (ASg Masc) (VFuture P2) )+ "ся"; + VIND (ASg _) (VFuture P3) => av.s! (VIND (ASg Masc) (VFuture P3)) + "ся"; + VIND APl (VFuture P1) => av.s! (VIND APl (VFuture P1) )+ "ся"; + VIND APl (VFuture P2) => av.s! (VIND APl (VFuture P2) )+ "сь"; + VIND APl (VFuture P3) => av.s! (VIND APl (VFuture P3)) + "ся"; + VIND (ASg Masc) VPast => av.s ! (VIND (ASg Masc) VPast ) + "ся"; + VIND (ASg Fem) VPast => av.s ! (VIND (ASg Fem) VPast ) + "сь"; + VIND (ASg Neut) VPast => av.s ! (VIND (ASg Neut) VPast) + "сь"; + VIND APl VPast => av.s ! (VIND APl VPast ) + "сь" } ; asp = av.asp }; @@ -1385,23 +1385,23 @@ oper VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"]; VSUB APl => past ! (PSF APl) +[" бы"]; - VIND (VPresent Sg P1) => presentFuture ! ( PRF (ASg Masc) P1); - VIND (VPresent Sg P2) => presentFuture! (PRF (ASg Masc) P2) ; - VIND (VPresent Sg P3) => presentFuture ! (PRF (ASg Masc) P3) ; - VIND (VPresent Pl P1) => presentFuture ! (PRF APl P1); - VIND (VPresent Pl P2) => presentFuture ! (PRF APl P2); - VIND (VPresent Pl P3) => presentFuture ! (PRF APl P3); - VIND (VFuture Sg P1) => ["буду "] + presentFuture ! (PRF (ASg Masc) P1) ; - VIND (VFuture Sg P2) => ["будешь"] + presentFuture ! (PRF (ASg Masc) P2) ; - VIND (VFuture Sg P3) => ["будет "] + presentFuture ! (PRF (ASg Masc) P3) ; - VIND (VFuture Pl P1) => ["будем "] + presentFuture ! (PRF APl P1) ; - VIND (VFuture Pl P2) => ["будете "] + presentFuture ! (PRF APl P2) ; - VIND (VFuture Pl P3) => ["будут "] + presentFuture ! (PRF APl P3) ; + VIND (ASg _) (VPresent P1) => presentFuture ! ( PRF (ASg Masc) P1); + VIND (ASg _) (VPresent P2) => presentFuture! (PRF (ASg Masc) P2) ; + VIND (ASg _) (VPresent P3) => presentFuture ! (PRF (ASg Masc) P3) ; + VIND APl (VPresent P1) => presentFuture ! (PRF APl P1); + VIND APl (VPresent P2) => presentFuture ! (PRF APl P2); + VIND APl (VPresent P3) => presentFuture ! (PRF APl P3); + VIND (ASg _) (VFuture P1) => ["буду "] + presentFuture ! (PRF (ASg Masc) P1) ; + VIND (ASg _) (VFuture P2) => ["будешь"] + presentFuture ! (PRF (ASg Masc) P2) ; + VIND (ASg _) (VFuture P3) => ["будет "] + presentFuture ! (PRF (ASg Masc) P3) ; + VIND APl (VFuture P1) => ["будем "] + presentFuture ! (PRF APl P1) ; + VIND APl (VFuture P2) => ["будете "] + presentFuture ! (PRF APl P2) ; + VIND APl (VFuture P3) => ["будут "] + presentFuture ! (PRF APl 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) + VIND (ASg Masc) VPast => past ! (PSF (ASg Masc)) ; + VIND (ASg Fem) VPast => past ! (PSF (ASg Fem) ) ; + VIND (ASg Neut) VPast => past ! (PSF (ASg Neut)) ; + VIND APl VPast => past ! (PSF APl) } ; asp = Imperfective } ; @@ -1420,22 +1420,20 @@ oper 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 (ASg Masc) P1) ; - VIND (VFuture Sg P2) => presentFuture ! (PRF (ASg Masc) P2) ; - VIND (VFuture Sg P3) => presentFuture ! (PRF (ASg Masc) P3) ; - VIND (VFuture Pl P1) => presentFuture ! (PRF APl P1) ; - VIND (VFuture Pl P2) => presentFuture ! (PRF APl P2) ; - VIND (VFuture Pl P3) => presentFuture ! (PRF APl 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) + VIND (ASg _) (VPresent _) => [] ; + VIND APl (VPresent P1) => nonExist ; + VIND APl (VPresent P2) => nonExist ; + VIND APl (VPresent P3) => [] ; + VIND (ASg _) (VFuture P1) => presentFuture ! (PRF (ASg Masc) P1) ; + VIND (ASg _) (VFuture P2) => presentFuture ! (PRF (ASg Masc) P2) ; + VIND (ASg _) (VFuture P3) => presentFuture ! (PRF (ASg Masc) P3) ; + VIND APl (VFuture P1) => presentFuture ! (PRF APl P1) ; + VIND APl (VFuture P2) => presentFuture ! (PRF APl P2) ; + VIND APl (VFuture P3) => presentFuture ! (PRF APl P3) ; + VIND (ASg Masc) VPast => past ! (PSF (ASg Masc)) ; + VIND (ASg Fem) VPast => past ! (PSF (ASg Fem) ) ; + VIND (ASg Neut) VPast => past ! (PSF (ASg Neut)) ; + VIND APl VPast => past ! (PSF APl) } ; asp = Perfective } ; diff --git a/lib/resource/russian/RulesRus.gf b/lib/resource/russian/RulesRus.gf index 6232d7296..8d4b9e48b 100644 --- a/lib/resource/russian/RulesRus.gf +++ b/lib/resource/russian/RulesRus.gf @@ -1,9 +1,10 @@ +--# -path=.:../abstract:../../prelude concrete RulesRus of Rules = CategoriesRus ** open Prelude, SyntaxRus in { lin UsePN = nameNounPhrase ; - ComplAdj = complAdj ; + ComplA2 = complAdj ; PredVP = predVerbPhrase ; UseA1 = adj2adjPhrase ; ModAdj = modCommNounPhrase ; @@ -17,14 +18,6 @@ lin ComparADeg = comparAdjPhrase ; SuperlNP = superlNounPhrase ; - -- From RulesSwe.gf: ComplA2 = complAdj ; - -- IntCN cn s = - -- {s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ; - -- g = cn.g ; - -- x = cn.x ; - -- p = cn.p - -- } ; - CNthatS = nounThatSentence ; UseInt i = useInt i.s; NoNum = noNum ; @@ -45,25 +38,20 @@ lin DefNumNP = indefNounPhraseNum Pl ; MassNP = indefNounPhrase Sg; - PosVG = predVerbGroup True ; - NegVG = predVerbGroup False ; + PosVG = predVerbGroup True Present ; + NegVG = predVerbGroup False Present ; - PredV v = v ; -- From Swedish: PredV = predVerb ; + PredV = predVerb ; PredAP = predAdjective ; PredCN = predCommNoun ; PredV2 = complTransVerb ; PredV3 = complDitransVerb ; - PredPassV v = v ; + PredPassV = predPassVerb ; PredNP = predNounPhrase ; - PredAdV = predAdverb ; + PredPP = predAdverb ; PredVS = complSentVerb ; PredVV = complVerbVerb ; VTrans = verbOfTransVerb ; ---From Swedish: - --PredVP = predVerbPhrase ; - --PredVG = predVerbGroupClause ; - --PredSuperl a = predAdjective (superlAdjPhrase a) ; - AdjAdv a = mkAdverb (a.s ! AdvF) ; PrepNP p = prepPhrase p ; @@ -71,11 +59,9 @@ lin --LocNP = locativeNounPhrase ; AdvCN = advCommNounPhrase ; AdvAP = advAdjPhrase ; - --From Swedish: AdvPP p = p ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; + PosSlashV2 = slashTransVerb True ; + NegSlashV2 = slashTransVerb False ; OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ; ThereNP = thereIs ; @@ -102,8 +88,6 @@ lin ImperVP = imperVerbPhrase ; - -- From Swedish: PrepS p = ss (p.s ++ ",") ; - IndicPhrase = indicUtt ; QuestPhrase = interrogUtt ; ImperOne = imperUtterance Masc Sg ; @@ -138,5 +122,17 @@ lin OnePhr p = p ; ConsPhr = cc2 ; +--New in the "lib"-version from Swedish: + + AdvPP p = p ; + PredSuperl a = predAdjective (superlAdjPhrase a) ; + PrepS p = ss (p.s ++ ",") ; + IntCN cn s = + {s = \\n,c => cn.s ! n ! c ++ s.s ; + g = cn.g ; + anim = cn.anim + } ; + PredVG = predVerbGroupClause ; + } ; diff --git a/lib/resource/russian/StructuralRus.gf b/lib/resource/russian/StructuralRus.gf index d2f7494dd..23fe8a049 100644 --- a/lib/resource/russian/StructuralRus.gf +++ b/lib/resource/russian/StructuralRus.gf @@ -75,10 +75,10 @@ EverythingNP = pron2NounPhrase pronVseInanimate Inanimate; SomethingNP = pron2NounPhrase pronChtoTo Inanimate ; NothingNP = pron2NounPhrase pronNichto Inanimate; -CanVV = extVerb verbMoch Act Present ; -CanKnowVV = extVerb verbMoch Act Present ; -MustVV = extVerb verbDolzhen Act Present ; -WantVV = extVerb verbKhotet Act Present ; +CanVV = verbMoch ; +CanKnowVV = verbMoch ; +MustVV = verbDolzhen ; +WantVV = verbKhotet ; HowIAdv = ss "как" ; WhenIAdv = ss "когда" ; diff --git a/lib/resource/russian/SyntaxRus.gf b/lib/resource/russian/SyntaxRus.gf index cbfbd0db7..7db63d2d0 100644 --- a/lib/resource/russian/SyntaxRus.gf +++ b/lib/resource/russian/SyntaxRus.gf @@ -248,6 +248,13 @@ pgNum : PronGen -> Number -> GenNum = \g,n -> g = PGen dom.g } ; +-- Moreover, superlatives can be used alone as adjectival phrases +-- ("самый крупный", "крупнейший" - in free variation). + + superlAdjPhrase : AdjDegr -> AdjPhrase = \bolshoj -> + {s = bolshoj.s ! Super ; + p = False + } ; --3 Two-place adjectives -- @@ -366,17 +373,17 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in -- ("купить хлеба", "не читать газет") are overlooked in mkDirectVerb -- and can be expressed via more a general rule mkTransVerb. - TransVerb : Type = Verb ** {s2 : Str ; c: Case } ; + TransVerb : Type = Verbum ** {s2 : Str ; 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 ; w = v.w } ; + verbOfTransVerb : TransVerb -> Verbum = \v -> + {s = v.s; asp = v.asp } ; - mkTransVerb : Verb -> Str -> Case -> TransVerb = \v,p,cas -> + mkTransVerb : Verbum -> Str -> Case -> TransVerb = \v,p,cas -> v ** {s2 = p ; c = cas } ; - mkDirectVerb : Verb -> TransVerb = \v -> - mkTransVerb v nullPrep Acc; + mkDirectVerb : Verbum -> TransVerb = \v -> + mkTransVerb v nullPrep Acc; nullPrep : Str = [] ; @@ -384,7 +391,12 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in complTransVerb :TransVerb -> NounPhrase -> VerbGroup = \se,tu -> {s =\\vf => se.s ! vf ++ se.s2 ++ tu.s ! (mkPronForm se.c No NonPoss) ; - a = se.a ; t = se.t ; w = se.w } ; + asp = se.asp ; + w = Act; + s2 = table{_ => ""}; + s3 = table{_=> table{_=>""}}; + negBefore = True + } ; --3 Verb phrases -- @@ -392,20 +404,42 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in -- (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. - - VerbGroup = Verb ; - - VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ; + + VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ; negBefore: Bool} ; +-- VerbGroup is new in "lib"-verion of the resource. +-- Unlike VerbPhrase, VerbGroup does not have Tense parameter fixed. +-- It also not yet negated (s2): + + VerbGroup : Type = Verbum ** {w: Voice; s2 : Bool => Str ; s3 : Gender => Number => Str ; negBefore: Bool}; + +-- A 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 (Bool). + + predVerbGroup : Bool -> Tense -> VerbGroup -> VerbPhrase = \b,t, vidit -> + (extVerb vidit vidit.w t)** { + s2 = negation b ; + s3 = vidit.s3 ; + negBefore = vidit.negBefore + } ; + -- 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. - predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vidit -> - vidit ** { - s2 = negation b ; - s3 = \\_,_ => [] ; - negBefore = True -- this should be a parameter ! - } ; +-- N.B. negation is *not* a function applicable to a verb phrase, since +-- double negations with "inte" are not grammatical. + + predVerb : Verbum -> VerbGroup = \se -> + se** {w=Act; s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} +} ; + + predPassVerb : Verbum -> VerbGroup = \se -> + se ** {w=Pass; s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} +}; negation : Bool -> Str = \b -> if_then_else Str b [] "не" ; @@ -423,63 +457,24 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in -- all the rest. predAdverb : Adverb -> VerbGroup = \zloj -> - { s= \\vf => case vf of { - VFin _ _ => zloj.s ; - VImper Sg _ => "будь" ++ zloj.s; - VImper Pl _ => "будьте" ++ zloj.s; - -- person is ignored ! - VInf => "быть" ++ zloj.s; - VSubj _ => "" - } ; - t = Present ; - a = Imperfective ; - w = Act - } ; - - predAdjective : AdjPhrase -> VerbGroup = \zloj -> - { s= \\vf => case vf of { - VFin gn _ => case (numGNum gn) of { - Sg => zloj.s ! AF Nom Animate (ASg (genGNum gn)) ; - Pl => zloj.s ! AF Nom Animate APl - } ; - VImper Sg _ => "будь" ++ zloj.s ! AF Inst Animate (ASg Masc); - VImper Pl _ => "будьте" ++ zloj.s ! AF Inst Animate APl ; - -- person is ignored ! - VInf => "быть" ++ zloj.s ! AF Inst Animate (ASg Masc) ; --- infinitive does not save GenNum info! - VSubj _ => "" - } ; - t = Present ; - a = Imperfective ; - w = Act - } ; - - predCommNoun : CommNounPhrase -> VerbGroup = \chelovek -> - { s= \\vf => case vf of { - VFin gn _ => (indefNounPhrase (numGNum gn) chelovek ).s ! (mkPronForm Nom No NonPoss) ; - VImper Sg _ => "будь"++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss) ; - VImper Pl _ => "будьте"++(indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss); - -- person is ignored ! - VInf => "быть" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss) ; - VSubj _ => "" - } ; - t = Present ; - a = Imperfective ; - w = Act - } ; - - predNounPhrase : NounPhrase -> VerbGroup = \masha -> - { s= \\vf => case vf of { - VFin _ _ => masha.s ! (mkPronForm Nom No NonPoss) ; - VImper Sg _ => "будь" ++ masha.s ! (mkPronForm Inst No NonPoss); - VImper Pl _ => "будьте" ++ masha.s ! (mkPronForm Inst No NonPoss); - VInf => "быть" ++ masha.s ! (mkPronForm Inst No NonPoss); --- infinitive does not save Number parameter! - VSubj _ => "" - } ; - t = Present ; - a = Imperfective ; - w = Act + { s= table { + VFORM _ (VIMP Sg _) => "будь" ++ zloj.s; -- person is ignored ! + VFORM _ (VIMP Pl _) => "будьте" ++ zloj.s; + VFORM _ VINF => "быть" ++ zloj.s; + VFORM _ (VIND _ (VPresent _)) => zloj.s ; + VFORM _ (VIND (ASg Fem) VPast) => "была" ++ zloj.s; + VFORM _ (VIND (ASg Masc) VPast) => "был" ++ zloj.s; + VFORM _ (VIND (ASg Neut) VPast) => "было" ++ zloj.s; + VFORM _ (VIND APl VPast) => "были" ++ zloj.s; + VFORM _ (VIND (ASg _) (VFuture _)) => "будет" ++ zloj.s; + VFORM _ (VIND APl (VFuture _)) => "будут" ++ zloj.s; + VFORM _ (VSUB _) => "" + } ; + asp = Imperfective ; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} } ; -- Two-place functions add one argument place. @@ -500,7 +495,7 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in DitransVerb = TransVerb ** {s4 : Str; c2: Case} ; - mkDitransVerb : Verb -> Case -> Case -> DitransVerb = \v,c1,c2 -> + mkDitransVerb : Verbum -> Case -> Case -> DitransVerb = \v,c1,c2 -> v ** {s2 = ""; c = c1; s4 = ""; c2=c2 } ; complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = @@ -509,10 +504,12 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in tebepivo = dat.s2 ++ tu.s ! PF dat.c No NonPoss ++ dat.s4 ++ pivo.s ! PF dat.c2 Yes NonPoss in - {s = \\vf => (dat.s ! vf) ++ tebepivo ; - t = dat.t ; - a = dat.a ; - w = dat.w + {s = \\vf => (dat.s ! vf) ++ tebepivo ; + asp = dat.asp ; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} } ; @@ -571,29 +568,59 @@ oper tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.g) ! Ya.n } in + if_then_else Str tebyaNeVizhu.negBefore + (ya ++ ne ++ vizhu ++ tebya) + (ya ++ vizhu ++ ne ++ tebya) + } ; +param + ClForm = ClIndic Tense | ClCondit | ClInfinit ; -- "naked infinitive" clauses + +oper + Clause = {s : Bool => ClForm => Str} ; + + predVerbGroupClause : NounPhrase -> VerbGroup -> Clause = + \Ya, tebyaNeVizhu -> { s = \\b,c => + let { + ya = Ya.s ! (case c of { + ClInfinit => (mkPronForm Acc No NonPoss); + _ =>(mkPronForm Nom No NonPoss) + }); + ne = tebyaNeVizhu.s2 ! b; + vizhu = tebyaNeVizhu.s ! (case c of { + ClInfinit => VFORM tebyaNeVizhu.w (VIMP Ya.n Ya.p); + ClIndic t => VFORM tebyaNeVizhu.w (VIND (pgNum Ya.g Ya.n) (getVTense t Ya.p)); + ClCondit => VFORM tebyaNeVizhu.w (VIND (pgNum Ya.g Ya.n) VPast) + }); + tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.g) ! Ya.n + } + in if_then_else Str tebyaNeVizhu.negBefore (ya ++ ne ++ vizhu ++ tebya) (ya ++ vizhu ++ ne ++ tebya) - } ; -- This is a macro for simultaneous predication and complementation. predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence = - \b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b (complTransVerb vizhu tu)) ; + \b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b Present (complTransVerb vizhu tu)) ; --3 Sentence-complement verbs -- -- Sentence-complement verbs take sentences as complements. - SentenceVerb : Type = Verb ; + SentenceVerb : Type = Verbum ; -- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет": complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \vidit,tuUlubaeshsya -> {s = \\vf => vidit.s ! vf ++ [", что"] ++ tuUlubaeshsya.s ; - t = vidit.t ; w = vidit.w ; a = vidit.a } ; + asp = vidit.asp; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} + } ; --3 Verb-complement verbs -- @@ -605,17 +632,19 @@ oper -- the construction can be iterated, and the corresponding complication -- in the parameter structure. - VerbVerb : Type = Verb ; + VerbVerb : Type = Verbum ; -- To generate "can walk"/"can't walk"; "tries to walk"/"does not try to walk": -- The contraction of "not" is not provided, since it would require changing -- the verb parameter type. complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \putatsya,bezhat -> - { s = \\vf => putatsya.s ! vf ++ bezhat.s ! VInf ; - t = putatsya.t ; - a = putatsya.a ; - w = putatsya.w + { s = \\vf => putatsya.s ! vf ++ bezhat.s ! VFORM bezhat.w VINF ; + asp = putatsya.asp ; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} } ; --2 Sentences missing noun phrases @@ -632,7 +661,11 @@ oper slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = \b,ivan,lubit -> - predVerbPhrase ivan (predVerbGroup b (verbOfTransVerb lubit)) ** + predVerbPhrase ivan (predVerbGroup b Present ((verbOfTransVerb lubit)** + { s2 = table{True => ""; False => "не"}; + w = Act; + negBefore = True; + s3 = table{_=> table{_ => ""}} })) ** complementOfTransVerb lubit ; thereIs : NounPhrase -> Sentence = \bar -> @@ -721,7 +754,7 @@ oper indefNounPhrase ivan.n (appFunComm detstvo ivan) ; -- detstvoIvana -- bug version: -- funIntPron : Function -> IntPron -> IntPron = --- appFun False ; +-- appFun False ; -- There is a variety of simple interrogative pronouns: @@ -816,7 +849,7 @@ oper isThere : NounPhrase -> Question = \bar -> questVerbPhrase ({s = \\_ => ["есть ли"] ; n = bar.n ; p = P3; g = bar.g; anim = bar.anim; pron = bar.pron}) - (predVerbGroup True (predNounPhrase bar)) ; + (predVerbGroup True Present (predNounPhrase bar)) ; --3 Wh-questions -- @@ -1044,4 +1077,86 @@ isThere : NounPhrase -> Question = \bar -> defaultSentence : Sentence -> Utterance = \x -> x ; + + predNounPhrase : NounPhrase -> VerbGroup = \masha -> { s= table { + VFORM _ (VSUB _) => "" ; + VFORM _ (VIMP Sg _) => "будь" ++ masha.s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIMP Pl _) => "будьте" ++ masha.s ! (mkPronForm Inst No NonPoss) ; + VFORM _ VINF => "быть" ++ masha.s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND _ (VPresent _)) => masha.s ! (mkPronForm Nom No NonPoss) ; +VFORM _ (VIND (ASg Fem) VPast) =>"была"++masha.s ! (mkPronForm Inst No NonPoss); +VFORM _ (VIND (ASg Masc) VPast) =>"был" ++ masha.s!(mkPronForm Inst No NonPoss); +VFORM _ (VIND (ASg Neut) VPast) =>"было" ++ masha.s!(mkPronForm Inst No NonPoss); +VFORM _ (VIND APl VPast) => "были" ++ masha.s ! (mkPronForm Inst No NonPoss); +VFORM _ (VIND APl (VFuture P3)) => "будут"++masha.s ! (mkPronForm Inst No NonPoss); +VFORM _ (VIND APl (VFuture P2)) => "будете"++masha.s !(mkPronForm Inst No NonPoss); +VFORM _ (VIND APl (VFuture P1)) => "будем"++masha.s ! (mkPronForm Inst No NonPoss); +VFORM _ (VIND (ASg _) (VFuture P3))=>"будет"++masha.s!(mkPronForm Inst No NonPoss) ; +VFORM _ (VIND (ASg _) (VFuture P2)) => "будешь"++ masha.s ! (mkPronForm Inst No NonPoss) ; +VFORM _ (VIND (ASg _) (VFuture P1))=> "буду"++ masha.s ! (mkPronForm Inst No NonPoss) + } ; + asp = Imperfective ; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} + + } ; + + + predCommNoun : CommNounPhrase -> VerbGroup = \chelovek -> + { s= table { + VFORM _ (VIMP Sg _) => "будь" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIMP Pl _) => "будьте" ++ (indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss) ; +-- person is ignored ! + VFORM _ VINF => "быть" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss) ; + VFORM _ (VIND gn (VPresent _)) => (indefNounPhrase (numGNum gn) chelovek ).s ! (mkPronForm Nom No NonPoss); + VFORM _ (VIND (ASg Fem) VPast) => "была" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND (ASg Masc) VPast) => "был" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND (ASg Neut) VPast) => "было" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND APl VPast) => "были" ++ (indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND APl (VFuture P3)) => "будут" ++ (indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND APl (VFuture P2)) => "будете" ++ (indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND APl (VFuture P1)) => "будем" ++ (indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND (ASg g) (VFuture P3)) => "будет" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND (ASg g) (VFuture P2)) => "будешь"++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VIND (ASg g) (VFuture P1))=> "буду" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss); + VFORM _ (VSUB _ )=> "" + } ; + asp = Imperfective ; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} + + } ; + + predAdjective : AdjPhrase -> VerbGroup = \zloj -> + { s= table { + VFORM _ (VIMP Sg _) => "будь" ++ zloj.s ! AF Inst Animate (ASg Masc); + VFORM _ (VIMP Pl _) => "будьте" ++ zloj.s ! AF Inst Animate APl ; +-- person is ignored ! + VFORM _ VINF => "быть" ++ zloj.s ! AF Inst Animate (ASg Masc) ; +-- infinitive does not save GenNum, +-- but indicative does for the sake of adjectival predication ! + VFORM _ (VIND gn (VPresent _)) => zloj.s ! AF Nom Animate gn ; + VFORM _ (VIND (ASg Fem) VPast) => "была" ++ zloj.s! AF Nom Animate (ASg Fem); + VFORM _ (VIND (ASg Masc) VPast) => "был" ++ zloj.s! AF Nom Animate (ASg Masc); + VFORM _ (VIND (ASg Neut) VPast) => "был" ++ zloj.s! AF Nom Animate (ASg Neut); + VFORM _ (VIND APl VPast) => "были" ++ zloj.s! AF Nom Animate APl; + VFORM _ (VIND APl (VFuture P3)) => "будут" ++ zloj.s! AF Nom Animate APl; + VFORM _ (VIND APl (VFuture P2)) => "будете" ++ zloj.s! AF Nom Animate APl; + VFORM _ (VIND APl (VFuture P1)) => "будем" ++ zloj.s! AF Nom Animate APl; + VFORM _ (VIND (ASg g) (VFuture P3)) => "будет" ++ zloj.s! AF Nom Animate (ASg g); + VFORM _ (VIND (ASg g) (VFuture P2)) => "будешь"++ zloj.s! AF Nom Animate (ASg g); + VFORM _ (VIND (ASg g) (VFuture P1))=> "буду" ++ zloj.s! AF Nom Animate (ASg g); + VFORM _ (VSUB _) => "" + } ; + asp = Imperfective ; + w = Act; + s2 = table{True => ""; False => "не"}; + negBefore = True; + s3 = table{_=> table{_ => ""}} + + } ; }; diff --git a/lib/resource/russian/TestResourceRus.gf b/lib/resource/russian/TestResourceRus.gf index 4e6137680..d9b9dfaf6 100644 --- a/lib/resource/russian/TestResourceRus.gf +++ b/lib/resource/russian/TestResourceRus.gf @@ -1,6 +1,6 @@ -- use this path to read the grammar from the same directory --# -path=.:../abstract:../../prelude -concrete TestResourceRus of TestResource = StructuralRus ** open SyntaxRus in { +concrete TestResourceRus of TestResource = RulesRus, StructuralRus ** open SyntaxRus in { flags coding=utf8 ; @@ -18,12 +18,12 @@ lin American = ij_EndK_G_KH_Decl "американск" ; -- adj1Malenkij from Paradigms Finnish = ij_EndK_G_KH_Decl "финск" ; -- adj1Malenkij from Paradigms Married = adjInvar "замужем" ** {s2 = "за"; c = Inst} ; -- adjinvar from Paradigms - Give = mkDitransVerb (extVerb verbDavat Act Present) Acc Dat; - Prefer = mkDitransVerb (extVerb verbPredpochitat Act Present) Acc Dat ; + Give = mkDitransVerb verbDavat Acc Dat; + Prefer = mkDitransVerb verbPredpochitat Acc Dat ; Bar = bar ; Bottle = butyulka ; Wine = vino ; - Drink = mkDirectVerb (extVerb verbPit Act Present ) ; + Drink = mkDirectVerb verbPit ; Happy = schastlivyuj ; Man = muzhchina ; @@ -32,15 +32,15 @@ lin House = dom ; Level = uroven ; 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 ) ; + Walk = verbGulyat ; + Run = verbBegat ; + Love = mkDirectVerb verbLubit ; + Send = mkDirectVerb verbOtpravlyat ; + Wait = mkDirectVerb verbZhdat ; + Say = verbGovorit ; --- works in present tense... + Prove = verbDokazuvat ; + SwitchOn = mkDirectVerb verbVkluchat ; + SwitchOff = mkDirectVerb verbVukluchat ; Mother = funGen mama ; Uncle = funGen dyadya ; diff --git a/lib/resource/russian/TypesRus.gf b/lib/resource/russian/TypesRus.gf index d5114789d..581c17f03 100644 --- a/lib/resource/russian/TypesRus.gf +++ b/lib/resource/russian/TypesRus.gf @@ -24,7 +24,7 @@ param Case = Nom | Gen | Dat | Acc | Inst | Prepos ; Voice = Act | Pass ; Aspect = Imperfective | Perfective ; - Tense = Present | Past ; + Tense = Present | Past | Future ; Degree = Pos | Comp | Super ; Person = P1 | P2 | P3 ; AfterPrep = Yes | No ; @@ -218,6 +218,9 @@ oper -- 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). +-- In present tense verbs do not conjugate according to Genus, +-- so parameter GenNum instead Number is used for the sake of +-- using for example as adjective in predication. -- Depending on the tense verbs conjugate according to combinations -- of gender, person and number of the verb objects. @@ -229,8 +232,18 @@ 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 ; + VerbConj = VIND GenNum VTense | VIMP Number Person | VINF | VSUB GenNum ; + VTense = VPresent Person | VPast | VFuture Person ; + +oper + getVTense : Tense -> Person -> VTense= \t,p -> + case t of { Present => VPresent p ; Past => VPast; Future => VFuture p } ; + + getVoice: VerbForm -> Voice = \vf -> + case vf of { + VFORM Act _ => Act; + VFORM Pass _ => Pass + }; -- For writing an application grammar one usually doesn't need -- the whole inflection table, since each verb is used in @@ -240,6 +253,7 @@ param -- The conjugation parameters left (Gender, Number, Person) -- are combined in the "VF" type: + param VF = VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum; @@ -249,8 +263,9 @@ oper 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)) + Present => aller.s ! VFORM vox (VIND gn (VPresent p)) ; + Past => aller.s ! VFORM vox (VIND gn VPast ) ; + Future => aller.s ! VFORM vox (VIND gn (VFuture p)) } ; VImper n p => aller.s ! VFORM vox (VIMP n p) ; VInf => aller.s ! VFORM vox VINF ;