*** 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 ** {} ; concrete AllResourceRus of AllResource = RulesRus, StructuralRus ** {} ;

View File

@@ -54,21 +54,22 @@ lincat
Num = Numeral ; Num = Numeral ;
-- = {s : Case => Gender => Str} ; -- = {s : Case => Gender => Str} ;
V = Verb ; V = Verbum ;
-- = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ; -- = {s : VerbForm => Str ; asp : Aspect } ;
VG = VerbGroup ; VG = VerbGroup ;
-- = Verb ; -- = Verbum ** { w: Voice; s2 : Bool => Str ;
-- s3 : Gender => Number => Str ; negBefore: Bool} ;
VP = VerbPhrase ; VP = VerbPhrase ;
-- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ; -- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
-- negBefore: Bool} ; -- negBefore: Bool} ;
V2 = TransVerb ; V2 = TransVerb ;
-- = Verb ** {s2 : Str ; c: Case } ; -- = Verbum ** {s2 : Str ; c: Case } ;
V3 = DitransVerb ; V3 = DitransVerb ;
-- = TransVerb ** {s4 : Str; c2: Case} ; -- = TransVerb ** {s4 : Str; c2: Case} ;
VS = SentenceVerb ; VS = SentenceVerb ;
-- = Verb ; -- = Verbum ;
VV = VerbVerb ; VV = VerbVerb ;
-- = Verb ; -- = Verbum ;
AdV = Adverb ; AdV = Adverb ;
@@ -110,10 +111,9 @@ lincat
-- = { s1,s2 : PronForm => Str ; g: Gender ; anim : Animacy ; -- = { s1,s2 : PronForm => Str ; g: Gender ; anim : Animacy ;
-- n : Number ; p : Person ; pron : Bool } ; -- n : Number ; p : Person ; pron : Bool } ;
-- From CombinationsRus: Text = {s : Str} ; PP = Adverb ;
-- From Swedish: PP = Adverb ; Cl = Clause ;
-- From Swedish: Cl = Clause ; -- = {s : Bool => ClForm => Str} ;
-- = {s : Bool => SForm => Order => Str} ;
} }

View File

@@ -1343,26 +1343,26 @@ oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv ->
PSF APl => ["были "] + 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 -- 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 = oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum =
\a, c, del, sgP1End, sgMascPast, imperSgP2, inf -> case a of \a, c, del, sgP1End, sgMascPast, imperSgP2, inf -> case a of
FirstE => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast); { Perfective => case c of {
Second => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast); First => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Mixed => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast); FirstE => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Dolzhen => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen 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);
Imperfective => case c of { Dolzhen => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast)
First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast); } ;
FirstE => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast); Imperfective => case c of {
Second => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast); First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Mixed => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast) ; FirstE => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
Dolzhen => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen 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): };
-- for verbs like "мочь" ("can") with changing consonants (first conjugation): -- for verbs like "мочь" ("can") with changing consonants (first conjugation):
-- "могу - можешь" -- "могу - можешь"
@@ -1385,23 +1385,23 @@ oper
} ; } ;
asp = av1.asp asp = av1.asp
}; };
"а" ; "е" ; "ё" ; "и" ; "о" ; "у" ;
"ы" ; "э" ; "ю" ; "я" vowels : Strs = strs {
} ; "а" ; "е" ; "ё" ; "и" ; "о" ; "у" ;
"ы" ; "э" ; "ю" ; "я"
oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv -> } ;
{ s = table {
VINF => av.s ! VINF + "ся"; oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv ->
VIMP Sg P1 => av.s ! (VIMP Sg P1) +"сь" ; { s = table {
VIMP Pl P1 => av.s ! (VIMP Pl P1) +"ся"; VINF => av.s ! VINF + "ся";
VIMP Sg P1 => av.s ! (VIMP Sg P1) +"сь" ;
VIMP Sg P2 => av.s ! (VIMP Sg P2 ) +"сь"; VIMP Pl P1 => av.s ! (VIMP Pl P1) +"ся";
VIMP Pl P2 => av.s! (VIMP Pl P2) +"сь";
VIMP Sg P2 => av.s ! (VIMP Sg P2 ) +"сь"; VIMP Sg P2 => av.s ! (VIMP Sg P2 ) +"сь";
VIMP Pl P2 => av.s! (VIMP Pl P2) +"сь";
VIMP Pl P3 => av.s ! (VIMP Pl P3) +"ся"; VIMP Sg P3 => av.s ! (VIMP Sg P3) +"ся";
VSUB (ASg Masc) => pv ! (PSF (ASg Masc)) + "ся"+[" бы"]; VIMP Pl P3 => av.s ! (VIMP Pl P3) +"ся";
VSUB (ASg Masc) => pv ! (PSF (ASg Masc)) + "ся"+[" бы"]; VSUB (ASg Masc) => pv ! (PSF (ASg Masc)) + "ся"+[" бы"];
VSUB (ASg Fem) => pv ! (PSF (ASg Fem)) + "сь"+[" бы"]; VSUB (ASg Fem) => pv ! (PSF (ASg Fem)) + "сь"+[" бы"];
@@ -1420,22 +1420,20 @@ oper
VIND APl (VPresent P3) => av.s !( VIND APl (VPresent P3)) + "ся" ; VIND APl (VPresent P3) => av.s !( VIND APl (VPresent P3)) + "ся" ;
VIND (ASg _) (VFuture P1) => av.s ! (VIND (ASg Masc) (VFuture P1)) + "сь"; 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 P2) => av.s! (VIND (ASg Masc) (VFuture P2) )+ "ся";
VIND (ASg _) (VFuture P3) => av.s! (VIND (ASg Masc) (VFuture P3)) + "ся";
VIND (VFuture Pl P2) => av.s! (VIND (VFuture Pl P2) )+ "сь"; VIND APl (VFuture P1) => av.s! (VIND APl (VFuture P1) )+ "ся";
VIND (VFuture Pl P3) => av.s! (VIND (VFuture Pl P3)) + "ся";
VIND (VPast (ASg Masc)) => av.s ! (VIND (VPast (ASg Masc) )) + "ся"; VIND APl (VFuture P2) => av.s! (VIND APl (VFuture P2) )+ "сь";
VIND (VPast (ASg Fem)) => av.s ! (VIND (VPast (ASg Fem) )) + "сь"; VIND APl (VFuture P3) => av.s! (VIND APl (VFuture P3)) + "ся";
VIND (VPast (ASg Neut)) => av.s ! (VIND (VPast (ASg Neut)) ) + "сь"; VIND (ASg Masc) VPast => av.s ! (VIND (ASg Masc) VPast ) + "ся";
VIND (VPast APl) => av.s ! (VIND (VPast APl)) + "сь" VIND (ASg Fem) VPast => av.s ! (VIND (ASg Fem) VPast ) + "сь";
} ; VIND (ASg Neut) VPast => av.s ! (VIND (ASg Neut) VPast) + "сь";
asp = av.asp VIND APl VPast => av.s ! (VIND APl VPast ) + "сь"
} ;
}; asp = av.asp
-- Generation the imperfective active pattern given };
-- a number of basic conjugation forms.
oper
-- Generation the imperfective active pattern given -- Generation the imperfective active pattern given
-- a number of basic conjugation forms. -- a number of basic conjugation forms.

View File

@@ -1,9 +1,10 @@
--# -path=.:../abstract:../../prelude
concrete RulesRus of Rules = CategoriesRus ** open Prelude, SyntaxRus in { concrete RulesRus of Rules = CategoriesRus ** open Prelude, SyntaxRus in {
lin lin
UsePN = nameNounPhrase ; UsePN = nameNounPhrase ;
ComplAdj = complAdj ; ComplA2 = complAdj ;
PredVP = predVerbPhrase ; PredVP = predVerbPhrase ;
UseA1 = adj2adjPhrase ; UseA1 = adj2adjPhrase ;
ModAdj = modCommNounPhrase ; ModAdj = modCommNounPhrase ;
@@ -17,14 +18,6 @@ lin
ComparADeg = comparAdjPhrase ; ComparADeg = comparAdjPhrase ;
SuperlNP = superlNounPhrase ; 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 ; CNthatS = nounThatSentence ;
UseInt i = useInt i.s; UseInt i = useInt i.s;
NoNum = noNum ; NoNum = noNum ;
@@ -45,25 +38,20 @@ lin
DefNumNP = indefNounPhraseNum Pl ; DefNumNP = indefNounPhraseNum Pl ;
MassNP = indefNounPhrase Sg; MassNP = indefNounPhrase Sg;
PosVG = predVerbGroup True ; PosVG = predVerbGroup True Present ;
NegVG = predVerbGroup False ; NegVG = predVerbGroup False Present ;
PredV v = v ; -- From Swedish: PredV = predVerb ; PredV = predVerb ;
PredAP = predAdjective ; PredAP = predAdjective ;
PredCN = predCommNoun ; PredCN = predCommNoun ;
PredV2 = complTransVerb ; PredV2 = complTransVerb ;
PredV3 = complDitransVerb ; PredV3 = complDitransVerb ;
PredPassV v = v ; PredPassV = predPassVerb ;
PredNP = predNounPhrase ; PredNP = predNounPhrase ;
PredAdV = predAdverb ; PredPP = predAdverb ;
PredVS = complSentVerb ; PredVS = complSentVerb ;
PredVV = complVerbVerb ; PredVV = complVerbVerb ;
VTrans = verbOfTransVerb ; VTrans = verbOfTransVerb ;
--From Swedish:
--PredVP = predVerbPhrase ;
--PredVG = predVerbGroupClause ;
--PredSuperl a = predAdjective (superlAdjPhrase a) ;
AdjAdv a = mkAdverb (a.s ! AdvF) ; AdjAdv a = mkAdverb (a.s ! AdvF) ;
PrepNP p = prepPhrase p ; PrepNP p = prepPhrase p ;
@@ -71,11 +59,9 @@ lin
--LocNP = locativeNounPhrase ; --LocNP = locativeNounPhrase ;
AdvCN = advCommNounPhrase ; AdvCN = advCommNounPhrase ;
AdvAP = advAdjPhrase ; AdvAP = advAdjPhrase ;
--From Swedish: AdvPP p = p ;
PosSlashV2 = slashTransVerb True ;
PosSlashTV = slashTransVerb True ; NegSlashV2 = slashTransVerb False ;
NegSlashTV = slashTransVerb False ;
OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ; OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ;
ThereNP = thereIs ; ThereNP = thereIs ;
@@ -102,8 +88,6 @@ lin
ImperVP = imperVerbPhrase ; ImperVP = imperVerbPhrase ;
-- From Swedish: PrepS p = ss (p.s ++ ",") ;
IndicPhrase = indicUtt ; IndicPhrase = indicUtt ;
QuestPhrase = interrogUtt ; QuestPhrase = interrogUtt ;
ImperOne = imperUtterance Masc Sg ; ImperOne = imperUtterance Masc Sg ;
@@ -138,5 +122,17 @@ lin
OnePhr p = p ; OnePhr p = p ;
ConsPhr = cc2 ; 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 ; SomethingNP = pron2NounPhrase pronChtoTo Inanimate ;
NothingNP = pron2NounPhrase pronNichto Inanimate; NothingNP = pron2NounPhrase pronNichto Inanimate;
CanVV = extVerb verbMoch Act Present ; CanVV = verbMoch ;
CanKnowVV = extVerb verbMoch Act Present ; CanKnowVV = verbMoch ;
MustVV = extVerb verbDolzhen Act Present ; MustVV = verbDolzhen ;
WantVV = extVerb verbKhotet Act Present ; WantVV = verbKhotet ;
HowIAdv = ss "как" ; HowIAdv = ss "как" ;
WhenIAdv = ss "когда" ; WhenIAdv = ss "когда" ;

View File

@@ -248,6 +248,13 @@ pgNum : PronGen -> Number -> GenNum = \g,n ->
g = PGen dom.g 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 --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 -- ("купить хлеба", "не читать газет") are overlooked in mkDirectVerb
-- and can be expressed via more a general rule mkTransVerb. -- 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} ; complementOfTransVerb : TransVerb -> Complement = \v -> {s2 = v.s2 ; c = v.c} ;
verbOfTransVerb : TransVerb -> Verb = \v -> verbOfTransVerb : TransVerb -> Verbum = \v ->
{s = v.s; t = v.t; a = v.a ; w = v.w } ; {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 } ; v ** {s2 = p ; c = cas } ;
mkDirectVerb : Verb -> TransVerb = \v -> mkDirectVerb : Verbum -> TransVerb = \v ->
mkTransVerb v nullPrep Acc;
mkTransVerb v nullPrep Acc; mkTransVerb v nullPrep Acc;
nullPrep : Str = [] ; 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: -- The rule for using transitive verbs is the complementization rule:
complTransVerb :TransVerb -> NounPhrase -> VerbGroup = \se,tu -> 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 --3 Verb phrases
@@ -393,19 +405,41 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
-- (s) an inflected verb, (s2) verb adverbials (such as negation), and -- (s) an inflected verb, (s2) verb adverbials (such as negation), and
-- (s3) complement. This discontinuity is needed in sentence formation -- (s3) complement. This discontinuity is needed in sentence formation
-- to account for word order variations. -- 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 ; VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
negBefore: Bool} ; 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. -- A simple verb can be made into a verb phrase with an empty complement.
predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vidit -> -- There are two versions, depending on if we want to negate the verb.
vidit ** { -- N.B. negation is *not* a function applicable to a verb phrase, since
s2 = negation b ; -- double negations with "inte" are not grammatical.
s3 = \\_,_ => [] ;
negBefore = True -- this should be a parameter ! 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 [] "не" ; 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 -- "Я не - волшебник". Alternatively, we can consider verb-based VP and
-- all the rest. -- all the rest.
{ s= \\vf => case vf of { predAdverb : Adverb -> VerbGroup = \zloj ->
VFin _ _ => zloj.s ; { s= table {
VImper Sg _ => "будь" ++ zloj.s; VFORM _ (VIMP Sg _) => "будь" ++ zloj.s; -- person is ignored !
VImper Pl _ => "будьте" ++ zloj.s; VFORM _ (VIMP Pl _) => "будьте" ++ zloj.s;
-- person is ignored ! VFORM _ VINF => "быть" ++ zloj.s;
VInf => "быть" ++ zloj.s; VFORM _ (VIND _ (VPresent _)) => zloj.s ;
VSubj _ => "" VFORM _ (VIND (ASg Fem) VPast) => "была" ++ zloj.s;
} ; VFORM _ (VIND (ASg Masc) VPast) => "был" ++ zloj.s;
t = Present ; VFORM _ (VIND (ASg Neut) VPast) => "было" ++ zloj.s;
a = Imperfective ; VFORM _ (VIND APl VPast) => "были" ++ zloj.s;
w = Act VFORM _ (VIND (ASg _) (VFuture _)) => "будет" ++ zloj.s;
} ; VFORM _ (VIND APl (VFuture _)) => "будут" ++ zloj.s;
VFORM _ (VSUB _) => ""
predAdjective : AdjPhrase -> VerbGroup = \zloj -> } ;
{ s= \\vf => case vf of { asp = Imperfective ;
VFin gn _ => case (numGNum gn) of { w = Act;
Sg => zloj.s ! AF Nom Animate (ASg (genGNum gn)) ; s2 = table{True => ""; False => "не"};
Pl => zloj.s ! AF Nom Animate APl negBefore = True;
} ;
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
s3 = table{_=> table{_ => ""}} 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. -- verb takes both complements to form a verb phrase.
DitransVerb = TransVerb ** {s4 : Str; c2: Case} ; DitransVerb = TransVerb ** {s4 : Str; c2: Case} ;
mkDitransVerb : Verb -> Case -> Case -> DitransVerb = \v,c1,c2 ->
mkDitransVerb : Verbum -> Case -> Case -> DitransVerb = \v,c1,c2 -> mkDitransVerb : Verbum -> Case -> Case -> DitransVerb = \v,c1,c2 ->
v ** {s2 = ""; c = c1; s4 = ""; c2=c2 } ; v ** {s2 = ""; c = c1; s4 = ""; c2=c2 } ;
@@ -510,9 +505,11 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
tebepivo = dat.s2 ++ tebepivo = dat.s2 ++
tu.s ! PF dat.c No NonPoss ++ dat.s4 ++ pivo.s ! PF dat.c2 Yes NonPoss tu.s ! PF dat.c No NonPoss ++ dat.s4 ++ pivo.s ! PF dat.c2 Yes NonPoss
in in
t = dat.t ; {s = \\vf => (dat.s ! vf) ++ tebepivo ;
a = dat.a ; asp = dat.asp ;
w = dat.w w = Act;
s2 = table{True => ""; False => "не"};
negBefore = True;
s3 = table{_=> table{_ => ""}} s3 = table{_=> table{_ => ""}}
} ; } ;
@@ -574,26 +571,56 @@ oper
in in
if_then_else Str tebyaNeVizhu.negBefore if_then_else Str tebyaNeVizhu.negBefore
(ya ++ ne ++ vizhu ++ tebya) (ya ++ ne ++ vizhu ++ tebya)
(ya ++ vizhu ++ ne ++ tebya)
} ;
param 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 ++ ne ++ vizhu ++ tebya)
(ya ++ vizhu ++ ne ++ tebya) (ya ++ vizhu ++ ne ++ tebya)
} ; } ;
-- This is a macro for simultaneous predication and complementation. -- 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 = predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
\b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b Present (complTransVerb vizhu tu)) ; \b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b Present (complTransVerb vizhu tu)) ;
--3 Sentence-complement verbs --3 Sentence-complement verbs
-- --
SentenceVerb : Type = Verb ; -- Sentence-complement verbs take sentences as complements.
SentenceVerb : Type = Verbum ; SentenceVerb : Type = Verbum ;
-- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет": -- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет":
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = 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{_ => ""}} s3 = table{_=> table{_ => ""}}
} ; } ;
@@ -605,17 +632,19 @@ oper
-- API and leads to some anomalies in English, such as the necessity -- 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 -- to create the infinitive form "to be able to" for "can" so that
-- the construction can be iterated, and the corresponding complication -- the construction can be iterated, and the corresponding complication
VerbVerb : Type = Verb ; -- in the parameter structure.
VerbVerb : Type = Verbum ; VerbVerb : Type = Verbum ;
-- To generate "can walk"/"can't walk"; "tries to walk"/"does not try to walk": -- 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 contraction of "not" is not provided, since it would require changing
-- the verb parameter type. -- the verb parameter type.
{ s = \\vf => putatsya.s ! vf ++ bezhat.s ! VInf ;
t = putatsya.t ; complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \putatsya,bezhat ->
a = putatsya.a ; { s = \\vf => putatsya.s ! vf ++ bezhat.s ! VFORM bezhat.w VINF ;
w = putatsya.w asp = putatsya.asp ;
w = Act;
s2 = table{True => ""; False => "не"};
negBefore = True; negBefore = True;
s3 = table{_=> table{_ => ""}} s3 = table{_=> table{_ => ""}}
} ; } ;
@@ -632,7 +661,11 @@ oper
SentenceSlashNounPhrase = Sentence ** Complement ; 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; negBefore = True;
s3 = table{_=> table{_ => ""}} })) ** s3 = table{_=> table{_ => ""}} })) **
complementOfTransVerb lubit ; complementOfTransVerb lubit ;
@@ -816,7 +849,7 @@ oper
DirQ => vu ++ spish ; DirQ => vu ++ spish ;
IndirQ => spish ++ "ли" ++ vu IndirQ => spish ++ "ли" ++ vu
} }
questVerbPhrase } ;
isThere : NounPhrase -> Question = \bar -> isThere : NounPhrase -> Question = \bar ->
questVerbPhrase questVerbPhrase
@@ -1044,4 +1077,86 @@ isThere : NounPhrase -> Question = \bar ->
defaultNounPhrase : NounPhrase -> SS = \masha -> defaultNounPhrase : NounPhrase -> SS = \masha ->
ss (masha.s ! PF Nom No NonPoss) ; 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 => "не"}; s2 = table{True => ""; False => "не"};

View File

@@ -1,6 +1,6 @@
-- use this path to read the grammar from the same directory -- use this path to read the grammar from the same directory
--# -path=.:../abstract:../../prelude --# -path=.:../abstract:../../prelude
concrete TestResourceRus of TestResource = StructuralRus ** open SyntaxRus in { concrete TestResourceRus of TestResource = RulesRus, StructuralRus ** open SyntaxRus in {
flags flags
coding=utf8 ; coding=utf8 ;
@@ -18,12 +18,12 @@ lin
American = ij_EndK_G_KH_Decl "американск" ; -- adj1Malenkij from Paradigms American = ij_EndK_G_KH_Decl "американск" ; -- adj1Malenkij from Paradigms
Finnish = 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 Married = adjInvar "замужем" ** {s2 = "за"; c = Inst} ; -- adjinvar from Paradigms
Give = mkDitransVerb (extVerb verbDavat Act Present) Acc Dat; Give = mkDitransVerb verbDavat Acc Dat;
Prefer = mkDitransVerb (extVerb verbPredpochitat Act Present) Acc Dat ; Prefer = mkDitransVerb verbPredpochitat Acc Dat ;
Bar = bar ; Bar = bar ;
Bottle = butyulka ; Bottle = butyulka ;
Wine = vino ; Wine = vino ;
Drink = mkDirectVerb (extVerb verbPit Act Present ) ; Drink = mkDirectVerb verbPit ;
Happy = schastlivyuj ; Happy = schastlivyuj ;
Man = muzhchina ; Man = muzhchina ;
@@ -32,15 +32,15 @@ lin
House = dom ; House = dom ;
Level = uroven ; Level = uroven ;
Light = svet ; Light = svet ;
Walk = extVerb verbGulyat Act Present ; Walk = verbGulyat ;
Run = extVerb verbBegat Act Present ; Run = verbBegat ;
Love = mkDirectVerb (extVerb verbLubit Act Present ) ; Love = mkDirectVerb verbLubit ;
Send = mkDirectVerb (extVerb verbOtpravlyat Act Present ) ; Send = mkDirectVerb verbOtpravlyat ;
Wait = mkDirectVerb (extVerb verbZhdat Act Present ); Wait = mkDirectVerb verbZhdat ;
Say = extVerb verbGovorit Act Present ; --- works in present tense... Say = verbGovorit ; --- works in present tense...
Prove = extVerb verbDokazuvat Act Present ; Prove = verbDokazuvat ;
SwitchOn = mkDirectVerb (extVerb verbVkluchat Act Present ) ; SwitchOn = mkDirectVerb verbVkluchat ;
SwitchOff = mkDirectVerb (extVerb verbVukluchat Act Present ) ; SwitchOff = mkDirectVerb verbVukluchat ;
Mother = funGen mama ; Mother = funGen mama ;
Uncle = funGen dyadya ; Uncle = funGen dyadya ;

View File

@@ -24,7 +24,7 @@ param
Case = Nom | Gen | Dat | Acc | Inst | Prepos ; Case = Nom | Gen | Dat | Acc | Inst | Prepos ;
Voice = Act | Pass ; Voice = Act | Pass ;
Aspect = Imperfective | Perfective ; Aspect = Imperfective | Perfective ;
Tense = Present | Past ; Tense = Present | Past | Future ;
Degree = Pos | Comp | Super ; Degree = Pos | Comp | Super ;
Person = P1 | P2 | P3 ; Person = P1 | P2 | P3 ;
AfterPrep = Yes | No ; AfterPrep = Yes | No ;
@@ -218,6 +218,9 @@ oper
-- in a sense that many verbs do not have all grammatically possible -- in a sense that many verbs do not have all grammatically possible
-- forms. For example, passive does not exist for the verb -- forms. For example, passive does not exist for the verb
-- "любить" (to love), but exists for the verb "ломать" (to break). -- "любить" (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 -- Depending on the tense verbs conjugate according to combinations
-- of gender, person and number of the verb objects. -- of gender, person and number of the verb objects.
@@ -229,8 +232,18 @@ oper Verbum : Type = { s: VerbForm => Str ; asp : Aspect };
param param
VerbForm = VFORM Voice VerbConj ; VerbForm = VFORM Voice VerbConj ;
VerbConj = VIND VTense | VIMP Number Person | VINF | VSUB GenNum ; VerbConj = VIND GenNum VTense | VIMP Number Person | VINF | VSUB GenNum ;
VTense = VPresent Number Person | VPast GenNum | VFuture Number Person ; 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 -- For writing an application grammar one usually doesn't need
-- the whole inflection table, since each verb is used in -- the whole inflection table, since each verb is used in
@@ -240,6 +253,7 @@ param
-- The conjugation parameters left (Gender, Number, Person) -- The conjugation parameters left (Gender, Number, Person)
-- are combined in the "VF" type: -- are combined in the "VF" type:
param VF = param VF =
VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum; VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum;
@@ -249,8 +263,9 @@ oper
extVerb : Verbum -> Voice -> Tense -> Verb = \aller, vox, t -> extVerb : Verbum -> Voice -> Tense -> Verb = \aller, vox, t ->
{ s = table { { s = table {
VFin gn p => case t of { VFin gn p => case t of {
Present => aller.s ! VFORM vox (VIND (VPresent (numGNum gn) p)) ; Present => aller.s ! VFORM vox (VIND gn (VPresent p)) ;
Past => aller.s ! VFORM vox (VIND (VPast gn)) 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) ; VImper n p => aller.s ! VFORM vox (VIMP n p) ;
VInf => aller.s ! VFORM vox VINF ; VInf => aller.s ! VFORM vox VINF ;