1
0
forked from GitHub/gf-core

*** empty log message ***

This commit is contained in:
janna
2004-12-29 22:47:51 +00:00
parent 7eb83ba64e
commit 19b6423d6e
8 changed files with 325 additions and 199 deletions

View File

@@ -1,2 +1,4 @@
--# -path=.:../abstract:../../prelude
concrete AllResourceRus of AllResource = RulesRus, StructuralRus ** {} ;

View File

@@ -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} ;
}

View File

@@ -918,7 +918,7 @@ oper totDet: Adjective = {s = table {
kakojDet: Adjective = i_oj_EndDecl "как" [];
nikakojDet: Adjective = i_oj_EndDecl "никак" [];
bolshinstvoSgDet: Adjective = extAdjFromSubst (oEnd_SgDecl "большинств");
mnogoSgDet: Adjective = extAdjFromSubst (kg_oEnd_SgDecl "мног");
mnogoSgDet: Adjective = extAdjFromSubst (kg_oEnd_SgDecl "мног");
skolkoSgDet: Adjective = extAdjFromSubst (kg_oEnd_SgDecl "скольк");
bolshinstvoPlDet: Adjective = extAdjFromSubst (oEnd_PlDecl "большинств");
@@ -1003,7 +1003,7 @@ oper uy_j_EndDecl : Str -> Adjective = \s ->{s = table {
oper vesDet: Adjective = {s = table {
AF Nom _ (ASg Masc) => "весь";
AF Nom _ (ASg Fem) => "вся";
AF Nom _ APl => "все";
AF Nom _ (ASg Neut) => "всё";
AF Nom _ APl => "все";
AF Acc Animate (ASg Masc) => "весь";
AF Acc Inanimate (ASg Masc) => "всего";
@@ -1343,26 +1343,26 @@ oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv ->
PSF APl => ["были "] + del + "ны"
};
-- "verbDecl" sorts out verbs according to the aspect and voice parameters.
-- It produces the full conjugation table for a verb entry
\a, c, del, sgP1End, sgMascPast, imperSgP2, inf -> case a of
oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum =
\a, c, del, sgP1End, sgMascPast, imperSgP2, inf -> case a of
FirstE => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Second => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Mixed => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Dolzhen => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast)
} ;
Imperfective => case c of {
First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
FirstE => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Second => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Mixed => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast) ;
Dolzhen => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast)
}
};
-- for verbs like "мочь" ("can") with changing consonants (first conjugation):
{ Perfective => case c of {
First => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
FirstE => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Second => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Mixed => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Dolzhen => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast)
} ;
Imperfective => case c of {
First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
FirstE => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Second => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Mixed => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast) ;
Dolzhen => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast)
}
};
-- for verbs like "мочь" ("can") with changing consonants (first conjugation):
-- "могу - можешь"
@@ -1385,23 +1385,23 @@ oper
} ;
asp = av1.asp
};
"а" ; "е" ; "ё" ; "и" ; "о" ; "у" ;
"ы" ; "э" ; "ю" ; "я"
} ;
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) +"сь";
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 P3 => av.s ! (VIMP Pl P3) +"ся";
VSUB (ASg Masc) => pv ! (PSF (ASg Masc)) + "ся"+[" бы"];
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)) + "сь"+[" бы"];
@@ -1420,22 +1420,20 @@ oper
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 (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
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
};
-- Generation the imperfective active pattern given
-- a number of basic conjugation forms.

View File

@@ -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 ;
} ;

View File

@@ -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 "когда" ;

View File

@@ -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
-- The rule for using transitive verbs is the complementization rule:
complTransVerb :TransVerb -> NounPhrase -> VerbGroup = \se,tu ->
a = se.a ; t = se.t ; w = se.w } ;
{s =\\vf => se.s ! vf ++ se.s2 ++ tu.s ! (mkPronForm se.c No NonPoss) ;
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
-- 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
VerbGroup = Verb ;
VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
-- to account for word order variations.
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.
predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vidit ->
vidit ** {
s2 = negation b ;
s3 = \\_,_ => [] ;
negBefore = True -- this should be a parameter !
} ;
-- There are two versions, depending on if we want to negate the verb.
-- 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
-- "Я не - волшебник". Alternatively, we can consider verb-based VP and
-- all the rest.
{ 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
predAdverb : Adverb -> VerbGroup = \zloj ->
{ 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{_ => ""}}
} ;
@@ -500,7 +495,7 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
-- verb takes both complements to form a verb phrase.
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 } ;
@@ -509,10 +504,12 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
let
tebepivo = dat.s2 ++
tu.s ! PF dat.c No NonPoss ++ dat.s4 ++ pivo.s ! PF dat.c2 Yes NonPoss
{s = \\vf => (dat.s ! vf) ++ tebepivo ;
t = dat.t ;
a = dat.a ;
w = dat.w
in
{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
vizhu = tebyaNeVizhu.s ! VFin (pgNum Ya.g Ya.n) Ya.p;
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.
\b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b (complTransVerb vizhu tu)) ;
predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
\b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b Present (complTransVerb vizhu tu)) ;
--3 Sentence-complement verbs
--
SentenceVerb : Type = Verb ;
-- Sentence-complement verbs take sentences as complements.
SentenceVerb : Type = Verbum ;
-- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет":
complSentVerb : SentenceVerb -> Sentence -> VerbGroup =
t = vidit.t ; w = vidit.w ; a = vidit.a } ;
\vidit,tuUlubaeshsya ->
{s = \\vf => vidit.s ! vf ++ [", что"] ++ tuUlubaeshsya.s ;
asp = vidit.asp;
w = Act;
s2 = table{True => ""; False => "не"};
negBefore = True;
s3 = table{_=> table{_ => ""}}
} ;
@@ -605,17 +632,19 @@ oper
-- API and leads to some anomalies in English, such as the necessity
-- to create the infinitive form "to be able to" for "can" so that
-- the construction can be iterated, and the corresponding complication
VerbVerb : Type = Verb ;
-- in the parameter structure.
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.
{ s = \\vf => putatsya.s ! vf ++ bezhat.s ! VInf ;
t = putatsya.t ;
a = putatsya.a ;
w = putatsya.w
complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \putatsya,bezhat ->
{ 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{_ => ""}}
} ;
@@ -632,7 +661,11 @@ oper
SentenceSlashNounPhrase = Sentence ** Complement ;
predVerbPhrase ivan (predVerbGroup b (verbOfTransVerb lubit)) **
slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase =
\b,ivan,lubit ->
predVerbPhrase ivan (predVerbGroup b Present ((verbOfTransVerb lubit)**
{ s2 = table{True => ""; False => "не"};
w = Act;
negBefore = True;
s3 = table{_=> table{_ => ""}} })) **
complementOfTransVerb lubit ;
@@ -721,7 +754,7 @@ oper
funIntPron : Function -> NounPhrase -> NounPhrase = \detstvo, ivan ->
indefNounPhrase ivan.n (appFunComm detstvo ivan) ; -- detstvoIvana
-- appFun False ;
-- bug version:
-- funIntPron : Function -> IntPron -> IntPron =
-- appFun False ;
@@ -816,7 +849,7 @@ oper
DirQ => vu ++ spish ;
IndirQ => spish ++ "ли" ++ vu
}
questVerbPhrase
} ;
isThere : NounPhrase -> Question = \bar ->
questVerbPhrase
@@ -1044,4 +1077,86 @@ isThere : NounPhrase -> Question = \bar ->
defaultNounPhrase : NounPhrase -> SS = \masha ->
ss (masha.s ! PF Nom No NonPoss) ;
defaultQuestion : Question -> SS = \ktoTu ->
ss (ktoTu.s ! DirQ) ;
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 => "не"};

View File

@@ -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 ;

View File

@@ -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 ;