revert all changes related to the common Slavic grammar

This commit is contained in:
krasimir
2009-01-08 08:28:43 +00:00
parent f7dfc6f1d7
commit c1d8e8af55
32 changed files with 442 additions and 493 deletions

View File

@@ -37,13 +37,13 @@ flags coding=utf8 ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 vlublen tu =
{s = \\af => vlublen.s !Posit! af ++ vlublen.s2 ++
tu.s ! (mkPronForm vlublen.c No NonPoss) ;
{s = \\af => vlublen.s !Posit! af ++ vlublen.c2.s ++
tu.s ! (mkPronForm vlublen.c2.c No NonPoss) ;
p = True
} ;
ReflA2 vlublen =
{s = \\af => vlublen.s !Posit! af ++ vlublen.s2 ++ sam.s ! vlublen.c;
{s = \\af => vlublen.s !Posit! af ++ vlublen.c2.s ++ sam.s ! vlublen.c2.c;
p = True
} ;

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../common:../slavic
--# -path=.:../abstract:../common:prelude
concrete AllRus of AllRusAbs =
LangRus,

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:../../prelude
concrete CatRus of Cat = CommonX ** CatSlavic with (ResSlavic = ResRus) ** open ResRus, Prelude, (R = ParamX) in {
concrete CatRus of Cat = CommonX ** open ResRus, Prelude in {
flags optimize=all_subs ; coding=utf8 ;
@@ -22,7 +22,8 @@ concrete CatRus of Cat = CommonX ** CatSlavic with (ResSlavic = ResRus) ** open
-- Question
QCl = {s :Polarity => ClForm => QForm => Str};
IP = {s : PronForm => Str; a : Agr; anim : Animacy} ;
IP = { s : PronForm => Str ; n : Number ; p : Person ;
g: PronGen ; anim : Animacy ; pron: Bool} ;
IComp = {s : Str} ;
IDet = Adjective ** {n: Number; g: PronGen; c: Case} ;
IQuant = {s : Number => AdjForm => Str; g: PronGen; c: Case} ; -- AR 16/6/2008
@@ -43,8 +44,11 @@ concrete CatRus of Cat = CommonX ** CatSlavic with (ResSlavic = ResRus) ** open
-- Noun
NP = {s : PronForm => Str; a : Agr; anim : Animacy} ;
Pron = {s : PronForm => Str; a : Agr} ;
CN = {s : NForm => Str; g : Gender; anim : Animacy} ;
NP = { s : PronForm => Str ; n : Number ; p : Person ;
g: PronGen ; anim : Animacy ; pron: Bool} ;
Pron = { s : PronForm => Str ; n : Number ; p : Person ;
g: PronGen ; pron: Bool} ;
-- Determiners (only determinative pronouns
-- (or even indefinite numerals: "много" (many)) in Russian) are inflected
@@ -69,20 +73,25 @@ concrete CatRus of Cat = CommonX ** CatSlavic with (ResSlavic = ResRus) ** open
-- case of "или", the result is however plural if any of the disjuncts is.
Conj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str} ;
Prep = Complement ;
-- Open lexical classes, e.g. Lexicon
V, VS, VV, VQ, VA = Verbum ; -- = {s : VerbForm => Str ; asp : Aspect } ;
V2, V2A = Verbum ** Complement ;
V2V, V2S, V2Q = Verbum ** Complement ; --- AR
V3 = Verbum ** Complement** {s4 : Str; c2: Case} ;
V2, V2A = Verbum ** {c2 : Complement} ;
V2V, V2S, V2Q = Verbum ** {c2 : Complement} ; --- AR
V3 = Verbum ** {c2,c3 : Complement} ;
-- VV = {s : VVForm => Str ; isAux : Bool} ;
Ord = {s : AdjForm => Str} ;
A = {s : Degree => AdjForm => Str} ;
A2 = A ** Complement ;
A2 = A ** {c2 : Complement} ;
-- Substantives moreover have an inherent gender.
N = {s : NForm => Str; g : Gender; anim : Animacy} ;
N2 = {s : NForm => Str; g : Gender; anim : Animacy} ** {c2 : Complement} ;
N3 = {s : NForm => Str; g : Gender; anim : Animacy} ** {c2,c3 : Complement} ;
PN = {s : Case => Str ; g : Gender ; anim : Animacy} ;

View File

@@ -11,13 +11,11 @@ concrete ConjunctionRus of Conjunction =
ConjAdv = conjunctDistrSS ;
ConjNP c xs = conjunctDistrTable PronForm c xs ** {
a = {n = conjNumber c.n xs.a.n;
p = xs.a.p;
g = xs.a.g
};
anim = xs.anim
} ;
ConjNP c xs =
conjunctDistrTable PronForm c xs ** {n = conjNumber c.n xs.n ;
p = xs.p ; pron = xs.pron ; anim = xs.anim ;
g = xs.g } ;
ConjAP c xs = conjunctDistrTable AdjForm c xs ** {p = xs.p} ;
@@ -32,26 +30,20 @@ concrete ConjunctionRus of Conjunction =
ConsAdv = consrSS comma ;
ConsNP x xs = consTable PronForm comma xs x ** {
a = {n = conjNumber xs.a.n x.a.n;
g = conjPGender x.a.g xs.a.g;
p = conjPerson xs.a.p x.a.p
};
anim = conjAnim x.anim xs.anim
} ;
ConsNP x xs =
consTable PronForm comma xs x **
{n = conjNumber xs.n x.n ; g = conjPGender x.g xs.g ;
anim = conjAnim x.anim xs.anim ;
p = conjPerson xs.p x.p; pron = conjPron xs.pron x.pron} ;
ConsAP x xs = consTable AdjForm comma xs x ** {p = andB xs.p x.p} ;
BaseAP x y = twoTable AdjForm x y ** {p = andB x.p y.p} ;
BaseNP x y = twoTable PronForm x y ** {
a = {n = conjNumber x.a.n y.a.n;
g = conjPGender x.a.g y.a.g;
p = conjPerson x.a.p y.a.p
};
anim = conjAnim x.anim y.anim
} ;
BaseNP x y = twoTable PronForm x y ** {n = conjNumber x.n y.n ;
g = conjPGender x.g y.g ; p = conjPerson x.p y.p ;
pron = conjPron x.pron y.pron ; anim = conjAnim x.anim y.anim } ;
---- AR 17/12/2008
BaseRS x y = twoTable3 GenNum Case Animacy x y ** {c = y.c} ;
@@ -64,7 +56,8 @@ concrete ConjunctionRus of Conjunction =
[Adv] = {s1,s2 : Str} ;
-- 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.
[NP] = {s1,s2 : PronForm => Str; a : Agr; anim : Animacy} ;
[NP] = { s1,s2 : PronForm => Str ; g: PronGen ;
anim : Animacy ; n : Number ; p : Person ; pron : Bool } ;
-- The structure is the same as for sentences. The result is a prefix adjective
-- if and only if all elements are prefix.
[AP] = {s1,s2 : AdjForm => Str ; p : Bool} ;
@@ -90,6 +83,14 @@ oper
-- 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:
-- "Маша или Оля - красивая", "Антон или Олег - красивый",

View File

@@ -1,17 +0,0 @@
instance DiffRus of DiffSlavic = open CommonSlavic, Prelude in {
param
PrepKind = PrepOther | PrepVNa;
Case = Nom | Gen | Dat | Acc | Inst | Prepos PrepKind ;
NForm = NF Number Case ;
PronGen = PGen Gender | PNoGen ;
oper
Agr = {n : Number; p : Person; g : PronGen} ;
agrP3 : Number -> PronGen -> Agr = \n,g ->
{n = n; p = P3; g = g} ;
}

View File

@@ -7,9 +7,9 @@ concrete IdiomRus of Idiom = CatRus ** open Prelude, ResRus, MorphoRus in {
lin
ExistNP = \bar ->
{s =\\b,clf => case b of
{Pos => verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen bar.a.g) Sg P3)
{Pos => verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen bar.g) Sg P3)
++ bar.s ! PF Nom No NonPoss;
Neg => "не" ++ verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen bar.a.g) Sg P3)
Neg => "не" ++ verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen bar.g) Sg P3)
++ bar.s ! PF Nom No NonPoss
}
} ;
@@ -17,8 +17,8 @@ concrete IdiomRus of Idiom = CatRus ** open Prelude, ResRus, MorphoRus in {
ExistIP Kto =
let { kto = Kto.s ! (PF Nom No NonPoss) } in
{s = \\b,clf,_ => case b of
{Pos => kto ++ verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen Kto.a.g) Sg P3) ;
Neg => kto ++ "не" ++ verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen Kto.a.g) Sg P3)
{Pos => kto ++ verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen Kto.g) Sg P3) ;
Neg => kto ++ "не" ++ verbSuchestvovat.s ! (getActVerbForm clf (pgen2gen Kto.g) Sg P3)
}
} ;
@@ -29,7 +29,7 @@ concrete IdiomRus of Idiom = CatRus ** open Prelude, ResRus, MorphoRus in {
CleftNP np rs = {s= \\ b, clf =>
let
ne= case b of {Pos =>[]; Neg =>"не"};
gn = case np.a.n of {Pl => GPl; _=> GSg (pgen2gen np.a.g)}
gn = case np.n of {Pl => GPl; _=> GSg (pgen2gen np.g)}
in
"это" ++ ne ++ np.s ! (PF Nom No NonPoss) ++
rs.s ! gn !Nom!Animate };

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../common:../slavic:prelude
--# -path=.:../abstract:../common:src/prelude
concrete LangRus of Lang =
GrammarRus,

View File

@@ -64,7 +64,7 @@ oper pronYaTu : { s : Case => Str } -> Str -> Person -> Pronoun =
}
} ;
a = {g = PNoGen; n = Sg; p = pers};
g = PNoGen ; n = Sg ; p = pers ; pron = True
} ;
oper pronNAfterPrep : Pronoun -> Pronoun = \p ->
@@ -73,7 +73,7 @@ oper pronNAfterPrep : Pronoun -> Pronoun = \p ->
x@(("е"|"ё"|"и")+_) => "н"+x;
x => x };
pf => p.s!pf };
a = p.a;
g = p.g ; n = p.n ; p = p.p ; pron = p.pron
} ;
oper pronOn : Pronoun = pronNAfterPrep
@@ -85,7 +85,7 @@ oper pronOn : Pronoun = pronNAfterPrep
PF Inst _ _ => "им" ;
PF (Prepos _) _ _ => "ём"
} ;
a = agrP3 Sg (PGen Masc)
g = PGen Masc ; n = Sg ; p = P3 ; pron = True
} ;
oper pronOna : Pronoun = pronNAfterPrep
@@ -95,7 +95,7 @@ oper pronOna : Pronoun = pronNAfterPrep
PF (Gen|Acc) _ _ => "её" ;
PF (Dat|Inst|Prepos _) _ _ => "ей"
} ;
a = agrP3 Sg (PGen Fem)
g = PGen Fem ; n = Sg ; p = P3 ; pron = True
} ;
oper pronOno: Pronoun =
@@ -103,7 +103,7 @@ oper pronOno: Pronoun =
PF Nom _ NonPoss => "оно" ;
pf => pronOn.s!pf
} ;
a = agrP3 Sg (PGen Neut)
g = PGen Neut ; n = Sg ; p = P3 ; pron = True
} ;
oper pronMuVu : Str -> Str -> Person -> Pronoun =
@@ -138,7 +138,7 @@ oper pronMuVu : Str -> Str -> Person -> Pronoun =
PF Inst _ (Poss GPl) => na + "шими" ;
PF (Prepos _) _ (Poss GPl) => na + "ших"
};
a = {g = PNoGen; n = Pl; p = pers}
g = PNoGen ; n = Pl ; p = pers ; pron = True
} ;
oper pronMu: Pronoun = pronMuVu "мы" "на" P1;
@@ -153,7 +153,7 @@ oper pronOni: Pronoun = pronNAfterPrep
PF (Gen|Acc|Prepos _) _ _ => "их" ;
PF Inst _ _ => "ими"
} ;
a = agrP3 Pl PNoGen
g = PNoGen ; n = Pl ; p = P3 ; pron = True
} ;
oper pronKto: Pronoun =
@@ -165,7 +165,10 @@ oper pronKto: Pronoun =
PF Inst _ _ => "кем" ;
PF (Prepos _) _ _ => "ком"
} ;
a = agrP3 Sg (PGen Masc)
g = PGen Masc;
n = Sg ;
p = P3 ;
pron = False
} ;
oper pronChto: Pronoun =
@@ -177,12 +180,18 @@ oper pronChto: Pronoun =
PF Inst _ _ => "чем" ;
PF (Prepos _) _ _ => "чём"
} ;
a = agrP3 Sg (PGen Masc)
g = PGen Masc;
n = Sg ;
p = P3 ;
pron = False
} ;
oper pron_add_to : Pronoun -> Pronoun = \p ->
{ s = \\pf => (p.s!pf) + "-то" ;
a = p.a
g = p.g ;
n = p.n ;
p = p.p ;
pron = p.pron
} ;
oper pronKtoTo : Pronoun = pron_add_to pronKto ;
@@ -198,8 +207,11 @@ oper pronEti: Pronoun =
PF Inst _ _ => "этими" ;
PF (Prepos _) _ _ => "этих"
} ;
a = agrP3 Pl (PGen Fem) ;
anim = Animate
n = Pl;
p = P3;
g= PGen Fem ;
anim = Animate ;
pron = False
} ;
oper pronTe: Pronoun =
@@ -211,8 +223,11 @@ oper pronTe: Pronoun =
PF Inst _ _ => "теми" ;
PF (Prepos _) _ _ => "тех"
} ;
a = agrP3 Pl (PGen Fem) ;
anim = Animate
n = Pl;
p = P3;
g=PGen Fem ;
anim = Animate ;
pron = False
} ;
@@ -227,7 +242,8 @@ oper pronTe: Pronoun =
-- } ;
-- g = PGen Masc;
-- n = Sg ;
-- p = P3
-- p = P3 ;
-- pron = False
-- } ;
--
--oper pronNichto: Pronoun =
@@ -241,7 +257,8 @@ oper pronTe: Pronoun =
-- } ;
-- g = PGen Masc;
-- n = Sg ;
-- p = P3
-- p = P3 ;
-- pron = False
-- } ;
--
@@ -254,7 +271,10 @@ oper pronVseInanimate: Pronoun =
PF Inst _ _ => "всем" ;
PF (Prepos _) _ _ => "всём"
} ;
a = agrP3 Sg (PGen Neut)
g = PGen Neut;
n = Sg ;
p = P3 ;
pron = False
} ;

View File

@@ -13,36 +13,46 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
_ =>
kazhduj.s ! AF (extCase c) okhotnik.anim (gennum okhotnik.g kazhduj.n) ++
okhotnik.s ! NF kazhduj.n kazhduj.c };
a = agrP3 kazhduj.n (case kazhduj.g of {PNoGen => PGen okhotnik.g; _ => kazhduj.g});
n = kazhduj.n ;
p = P3 ;
pron = False;
g = case kazhduj.g of { PNoGen => (PGen okhotnik.g); _ => kazhduj.g };
anim = okhotnik.anim
} ;
UsePN masha = {
s = \\c => masha.s ! (extCase c);
a = agrP3 Sg (PGen masha.g);
anim = masha.anim;
nComp = Sg
} ;
s = \\c => masha.s ! (extCase c) ;
p = P3; g = PGen masha.g ; anim = masha.anim ;
n = Sg; nComp = Sg; pron = False} ;
UsePron p = p ** {anim = Inanimate};
PredetNP pred np = {
s = \\pf => pred.s! (AF (extCase pf) np.anim (gennum (pgen2gen np.a.g) np.a.n))++ np.s ! pf ;
a = np.a;
anim = np.anim
s = \\pf => pred.s! (AF (extCase pf) np.anim (gennum (pgen2gen np.g) np.n))++ np.s ! pf ;
n = np.n;
p = np.p;
g = np.g;
anim = np.anim;
pron = np.pron
} ;
PPartNP np v2 = {
s = \\pf => np.s ! pf ++ v2.s ! VFORM Act VINF ;
-- no participles in the Verbum type as they behave as adjectives
a = np.a;
anim = np.anim
n = np.n;
p = np.p;
g = np.g;
anim = np.anim;
pron = np.pron
} ;
AdvNP np adv = {
s = \\pf => np.s ! pf ++ adv.s ;
a = np.a;
anim = np.anim
n = np.n;
p = np.p;
g = np.g;
anim = np.anim;
pron = np.pron
} ;
-- 1.4 additions AR 17/6/2008
@@ -53,7 +63,10 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
anim = Inanimate ;
in {
s = \\c => kazhduj.s ! AF (extCase c) anim (gennum g kazhduj.n) ;
a = agrP3 kazhduj.n (case kazhduj.g of {PNoGen => (PGen g); _ => kazhduj.g}) ;
n = kazhduj.n ;
p = P3 ;
pron = False;
g = case kazhduj.g of { PNoGen => (PGen g); _ => kazhduj.g };
anim = anim
} ;
@@ -89,7 +102,10 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
MassNP okhotnik = {
s = \\c => okhotnik.s ! NF Sg (extCase c) ;
a = agrP3 Sg (PGen okhotnik.g) ;
n = Sg ;
p = P3 ;
pron = False;
g = PGen okhotnik.g ;
anim = okhotnik.anim
} ;
{-
@@ -97,7 +113,10 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
s = \\c => -- art case always Nom (AR 17/6/2008)
kazhduj.s ! AF (extCase c) okhotnik.anim (gennum okhotnik.g Sg) ++
okhotnik.s ! Sg ! (extCase c) ;
a = agrP3 Sg (case kazhduj.g of {PNoGen => PGen okhotnik.g; _ => kazhduj.g}) ;
n = Sg ;
p = P3 ;
pron = False;
g = case kazhduj.g of { PNoGen => (PGen okhotnik.g); _ => kazhduj.g };
anim = okhotnik.anim
} ;
@@ -105,7 +124,10 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
s = \\c => -- art case always Nom (AR 17/6/2008)
kazhduj.s ! AF (extCase c) okhotnik.anim (gennum okhotnik.g Pl) ++
okhotnik.s ! Pl ! (extCase c) ;
n = agrP3 Pl (case kazhduj.g of {PNoGen => PGen okhotnik.g; _ => kazhduj.g}) ;
n = Pl ;
p = P3 ;
pron = False;
g = case kazhduj.g of { PNoGen => (PGen okhotnik.g); _ => kazhduj.g };
anim = okhotnik.anim
} ;
-}
@@ -142,8 +164,11 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
-- of the readings is meaningful.
ComplN2 f x = {
s = \\nf => f.s ! nf ++ f.c2.s ++
x.s ! (case nf of {NF n c => mkPronForm f.c2.c Yes (Poss (gennum f.g n))}) ;
s = \\nf => case x.pron of {
True => x.s ! (case nf of {NF n c => mkPronForm c No (Poss (gennum f.g n))}) ++ f.s ! nf ;
False => f.s ! nf ++ f.c2.s ++
x.s ! (case nf of {NF n c => mkPronForm f.c2.c Yes (Poss (gennum f.g n))})
};
g = f.g ;
anim = f.anim
} ;
@@ -219,8 +244,11 @@ concrete NounRus of Noun = CatRus ** open ResRus, Prelude, MorphoRus in {
} ;
RelNP np rel = {
s = \\c => np.s ! c ++ rel.s ! (gennum (pgen2gen np.a.g) np.a.n) ! extCase c ! np.anim ;
a = np.a ;
s = \\c => np.s ! c ++ rel.s ! (gennum (pgen2gen np.g) np.n) ! extCase c ! np.anim ;
n = np.n ;
p = np.p ;
pron = np.pron ;
g = np.g ;
anim = np.anim ;
nComp = np.nComp
} ;

View File

@@ -408,7 +408,7 @@ foreign = Foreign; -- +++ MG_UR: added +++
} ** {lock_A = <>};
mkA2 a p c= a ** {s2 = p ; c = c; lock_A2 = <>};
mkA2 a p c= a ** {c2 = {s=p; c=c}; lock_A2 = <>};
-- mkADeg a s = mkAdjDeg a s ** {lock_ADeg = <>}; -- defined in morpho.RusU
-- ap a p = mkAdjPhrase a p ** {lock_AP = <>}; -- defined in syntax module
@@ -454,7 +454,7 @@ foreign = Foreign; -- +++ MG_UR: added +++
VSubj gn => aller.s ! VFORM vox (VSUB gn)
}; t = Present ; a = aller.asp ; w = vox ; lock_V = <>} ;
-}
mkV2 v p cas = v ** {s2 = p ; c = cas; lock_V2 = <>};
mkV2 v p cas = v ** {c2 = {s=p; c=cas}; lock_V2 = <>};
dirV2 v = mkV2 v [] Acc;
@@ -464,7 +464,7 @@ foreign = Foreign; -- +++ MG_UR: added +++
-- We treat so far only the rule in which the ditransitive
-- verb takes both complements to form a verb phrase.
mkV3 v s1 s2 c1 c2 = v ** {s2 = s1; c = c1; s4 = s2; c2=c2; lock_V3 = <>};
mkV3 v s1 s2 c1 c2 = v ** {c2 = {s=s1; c=c1}; c3={s=s2; c=c2}; lock_V3 = <>};
} ;

View File

@@ -29,7 +29,7 @@ concrete QuestionRus of Question = CatRus ** open ResRus, Prelude in {
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
a = ip.a; anim=ip.anim
n = ip.n; p=ip.p; g=ip.g; anim=ip.anim; pron=ip.pron
} ;
IdetCN kakoj okhotnik =
@@ -40,7 +40,10 @@ concrete QuestionRus of Question = CatRus ** open ResRus, Prelude in {
_ =>
kakoj.s ! AF (extCase pf) okhotnik.anim (gennum okhotnik.g kakoj.n) ++
okhotnik.s ! NF kakoj.n kakoj.c };
a = agrP3 kakoj.n kakoj.g ;
n = kakoj.n ;
p = P3 ;
pron = False;
g = kakoj.g ;
anim = okhotnik.anim
} ;
@@ -48,7 +51,10 @@ concrete QuestionRus of Question = CatRus ** open ResRus, Prelude in {
IdetIP kakoj = let anim = Inanimate in
{s = \\pf => kakoj.s ! AF (extCase pf) anim (pgNum kakoj.g kakoj.n) ;
a = agrP3 kakoj.n kakoj.g ;
n = kakoj.n ;
p = P3 ;
pron = False;
g = kakoj.g ;
anim = anim
} ;

View File

@@ -10,7 +10,7 @@ concrete RelativeRus of Relative = CatRus ** open ResRus, MorphoRus in {
takoj.s ! AF c anim gn ++ "что" ++ A.s !b!clf};
RelVP kotoruj gulyaet =
{ s = \\b,clf,gn, c, anim => let { nu = numGNum gn } in
{ s = \\b,clf,gn, c, anim => let { nu = numGenNum gn } in
kotoruj.s ! gn ! c ! anim ++ gulyaet.s2 ++ gulyaet.s ! clf ! gn !P3 ++
gulyaet.s3 ! genGNum gn ! nu
} ;
@@ -26,7 +26,7 @@ concrete RelativeRus of Relative = CatRus ** open ResRus, MorphoRus in {
} ;
FunRP p mama kotoruj =
{s = \\gn,c, anim => let {nu = numGNum gn} in
{s = \\gn,c, anim => let {nu = numGenNum gn} in
mama.s ! PF c No NonPoss ++
p.s ++ kotoruj.s ! gn ! p.c ! anim
} ;

View File

@@ -7,7 +7,7 @@
-- implement $Test$, it moreover contains regular lexical
-- patterns needed for $Lex$.
instance ResRus of ResSlavic = ParamX, DiffRus, CommonSlavic ** open Prelude in {
resource ResRus = ParamX ** open Prelude in {
flags coding=utf8 ; optimize=all ;
@@ -18,6 +18,10 @@ flags coding=utf8 ; optimize=all ;
-- Some parameters, such as $Number$, are inherited from $ParamX$.
param
Gender = Masc | Fem | Neut ;
Case = Nom | Gen | Dat | Acc | Inst | Prepos PrepKind ;
PrepKind = PrepOther | PrepVNa;
Animacy = Animate | Inanimate ;
Voice = Act | Pass ;
Aspect = Imperfective | Perfective ;
RusTense = Present | PastRus | Future ;
@@ -46,6 +50,22 @@ param
-- (a big house - big houses).
-- The plural never makes a gender distinction.
GenNum = GSg Gender | GPl ;
-- Coercions between the compound gen-num type and gender and number:
oper
gennum : Gender -> Number -> GenNum = \g,n ->
case n of {
Sg => GSg g ;
Pl => GPl
} ;
numGenNum : GenNum -> Number = \gn ->
case gn of {
GSg _ => Sg ;
GPl => Pl
} ;
-- The Possessive parameter is introduced in order to describe
-- the possessives of personal pronouns, which are used in the
@@ -75,11 +95,14 @@ param
param PronForm = PF Case AfterPrep Possessive;
oper Pronoun = {s : PronForm => Str; a : Agr} ;
oper Pronoun = { s : PronForm => Str ; n : Number ; p : Person ;
g: PronGen ; pron: Bool} ;
-- Gender is not morphologically determined for first
-- and second person pronouns.
param PronGen = PGen Gender | PNoGen ;
-- The following coercion is useful:
oper
@@ -97,25 +120,24 @@ oper
CommNoun = {s : NForm => Str ; g : Gender ; anim : Animacy } ;
NounPhrase : Type = {s : PronForm => Str; a : Agr; anim : Animacy} ;
NounPhrase : Type = { s : PronForm => Str ; n : Number ;
p : Person ; g: PronGen ; anim : Animacy ; pron: Bool} ;
mkNP : Number -> CommNoun -> NounPhrase = \n,chelovek ->
{s = \\cas => chelovek.s ! NF n (extCase cas) ;
a = agrP3 n (PGen chelovek.g);
n = n ; g = PGen chelovek.g ; p = P3 ; pron =False ;
anim = chelovek.anim
} ;
det2NounPhrase : Adjective -> NounPhrase = \eto ->
{s = \\pf => eto.s ! AF (extCase pf) Inanimate (GSg Neut); a = agrP3 Sg (PGen Neut); anim = Inanimate} ;
{s = \\pf => eto.s ! (AF (extCase pf) Inanimate (GSg Neut)); n = Sg ; g = PGen Neut ; pron = False ; p = P3 ; anim = Inanimate } ;
pron2NounPhraseNum : Pronoun -> Animacy -> Number -> NounPhrase =
\ona, anim, num -> {
s = ona.s;
a = {n = num; p = ona.a.p; g = ona.a.g};
anim = anim
} ;
pron2NounPhraseNum : Pronoun -> Animacy -> Number -> NounPhrase = \ona, anim, num ->
{s = ona.s ; n = num ; g = ona.g ;
pron = ona.pron; p = ona.p ; anim = anim } ;
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
-- oper Agr = {n : Number ; p : Person} ;
@@ -207,24 +229,21 @@ Prep =>"себе"};
-- 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*.
SlashNounPhrase = Clause ** Complement ;
SlashNounPhrase = Clause ** {c2 : Complement} ;
Clause = {s : Polarity => ClForm => Str} ;
-- This is the traditional $S -> NP VP$ rule.
predVerbPhrase : NounPhrase -> VerbPhrase -> SlashNounPhrase =
\Ya, tebyaNeVizhu -> { s = \\b,clf =>
let
{ ya = Ya.s ! (mkPronForm Nom No NonPoss);
khorosho = tebyaNeVizhu.s2;
vizhu = tebyaNeVizhu.s ! clf !(gennum (pgen2gen Ya.a.g) Ya.a.n)! Ya.a.p;
tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.a.g) ! Ya.a.n
}
in
ya ++ khorosho ++ vizhu ++ tebya;
s2= "";
c = Nom
} ;
\Ya, tebyaNeVizhu -> {
s = \\b,clf => let { ya = Ya.s ! (mkPronForm Nom No NonPoss);
khorosho = tebyaNeVizhu.s2;
vizhu = tebyaNeVizhu.s ! clf !(gennum (pgen2gen Ya.g) Ya.n)! Ya.p;
tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.g) ! Ya.n
}
in ya ++ khorosho ++ vizhu ++ tebya;
c2 = {s = ""; c = Nom}
} ;
-- Questions are either direct ("Ты счастлив?")
-- or indirect ("Потом он спросил счастлив ли ты").
@@ -264,7 +283,7 @@ param
AdjForm = AF Case Animacy GenNum | AFShort GenNum | AdvF;
oper
Complement = {s2 : Str ; c : Case} ;
Complement = {s : Str ; c : Case} ;
oper Refl ={s: Case => Str};
oper sam: Refl=
@@ -281,21 +300,16 @@ oper sam: Refl=
pgNum : PronGen -> Number -> GenNum = \g,n ->
case n of
{ Sg => GSg (pgen2gen g) ; -- assuming pronoun "I" is a male
Pl => GPl
Pl => GPl
} ;
-- _ => variants {GSg Masc ; GSg Fem} } ;
-- "variants" version cause "no term variants" error during linearization
oper numGNum : GenNum -> Number = \gn ->
case gn of { GPl => Pl ; _ => Sg } ;
oper genGNum : GenNum -> Gender = \gn ->
case gn of { GSg Fem => Fem; GSg Masc => Masc; _ => Neut } ;
oper numAF: AdjForm -> Number = \af ->
case af of { AdvF => Sg; AFShort gn => numGNum gn; AF _ _ gn => (numGNum gn) } ;
case af of { AdvF => Sg; AFShort gn => numGenNum gn; AF _ _ gn => (numGenNum gn) } ;
oper genAF: AdjForm -> Gender = \af ->
case af of { AdvF => Neut; AFShort gn => genGNum gn; AF _ _ gn => (genGNum gn) } ;

View File

@@ -15,9 +15,9 @@ concrete SentenceRus of Sentence = CatRus ** open Prelude, ResRus in {
_ => (mkPronForm Nom No NonPoss)
});
ne = case b of {Pos=>""; Neg=>"не"};
vizhu = tebyaNeVizhu.s ! clf ! (pgNum Ya.a.g Ya.a.n)! Ya.a.p;
vizhu = tebyaNeVizhu.s ! clf ! (pgNum Ya.g Ya.n)! Ya.p;
khorosho = tebyaNeVizhu.s2 ;
tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.a.g) ! Ya.a.n
tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.g) ! Ya.n
}
in
if_then_else Str tebyaNeVizhu.negBefore
@@ -48,9 +48,9 @@ concrete SentenceRus of Sentence = CatRus ** open Prelude, ResRus in {
_ => (mkPronForm Nom No NonPoss)
});
ne = case b of {Pos=>""; Neg=>"не"};
vizhu = tebyaNeVizhu.s ! clf ! (pgNum Ya.a.g Ya.a.n)! Ya.a.p;
vizhu = tebyaNeVizhu.s ! clf ! (pgNum Ya.g Ya.n)! Ya.p;
khorosho = tebyaNeVizhu.s2 ;
tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.a.g) ! Ya.a.n
tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.g) ! Ya.n
}
in
if_then_else Str tebyaNeVizhu.negBefore
@@ -71,7 +71,7 @@ concrete SentenceRus of Sentence = CatRus ** open Prelude, ResRus in {
--- AR 3/11/2007
SlashVS ivan vidit tuUlubaeshsya = {
s=\\b,clf => ivan.s ! PF Nom No NonPoss ++
vidit.s! (getActVerbForm clf (pgen2gen ivan.a.g) ivan.a.n ivan.a.p) ++
vidit.s! (getActVerbForm clf (pgen2gen ivan.g) ivan.n ivan.p) ++
[", что"] ++ tuUlubaeshsya.s ;
s2=tuUlubaeshsya.s2;
c=tuUlubaeshsya.c

View File

@@ -30,7 +30,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
} --case p
}; --case gn
ClCondit => "" ;
ClImper => case (numGNum gn) of
ClImper => case (numGenNum gn) of
{Sg => "будь" ++ masha.s ! (mkPronForm Inst No NonPoss);
Pl => "будьте" ++ masha.s ! (mkPronForm Inst No NonPoss)
};
@@ -133,7 +133,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
-- double negations with "inte" are not grammatical.
UseV se =
{s=\\clf,gn,p => se.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ;
{s=\\clf,gn,p => se.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ;
asp = se.asp ;
w=Act;
s2 = "";
@@ -143,14 +143,14 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
-- The rule for using transitive verbs is the complementization rule:
SlashV2a se =
{s = \\clf,gn,p => se.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ;
{s = \\clf,gn,p => se.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ;
asp = se.asp ;
w = Act;
s2 = "";
s3 = \\g,n => "";
negBefore = True ;
sc = se.s2 ;
c = se.c
sc = se.c2.s ;
c = se.c2.c
} ;
ComplSlash se tu =
@@ -165,68 +165,68 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
Slash2V3 dat tu =
let
tebepivo = dat.s2 ++ tu.s ! PF dat.c No NonPoss ++ dat.s4 ;
tebepivo = dat.c2.s ++ tu.s ! PF dat.c2.c No NonPoss ++ dat.c3.s ;
in
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ++ tebepivo ;
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ++ tebepivo ;
asp = dat.asp ;
w = Act;
negBefore = True;
s2 = "";
s3 = \\g,n=> "" ;
sc = dat.s4 ;
c = dat.c2
sc = dat.c3.s ;
c = dat.c3.c
} ;
Slash3V3 dat pivo =
let
tebepivo = dat.s4 ++ pivo.s ! PF dat.c2 Yes NonPoss
tebepivo = dat.c3.s ++ pivo.s ! PF dat.c3.c Yes NonPoss
in
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ++ tebepivo ;
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ++ tebepivo ;
asp = dat.asp ;
w = Act;
negBefore = True;
s2 = "";
s3 = \\g,n=> "" ;
sc = dat.s2 ;
c = dat.c
sc = dat.c2.s ;
c = dat.c2.c
} ;
---- AR 17/12/2008
SlashV2Q dat esliOnPridet =
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ++ esliOnPridet.s ! QDir ;
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ++ esliOnPridet.s ! QDir ;
asp = dat.asp ;
w = Act;
negBefore = True;
s2 = "";
s3 = \\g,n=> "" ;
sc = dat.s2 ;
c = dat.c
sc = dat.c2.s ;
c = dat.c2.c
} ;
---- AR 17/12/2008
SlashV2S vidit tuUlubaeshsya =
{s = \\clf,gn,p => vidit.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p)
{s = \\clf,gn,p => vidit.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p)
++ [", что"] ++ tuUlubaeshsya.s ;
asp = vidit.asp;
w = Act;
s2="";
negBefore = True;
s3 = \\g,n => "" ;
sc = vidit.s2 ;
c = vidit.c
sc = vidit.c2.s ;
c = vidit.c2.c
} ;
---- AR 17/12/2008
SlashV2V putatsya bezhat =
{ s = \\clf,gn,p => putatsya.s ! (getActVerbForm clf (genGNum gn)
(numGNum gn) p) ++ bezhat.s!ClInfinit !gn!p ;
(numGenNum gn) p) ++ bezhat.s!ClInfinit !gn!p ;
asp = putatsya.asp ;
w = Act;
negBefore = True;
s2 = "";
s3 =\\g,n => "" ;
sc = putatsya.s2 ;
c = putatsya.c
sc = putatsya.c2.s ;
c = putatsya.c2.c
} ;
---- AR 17/12/2008
@@ -242,7 +242,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
---- AR 17/12/2008
SlashVV putatsya bezhat =
{ s = \\clf,gn,p => putatsya.s ! (getActVerbForm clf (genGNum gn)
(numGNum gn) p) ++ bezhat.s!ClInfinit !gn!p ;
(numGenNum gn) p) ++ bezhat.s!ClInfinit !gn!p ;
asp = putatsya.asp ;
w = Act;
negBefore = True;
@@ -255,8 +255,8 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
---- AR 17/12/2008
SlashV2VNP putatsya np bezhat =
{ s = \\clf,gn,p =>
putatsya.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ++
np.s ! (mkPronForm putatsya.c No NonPoss) ++ ---- ?
putatsya.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ++
np.s ! (mkPronForm putatsya.c2.c No NonPoss) ++ ---- ?
bezhat.s!ClInfinit !gn!p ;
asp = putatsya.asp ;
w = Act;
@@ -270,7 +270,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
-- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет":
ComplVS vidit tuUlubaeshsya =
{s = \\clf,gn,p => vidit.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p)
{s = \\clf,gn,p => vidit.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p)
++ [", что"] ++ tuUlubaeshsya.s ;
asp = vidit.asp;
w = Act;
@@ -286,7 +286,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
ComplVV putatsya bezhat =
{ s = \\clf,gn,p => putatsya.s ! (getActVerbForm clf (genGNum gn)
(numGNum gn) p) ++ bezhat.s!ClInfinit !gn!p ;
(numGenNum gn) p) ++ bezhat.s!ClInfinit !gn!p ;
asp = putatsya.asp ;
w = Act;
negBefore = True;
@@ -294,7 +294,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
s3 =\\g,n => ""
} ;
ComplVQ dat esliOnPridet =
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ++ esliOnPridet.s ! QDir ;
{s = \\clf,gn,p => dat.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ++ esliOnPridet.s ! QDir ;
asp = dat.asp ;
w = Act;
negBefore = True;
@@ -302,7 +302,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
s3 = \\g,n=> ""
} ;
ComplVA vuglyadet molodoj =
{s = \\clf,gn,p => vuglyadet.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ;
{s = \\clf,gn,p => vuglyadet.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ;
asp = vuglyadet.asp ;
w = Act;
negBefore = True;
@@ -312,7 +312,7 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
SlashV2A obechat molodoj =
{s = \\clf,gn,p =>
obechat.s ! (getActVerbForm clf (genGNum gn) (numGNum gn) p) ++
obechat.s ! (getActVerbForm clf (genGNum gn) (numGenNum gn) p) ++
molodoj.s ! AF Inst Inanimate (GSg Neut) ;
---- AR 17/6; AF Inst tu.anim (pgNum tu.g tu.n) ;
asp = obechat.asp ;
@@ -320,8 +320,8 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
negBefore = True;
s2 = "";
s3 = \\g,n =>"" ;
sc = obechat.s2 ;
c = obechat.c
sc = obechat.c2.s ;
c = obechat.c2.c
} ;
AdvVP poet khorosho =
@@ -333,8 +333,8 @@ concrete VerbRus of Verb = CatRus ** open ResRus, Prelude in {
asp = poet.asp; w = poet.w; t = poet.t ; negBefore = poet.negBefore } ;
PassV2 se =
{s=\\clf,gn,p => se.s ! (getPassVerbForm clf (genGNum gn) (numGNum gn) p) ;
asp=se.asp; w=Pass; s2 = se.s2;
{s=\\clf,gn,p => se.s ! (getPassVerbForm clf (genGNum gn) (numGenNum gn) p) ;
asp=se.asp; w=Pass; s2 = se.c2.s;
negBefore = True;
s3 = table{_=> table{_ => ""}}
};