*** empty log message ***

This commit is contained in:
janna
2005-11-13 19:35:06 +00:00
parent f0b22f18f1
commit 857094ae0e
4 changed files with 230 additions and 60 deletions

View File

@@ -2,7 +2,7 @@
--1 The Top-Level Russian Resource Grammar: Combination Rules
--
-- Aarne Ranta, Janna Khegai 2003 -- 2004
-- Aarne Ranta, Janna Khegai 2003 -- 2005
--
-- This is the Russian concrete syntax of the multilingual resource
-- grammar. Most of the work is done in the file $SyntaxRus.gf$.
@@ -36,7 +36,7 @@ lincat
-- g: PronGen ; anim : Animacy ; pron: Bool} ;
PN = ProperName ;
-- = {s : Case => Str ; g : Gender ; anim : Animacy} ;
A = Adjective ;
A = Adjective ;
-- = {s : AdjForm => Str} ;
A2 = AdjCompl ;
-- = Adjective ** Complement ;
@@ -47,10 +47,12 @@ lincat
Det = Determiner ;
-- = Adjective ** {n: Number; g: PronGen; c: Case} ;
N2 = Function ;
NDet = Adjective ** {g: PronGen; c: Case} ;
-- "Det" without "Number" field
N2 = Function ;
-- = CommNounPhrase ** Complement ;
N3 = Function ** {s3 : Str; c2: Case} ;
N3 = Function ** {s3 : Str; c2: Case} ;
Num = Numeral ;
-- = {s : Case => Gender => Str} ;
@@ -63,7 +65,7 @@ lincat
-- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
-- negBefore: Bool} ;
V2 = TransVerb ;
-- = Verbum ** {s2 : Str ; c: Case } ;
-- = Verbum ** Complement ;
V3 = DitransVerb ;
-- = TransVerb ** {s4 : Str; c2: Case} ;
VS = SentenceVerb ;
@@ -71,32 +73,52 @@ lincat
VV = VerbVerb ;
-- = Verbum ;
VCl = {s : Bool => Anteriority => Str} ;
-- infinitive verb phrase (in other languages very similar to VPI,
-- but without Bool=>Anteriority)
VPI = VerbPhraseInf ;
-- {s : Str; a: Aspect; w:Voice; s2 : Str ;
-- s3 : Gender => Number => Str ; negBefore: Bool} ;
-- almost the same as VP, but VF is fixed to the infinitive form
-- and the tense field is supressed
AdV = Adverb ;
Adv = Adverb ; -- sentence adverb e.g. "now", "in the house"
-- = {s : Str} ;
AdV = Adverb ;
AdA = Adverb ; -- ad-adjective e.g. "very"
AdC = Adverb ; -- conjoining adverb e.g. "therefore", "otherwise"
Prep = Preposition;
-- = {s : Str ; c: Case } ;
PP = Adverb ;
Cl = Clause ; -- clause (variable tense) e.g. "John walks"/"John walked"
-- = {s : Bool => ClForm => Str} ;
S = Sentence ;
-- = {s : Str} ;
Slash = SentenceSlashNounPhrase ;
-- sentence without NP, e.g. "John waits for (...)"
-- = Sentence ** Complement ;
RP = RelPron ;
-- = {s : GenNum => Case => Animacy => Str} ;
RC = RelClause ;
-- = RelPron ;
-- = {s : GenNum => Case => Animacy => Str} ;
RS = RelPron ;
RCl = RelClause ;
-- = {s : Bool => ClForm => GenNum => Case => Animacy => Str} ;
IP = IntPron ;
-- = NounPhrase ;
Qu = Question ;
-- = {s : QuestForm => Str} ;
IDet = Determiner ;
-- = Adjective ** {n: Number; g: PronGen; c: Case} ;
IAdv = Adverb ;
-- = {s : Str} ;
QS = Question ; -- question w. fixed tense
-- = {s : QuestForm => Str} ;
QCl = {s :Bool => ClForm => QuestForm => Str};
Imp = Imperative ;
-- = { s: Gender => Number => Str } ;
Phr = Utterance ;
-- = {s : Str} ;
Conj = Conjunction ;
-- = {s : Str ; n : Number} ;
@@ -110,10 +132,44 @@ lincat
ListNP = ListNounPhrase ;
-- = { s1,s2 : PronForm => Str ; g: Gender ; anim : Animacy ;
-- n : Number ; p : Person ; pron : Bool } ;
ListAdv= {s1 : Str ; s2 : Str} ;
PP = Adverb ;
Cl = Clause ;
-- = {s : Bool => ClForm => Str} ;
Phr = Utterance ;
-- = {s : Str} ;
Text = {s : Str} ;
---- next
VQ = Verbum ;
-- = {s : VerbForm => Str ; asp : Aspect } ;
VA = Verbum ;
V0 = Verbum ;
V2A = TransVerb ;
-- = Verbum ** Complement ;
V2V = TransVerb ;
V2S = TransVerb ;
V2Q = TransVerb ;
AS = Adverb ;
-- = {s : Str} ;
A2S = Adverb ** Complement;
AV = Adjective ;
-- = {s : AdjForm => Str} ;
A2V = AdjCompl ;
-- = Adjective ** Complement ;
-- NB: it is difficult to play the sonata
-- vs. it (the sonata) is difficult to play
-- also : John is easy (for you) to please vs. John is eager to please
-- similar implementation in all the languages, s-field is dummy:
TP = {s : Str ; b : Bool ; t : ClTense ; a : Anteriority} ; -- combination of the three below
Tense = {s : Str ; t : ClTense} ;
Ant = {s : Str ; a : Anteriority} ; --For time agreement:
Pol = {s : Str ; p : Bool} ; --Positive or negative statement
Subj = {s : Str} ;
}

View File

@@ -5,6 +5,8 @@ lin
UsePN = nameNounPhrase ;
ComplA2 = complAdj ;
-- ComplAV : AV -> VPI -> AP ; -- "eager to leave"
-- ComplObjA2V : A2V -> NP -> VPI -> AP ; -- "easy for us to convince"
PredVP = predVerbPhrase ;
UseA = adj2adjPhrase ;
ModAP = modCommNounPhrase ;
@@ -16,20 +18,14 @@ lin
AppN3 = appFun2 ;
PositADeg = positAdjPhrase ;
ComparADeg = comparAdjPhrase ;
SuperlNP = superlNounPhrase ;
--- SuperlNP = superlNounPhrase ;
-- SuperlADeg : ADeg -> AP ; -- "the oldest"
CNthatS = nounThatSentence ;
UseInt i = useInt i.s;
NoNum = noNum ;
--- these two by AR 3/6/2004
SymbPN i = {s = \\_ => i.s ; g = Neut ; anim = Inanimate} ; ---
SymbCN cn s =
{s = \\n,c => cn.s ! n ! c ++ s.s ;
g = cn.g ;
anim = cn.anim
} ;
DetNP = detNounPhrase ;
IndefOneNP = indefNounPhrase Sg ;
@@ -37,6 +33,8 @@ lin
DefOneNP = indefNounPhrase Sg ;
DefNumNP = indefNounPhraseNum Pl ;
MassNP = indefNounPhrase Sg;
-- NDetNP : NDet -> Num -> CN -> NP ; -- "these (5) cars"
-- NDetNum : NDet -> Num -> NP ; -- "these (5)"
PosVG = predVerbGroup True Present ;
NegVG = predVerbGroup False Present ;
@@ -53,13 +51,68 @@ lin
PredVV = complVerbVerb ;
VTrans = verbOfTransVerb ;
-- The main uses of verbs and verb phrases have been moved to the
-- module $Verbphrase$ (deep $VP$ nesting) and its alternative,
-- $Clause$ (shallow many-place predication structure).
-- PredAS : AS -> S -> Cl ; -- "it is good that he comes"
-- PredV0 : V0 -> Cl ; -- "it is raining"
-- Partial saturation.
-- UseV2 : V2 -> V ; -- "loves"
-- ComplA2S : A2S -> NP -> AS ; -- "good for John"
-- UseV2V : V2V -> VV ;
-- UseV2S : V2S -> VS ;
-- UseV2Q : V2Q -> VQ ;
-- UseA2S : A2S -> AS ;
-- UseA2V : A2V -> AV ;
-- Formation of tensed phrases.
-- AdjPart : V -> A ; -- past participle, e.g. "forgotten"
-- UseCl : TP -> Cl -> S ;
-- UseRCl : TP -> RCl -> RS ;
-- UseQCl : TP -> QCl -> QS ;
-- UseVCl : Pol -> Ant -> VCl -> VPI ;
-- s field is superficial:
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ;
TPresent = {s = [] ; t = ClPresent} ;
TPast = {s = [] ; t = ClPast} ;
TFuture = {s = [] ; t = ClFuture} ;
TConditional = {s = [] ; t = ClConditional} ;
ASimul = {s = [] ; a = Simul} ;
AAnter = {s = [] ; a = Anter} ;
PPos = {s = [] ; p = True} ;
PNeg = {s = [] ; p = False} ;
-- AdvPP : PP -> Adv ; -- "in London", "after the war"
-- AdvAdv : AdA -> Adv -> Adv ; -- "very well"
AdjAdv a = mkAdverb (a.s ! AdvF) ;
PrepNP p = prepPhrase p ;
AdvVP = adVerbPhrase ;
--LocNP = locativeNounPhrase ;
AdvVPI = adVerbPhraseInf ;
---AdvVP = adVerbPhrase ;
---LocNP = locativeNounPhrase ;
AdvCN = advCommNounPhrase ;
AdvAP = advAdjPhrase ;
-- SlashV2 : NP -> V2 -> Slash ; -- "(whom) John doesn't love"
-- SlashVV2 : NP -> VV -> V2 -> Slash ; -- "(which song do you) want to play"
-- SlashAdv : Cl -> Prep -> Slash ; -- "(whom) John walks with"
PosSlashV2 = slashTransVerb True ;
NegSlashV2 = slashTransVerb False ;
OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ;
@@ -71,28 +124,38 @@ lin
RelSlash = relSlash ;
ModRC = modRelClause ;
RelSuch = relSuch ;
-- RelCl : Cl -> RCl ; -- "such that it is even"
WhoOne = intPronKto Sg ;
WhoMany = intPronKto Pl ;
WhatOne = intPronChto Sg ;
WhatMany = intPronChto Pl ;
FunIP = funIntPron ;
-- IDetCN : IDet -> CN -> IP ; -- "which car", "which cars"
NounIPOne = nounIntPron Sg ;
NounIPMany = nounIntPron Pl ;
QuestVP = questVerbPhrase ;
IntVP = intVerbPhrase ;
---IntVP = intVerbPhrase ;
IntSlash = intSlash ;
QuestAdv = questAdverbial ;
IsThereNP = isThere ;
-- QuestCl : Cl -> QCl ; -- "does John walk"; "doesn't John walk"
ImperVP = imperVerbPhrase ;
QuestAdv = questAdverbial ;
---ImperVP = imperVerbPhrase ;
-- PosImpVP, NegImpVP : VCl -> Imp ; -- "(don't) be a man"
IndicPhrase = indicUtt ;
QuestPhrase = interrogUtt ;
ImperOne = imperUtterance Masc Sg ;
ImperMany = imperUtterance Masc Pl ;
AdvS = advSentence ;
AdvCl = advClause ;
-- AdCPhr : AdC -> S -> Phr ; -- "Therefore, 2 is prime."
-- AdvPhr : Adv -> S -> Phr ; -- "In India, there are tigers."
TwoS = twoSentence ;
ConsS = consSentence ;
@@ -109,11 +172,24 @@ lin
ConjNP = conjunctNounPhrase ;
ConjDNP = conjunctDistrNounPhrase ;
-- ConjAdv : Conj -> ListAdv -> Adv ; -- "quickly or slowly"
-- ConjDAdv : ConjD -> ListAdv -> Adv ; -- "both badly and slowly"
-- TwoAdv : Adv -> Adv -> ListAdv ;
-- ConsAdv : ListAdv -> Adv -> ListAdv ;
SubjS = subjunctSentence ;
SubjImper = subjunctImperative ;
SubjQu = subjunctQuestion ;
-- SubjQS : Subj -> S -> QS -> QS ; -- "if you are new, who are you?"
SubjVP = subjunctVerbPhrase ;
-- This rule makes a subordinate clause into a sentence adverb, which
-- can be attached to e.g. noun phrases. It might even replace the
-- previous subjunction rules.
-- AdvSubj : Subj -> S -> Adv ; -- "when he arrives"
PhrNP = useNounPhrase ;
PhrOneCN = useCommonNounPhrase Sg ;
PhrManyCN = useCommonNounPhrase Pl ;
@@ -121,17 +197,24 @@ lin
PhrIAdv ia = postfixSS "?" ia ;
OnePhr p = p ;
ConsPhr = cc2 ;
-- PhrVPI : VPI -> Phr ; -- "Tända ljus."
--2 Special constructs.
--
-- These constructs tend to have language-specific syntactic realizations.
--- IsThereNP = isThere ;
-- ExistCN = existCN ;
-- ExistNumCN = existNumCN ;
OneNP = npOne ;
--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

@@ -43,11 +43,20 @@ oper
NounPhrase : Type = { s : PronForm => Str ; n : Number ;
p : Person ; g: PronGen ; anim : Animacy ; pron: Bool} ;
-- No direct correspondance in Russian. Usually expressed by infinitive:
-- "Если очень захотеть, можно в космос улететь"
-- (If one really wants one can fly into the space).
-- Note that the modal verb "can" is trasferred into adverb
-- "можно" (it is possible) in Russian
-- The closest subject is "ты" (you), which is omitted in the final sentence:
-- "Если очень захочешь, можешь в космос улететь"
npOne: NounPhrase = { s=\\_=>""; n=Sg; p=P2; g=PNoGen; anim=Animate;pron=False};
-- The following construction has to be refined for genitive forms:
-- "we two", "us two" are OK, but "our two" is not.
-- actually also "Animacy" for numerals 1-4 should be resent
Numeral : Type = {s : Case => Gender => Str} ;
Numeral : Type = {s : Case => Gender => Str} ;
pronWithNum : NounPhrase -> Numeral -> NounPhrase = \mu,dva ->
{s = \\pf => mu.s!pf ++ dva.s ! (extCase pf) ! (pgen2gen mu.g) ;
@@ -408,8 +417,10 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
negBefore: Bool} ;
VerbPhraseInf : Type = {s : Str; a: Aspect; w:Voice; s2 : Str ;
s3 : Gender => Number => Str ; negBefore: Bool} ;
-- VerbGroup is new in "lib"-verion of the resource.
-- VerbGroup is new in "lib"-verion of the resource.
-- Unlike VerbPhrase, VerbGroup does not have RusTense parameter fixed.
-- It also not yet negated (s2):
@@ -417,7 +428,7 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
-- 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 -> RusTense -> VerbGroup -> VerbPhrase = \b,t, vidit ->
(extVerb vidit vidit.w t)** {
s2 = negation b ;
@@ -451,7 +462,7 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
-- Verb phrases can also be formed from adjectives (" молод"),
-- common nouns (" человек"), and noun phrases (" самый молодой").
-- The third rule is overgenerating: " каждый человек" has to be ruled out
-- The third rule is overgenerating: " каждый человек" has to be ruled out
-- on semantic grounds.
-- Note: we omit a dash "-" because it will cause problems with negation word order:
@@ -518,6 +529,10 @@ let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
--2 Adverbials
--
adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \poet, khorosho ->
{s = \\vf => khorosho.s ++ poet.s ! vf ; s2 = poet.s2; s3 = poet.s3;
a = poet.a; w = poet.w; t = poet.t ; negBefore = poet.negBefore } ;
adVerbPhraseInf : VerbPhraseInf -> Adverb -> VerbPhraseInf = \poet, khorosho ->
{s = khorosho.s ++ poet.s ; s2 = poet.s2; s3 = poet.s3;
a = poet.a; w = poet.w; negBefore = poet.negBefore } ;
@@ -572,8 +587,14 @@ oper
in
if_then_else Str tebyaNeVizhu.negBefore
(ya ++ ne ++ vizhu ++ tebya)
(ya ++ vizhu ++ ne ++ tebya)
} ;
} ;
param
Anteriority = Simul | Anter ;
-- for compatibility with Rules.gf:
ClTense = ClPresent | ClPast | ClFuture | ClConditional;
ClForm = ClIndic RusTense Anteriority | ClCondit | ClInfinit ;
-- "naked infinitive" clauses
@@ -588,7 +609,7 @@ oper
ClInfinit => (mkPronForm Acc No NonPoss);
_ =>(mkPronForm Nom No NonPoss)
});
vizhu = tebyaNeVizhu.s ! (case c of {
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));
@@ -633,7 +654,7 @@ 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
-- in the parameter structure.
VerbVerb : Type = Verbum ;
@@ -671,6 +692,12 @@ oper
negBefore = True;
s3 = table{_=> table{_ => ""}} })) **
complementOfTransVerb lubit ;
thereIs : NounPhrase -> Sentence = \bar ->
{s = "есть" ++ bar.s ! PF Nom No NonPoss} ;
--existCN : CommNoun -> Clause = \ bar ->
-- {s = "есть" ++ bar.s ! PF Nom No NonPoss} ;
--existNumCN: Numeral -> CommNoun -> Clause=\tri, bara ->
-- {s = "есть" ++ bara.s ! PF Nom No NonPoss} ;
@@ -706,17 +733,18 @@ oper
mama.s ! nu ! c ++
mama.s2 ++ kotoruj.s ! gn ! mama.c ! anim
} ;
-- slash expressions ("я вижу").
-- Relative clauses can be formed from both verb phrases ("видит Машу") and
-- slash expressions ("я вижу").
RelClause : Type = {s : Bool => ClForm => GenNum => Case => Animacy => Str} ;
relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \kotoruj, gulyaet ->
{ s = \\b,clf,gn, c, anim => let { nu = numGNum gn } in
kotoruj.s ! gn ! c ! anim ++ gulyaet.s2 ++ gulyaet.s ! VFin gn P3 ++
gulyaet.s3 ! genGNum gn ! nu
relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause =
} ;
relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause =
\kotoruj, yaVizhu ->
@@ -724,7 +752,7 @@ oper
++ yaVizhu.s
} ;
-- A 'degenerate' relative clause is the one often used in mathematics, e.g.
-- "число x, такое что x - четное".
relSuch : Sentence -> RelClause = \A ->
@@ -733,8 +761,8 @@ oper
-- The main use of relative clauses is to modify common nouns.
-- The result is a common noun, out of which noun phrases can be formed
-- by determiners. A comma is used before the relative clause.
\chelovek,kotorujSmeetsya ->
{ s = \\n,c => chelovek.s ! n ! c ++ "," ++
modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase =
\chelovek,kotorujSmeetsya ->
{ s = \\n,c => chelovek.s ! n ! c ++ "," ++
kotorujSmeetsya.s ! True ! ClIndic Present Simul ! gNum chelovek.g n ! Nom ! chelovek.anim;
@@ -904,6 +932,9 @@ isThere : NounPhrase -> Question = \bar ->
imperUtterance : Gender -> Number -> Imperative -> Utterance = \g,n,I ->
ss (I.s ! g ! n ++ "!") ;
--2 Sentence adverbials
--
-- This class covers adverbials such as "otherwise", "therefore", which are prefixed
-- to a sentence to form a phrase.
advSentence : SS -> Sentence -> Utterance = \sledovatelno, mamaMulaRamu ->
ss (sledovatelno.s ++ mamaMulaRamu.s ++ ".") ;
@@ -1140,7 +1171,7 @@ VFORM _ (VIND (ASg _) (VFuture P1))=> "буду"++ masha.s ! (mkPronForm Inst N
predAdjective : AdjPhrase -> VerbGroup = \zloj ->
{ s= table {
-- person is ignored !
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) ;

View File

@@ -24,7 +24,7 @@ param
Case = Nom | Gen | Dat | Acc | Inst | Prepos ;
Voice = Act | Pass ;
Aspect = Imperfective | Perfective ;
Tense = Present | Past | Future ;
RusTense = Present | Past | Future ;
Degree = Pos | Comp | Super ;
Person = P1 | P2 | P3 ;
AfterPrep = Yes | No ;
@@ -236,7 +236,7 @@ param
VTense = VPresent Person | VPast | VFuture Person ;
oper
getVTense : Tense -> Person -> VTense= \t,p ->
getVTense : RusTense -> Person -> VTense= \t,p ->
case t of { Present => VPresent p ; Past => VPast; Future => VFuture p } ;
getVoice: VerbForm -> Voice = \vf ->
@@ -248,7 +248,7 @@ oper
-- For writing an application grammar one usually doesn't need
-- the whole inflection table, since each verb is used in
-- a particular context that determines some of the parameters
-- (Tense and Voice while Aspect is fixed from the beginning) for certain usage.
-- (RusTense and Voice while Aspect is fixed from the beginning) for certain usage.
-- So we define the "Verb" type, that have these parameters fixed.
-- The conjugation parameters left (Gender, Number, Person)
-- are combined in the "VF" type:
@@ -258,9 +258,9 @@ param VF =
VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum;
oper
Verb : Type = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ;
Verb : Type = {s : VF => Str ; t: RusTense ; a : Aspect ; w: Voice} ;
extVerb : Verbum -> Voice -> Tense -> Verb = \aller, vox, t ->
extVerb : Verbum -> Voice -> RusTense -> Verb = \aller, vox, t ->
{ s = table {
VFin gn p => case t of {
Present => aller.s ! VFORM vox (VIND gn (VPresent p)) ;
@@ -299,7 +299,7 @@ oper
-- gender, number, and case just like adjectives.
RelPron : Type = {s : GenNum => Case => Animacy => Str} ;
--3 Prepositions
-- the same as "Complement" category. Renaming the field "s2" into "s" has lead to