forked from GitHub/gf-core
*** empty log message ***
This commit is contained in:
2
lib/resource/russian/AllResourceRus.gf
Normal file
2
lib/resource/russian/AllResourceRus.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete AllResourceRus of AllResource = RulesRus, StructuralRus ** {} ;
|
||||
|
||||
119
lib/resource/russian/CategoriesRus.gf
Normal file
119
lib/resource/russian/CategoriesRus.gf
Normal file
@@ -0,0 +1,119 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level Russian Resource Grammar: Combination Rules
|
||||
--
|
||||
-- Aarne Ranta, Janna Khegai 2003 -- 2004
|
||||
--
|
||||
-- This is the Russian concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $SyntaxRus.gf$.
|
||||
-- However, for the purpose of documentation, we make here explicit the
|
||||
-- linearization types of each category, so that their structures and
|
||||
-- dependencies can be seen.
|
||||
-- Another substantial part are the linearization rules of some
|
||||
-- structural words.
|
||||
--
|
||||
-- The users of the resource grammar should not look at this file for the
|
||||
-- linearization rules, which are in fact hidden in the document version.
|
||||
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||
-- one has to know how the syntactic categories are
|
||||
-- implemented. The parameter types are defined in $TypesRus.gf$.
|
||||
|
||||
concrete CategoriesRus of Categories = open Prelude, SyntaxRus in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
lexer=text ;
|
||||
unlexer=text ;
|
||||
|
||||
lincat
|
||||
N = CommNoun ;
|
||||
-- = {s : SubstForm => Str ; g : Gender ; anim : Animacy } ;
|
||||
CN = CommNounPhrase ;
|
||||
-- = {s : Number => Case => Str; g : Gender; anim : Animacy} ;
|
||||
NP = NounPhrase ;
|
||||
-- = { s : PronForm => Str ; n : Number ; p : Person ;
|
||||
-- g: PronGen ; anim : Animacy ; pron: Bool} ;
|
||||
PN = ProperName ;
|
||||
-- = {s : Case => Str ; g : Gender ; anim : Animacy} ;
|
||||
A1 = Adjective ;
|
||||
-- = {s : AdjForm => Str} ;
|
||||
A2 = AdjCompl ;
|
||||
-- = Adjective ** Complement ;
|
||||
ADeg = AdjDegr ;
|
||||
-- = {s : Degree => AdjForm => Str} ;
|
||||
AP = AdjPhrase ;
|
||||
-- = Adjective ** {p : IsPostfixAdj} ;
|
||||
|
||||
Det = Determiner ;
|
||||
-- = Adjective ** {n: Number; g: PronGen; c: Case} ;
|
||||
|
||||
N2 = Function ;
|
||||
-- = CommNounPhrase ** Complement ;
|
||||
N3 = Function ** {s3 : Str; c2: Case} ;
|
||||
Num = Numeral ;
|
||||
-- = {s : Case => Gender => Str} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ;
|
||||
VG = VerbGroup ;
|
||||
-- = Verb ;
|
||||
VP = VerbPhrase ;
|
||||
-- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
|
||||
-- negBefore: Bool} ;
|
||||
V2 = TransVerb ;
|
||||
-- = Verb ** {s2 : Str ; c: Case } ;
|
||||
V3 = DitransVerb ;
|
||||
-- = TransVerb ** {s4 : Str; c2: Case} ;
|
||||
VS = SentenceVerb ;
|
||||
-- = Verb ;
|
||||
VV = VerbVerb ;
|
||||
-- = Verb ;
|
||||
|
||||
|
||||
AdV = Adverb ;
|
||||
-- = {s : Str} ;
|
||||
Prep = Preposition;
|
||||
-- = {s : Str ; c: Case } ;
|
||||
|
||||
|
||||
|
||||
S = Sentence ;
|
||||
-- = {s : Str} ;
|
||||
Slash = SentenceSlashNounPhrase ;
|
||||
-- = Sentence ** Complement ;
|
||||
|
||||
RP = RelPron ;
|
||||
-- = {s : GenNum => Case => Animacy => Str} ;
|
||||
RC = RelClause ;
|
||||
-- = RelPron ;
|
||||
|
||||
IP = IntPron ;
|
||||
-- = NounPhrase ;
|
||||
Qu = Question ;
|
||||
-- = {s : QuestForm => Str} ;
|
||||
Imp = Imperative ;
|
||||
-- = { s: Gender => Number => Str } ;
|
||||
Phr = Utterance ;
|
||||
-- = {s : Str} ;
|
||||
|
||||
Conj = Conjunction ;
|
||||
-- = {s : Str ; n : Number} ;
|
||||
ConjD = ConjunctionDistr ;
|
||||
-- = {s1,s2 : Str ; n : Number} ;
|
||||
|
||||
ListS = ListSentence ;
|
||||
-- = {s1,s2 : Mode => Str} ;
|
||||
ListAP = ListAdjPhrase ;
|
||||
-- = {s1,s2 : AdjForm => Str ; p : Bool} ;
|
||||
ListNP = ListNounPhrase ;
|
||||
-- = { 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} ;
|
||||
|
||||
}
|
||||
|
||||
1482
lib/resource/russian/MorphoRus.gf
Normal file
1482
lib/resource/russian/MorphoRus.gf
Normal file
File diff suppressed because it is too large
Load Diff
102
lib/resource/russian/NumeralsRus.gf
Normal file
102
lib/resource/russian/NumeralsRus.gf
Normal file
@@ -0,0 +1,102 @@
|
||||
concrete NumeralsRus of Numerals = open MorphoRus, Prelude in {
|
||||
flags coding=utf8 ;
|
||||
|
||||
-- Toiska, 13/8/2000, AR with Arto Mustajoki.
|
||||
|
||||
-- the same as in SyntaxRus.gf, which is not visible here:
|
||||
lincat Numeral = {s : Case => Gender => Str } ;
|
||||
|
||||
lincat Digit = {s : DForm => Gender => Str ; size : Size} ;
|
||||
lincat Sub10 = {s : Place => DForm => Gender => Str ; size : Size} ;
|
||||
lincat Sub100 = {s : Place => Gender => Str ; size : Size} ;
|
||||
lincat Sub1000 = {s : Place => Gender => Str ; size : Size} ;
|
||||
lincat Sub1000000 = {s : Gender => Str} ;
|
||||
|
||||
lin num x = {s = table{ _ => x.s }};
|
||||
|
||||
lin n2 =
|
||||
{s = table {{unit} => table {{Fem} => "две" ; _ => "два"} ;
|
||||
{teen} => gg "двенадцать" ;
|
||||
{ten} => gg "двадцать" ;
|
||||
{hund} => gg "двести"} ;
|
||||
size = sgg} ;
|
||||
lin n3 =
|
||||
{s = table {{unit} => gg "три" ;
|
||||
{teen} => gg "тринадцать" ;
|
||||
{ten} => gg "тридцать" ;
|
||||
{hund} => gg "триста"} ;
|
||||
size = sgg} ;
|
||||
lin n4 =
|
||||
{s = table {{unit} => gg "четыре" ;
|
||||
{teen} => gg "четырнадцать" ;
|
||||
{ten} => gg "сорок" ;
|
||||
{hund} => gg "четыреста"} ;
|
||||
size = sgg} ;
|
||||
lin n5 =
|
||||
{s = table {{unit} => gg "пять" ;
|
||||
{teen} => gg "пятнадцать" ;
|
||||
{ten} => gg "пятьдесят" ;
|
||||
{hund} => gg "пятьсот"} ;
|
||||
size = plg} ;
|
||||
lin n6 =
|
||||
{s = table {{unit} => gg "шесть" ;
|
||||
{teen} => gg "шестнадцать" ;
|
||||
{ten} => gg "шестьдесят" ;
|
||||
{hund} => gg "шестьсот"} ;
|
||||
size = plg} ;
|
||||
lin n7 =
|
||||
{s = table {{unit} => gg "семь" ;
|
||||
{teen} => gg "семнадцать" ;
|
||||
{ten} => gg "семьдесят" ;
|
||||
{hund} => gg "семьсот"} ;
|
||||
size = plg} ;
|
||||
lin n8 =
|
||||
{s = table {{unit} => gg "восемь" ;
|
||||
{teen} => gg "восемнадцать" ;
|
||||
{ten} => gg "восемьдесят" ;
|
||||
{hund} => gg "восемьсот"} ;
|
||||
size = plg} ;
|
||||
lin n9 =
|
||||
{s = table {{unit} => gg "девять" ;
|
||||
{teen} => gg "девятнадцать" ;
|
||||
{ten} => gg "девяносто" ;
|
||||
{hund} => gg "девятьсот"} ;
|
||||
size = plg} ;
|
||||
|
||||
|
||||
lin pot01 =
|
||||
{s = table {{attr} => table {{hund} => gg "сто" ; _ => gg []} ;
|
||||
_ => table {{hund} => gg "сто" ;
|
||||
_ => table {{Masc} => "один" ; {Fem} => "одна" ; _ => "одно"}}} ;
|
||||
size = nom} ;
|
||||
lin pot0 d =
|
||||
{s = table {_ => d.s} ; size = d.size} ;
|
||||
lin pot110 =
|
||||
{s = table {_ => gg "десять"} ; size = plg} ;
|
||||
lin pot111 =
|
||||
{s = table {_ => gg "одиннадцать"} ; size = plg} ; --- 11
|
||||
lin pot1to19 d =
|
||||
{s = table {_ => d.s ! teen} ; size = plg} ;
|
||||
lin pot0as1 n =
|
||||
{s = table {p => n.s ! p ! unit} ; size = n.size} ;
|
||||
lin pot1 d =
|
||||
{s = table {_ => d.s ! ten} ; size = plg} ; ---
|
||||
lin pot1plus d e =
|
||||
{s = table {_ =>
|
||||
table {g => d.s ! ten ! g ++ e.s ! indep ! unit ! g}} ; size = e.size} ;
|
||||
lin pot1as2 n =
|
||||
{s = n.s ; size = n.size} ;
|
||||
lin pot2 d =
|
||||
{s = table {p => d.s ! p ! hund} ; size = plg} ;
|
||||
lin pot2plus d e =
|
||||
{s = table {p => table {g => d.s ! p ! hund ! g ++ e.s ! indep ! g}} ; size = e.size} ;
|
||||
lin pot2as3 n =
|
||||
{s = n.s ! indep} ;
|
||||
lin pot3 n =
|
||||
{s = gg (n.s ! attr ! Fem ++ mille ! n.size)} ;
|
||||
lin pot3plus n m =
|
||||
{s = table {g => n.s ! attr ! Fem ++ mille ! n.size ++ m.s ! indep ! g}} ;
|
||||
|
||||
--- TODO
|
||||
--- raz/odin
|
||||
}
|
||||
404
lib/resource/russian/ParadigmsRus.gf
Normal file
404
lib/resource/russian/ParadigmsRus.gf
Normal file
@@ -0,0 +1,404 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 Russian Lexical Paradigms
|
||||
--
|
||||
-- Aarne Ranta, Janna Khegai 2003
|
||||
--
|
||||
-- This is an API to the user of the resource grammar
|
||||
-- for adding lexical items. It give shortcuts for forming
|
||||
-- expressions of basic categories: nouns, adjectives, verbs.
|
||||
--
|
||||
-- Closed categories (determiners, pronouns, conjunctions) are
|
||||
-- accessed through the resource syntax API, $resource.Abs.gf$.
|
||||
--
|
||||
--
|
||||
-- The following files are presupposed:
|
||||
|
||||
resource ParadigmsRus = open (Predef=Predef), Prelude, SyntaxRus, ResourceRus in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
Gender : Type ;
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
neuter : Gender ;
|
||||
|
||||
-- To abstract over case names, we define the following.
|
||||
Case : Type ;
|
||||
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
dative : Case ;
|
||||
accusative : Case ;
|
||||
instructive : Case ;
|
||||
prepositional : Case ;
|
||||
|
||||
-- In some (written in English) textbooks accusative case
|
||||
-- is put on the second place. However, we follow the case order
|
||||
-- standard for Russian textbooks.
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
Number : Type ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Best case: indeclinabe nouns: "кофе", "пальто", "ВУЗ".
|
||||
Animacy: Type ;
|
||||
|
||||
animate: Animacy;
|
||||
inanimate: Animacy;
|
||||
|
||||
mkIndeclinableNoun: Str -> Gender -> Animacy -> N ;
|
||||
|
||||
-- Worst case - give six singular forms:
|
||||
-- Nominative, Genetive, Dative, Accusative, Instructive and Prepositional;
|
||||
-- corresponding six plural forms and the gender.
|
||||
-- May be the number of forms needed can be reduced,
|
||||
-- but this requires a separate investigation.
|
||||
-- Animacy parameter (determining whether the Accusative form is equal
|
||||
-- to the Nominative or the Genetive one) is actually of no help,
|
||||
-- since there are a lot of exceptions and the gain is just one form less.
|
||||
|
||||
mkN : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Animacy -> N ;
|
||||
|
||||
-- мужчина, мужчины, мужчине, мужчину, мужчиной, мужчине
|
||||
-- мужчины, мужчин, мужчинам, мужчин, мужчинами, мужчинах
|
||||
|
||||
|
||||
-- Here are some common patterns. The list is far from complete.
|
||||
|
||||
-- Feminine patterns.
|
||||
|
||||
nMashina : Str -> N ; -- feminine, inanimate, ending with "-а", Inst -"машин-ой"
|
||||
nEdinica : Str -> N ; -- feminine, inanimate, ending with "-а", Inst -"единиц-ей"
|
||||
nZhenchina : Str -> N ; -- feminine, animate, ending with "-a"
|
||||
nNoga : Str -> N ; -- feminine, inanimate, ending with "г_к_х-a"
|
||||
nMalyariya : Str -> N ; -- feminine, inanimate, ending with "-ия"
|
||||
nTetya : Str -> N ; -- feminine, animate, ending with "-я"
|
||||
nBol : Str -> N ; -- feminine, inanimate, ending with "-ь"(soft sign)
|
||||
|
||||
-- Neuter patterns.
|
||||
|
||||
nObezbolivauchee : Str -> N ; -- neutral, inanimate, ending with "-ee"
|
||||
nProizvedenie : Str -> N ; -- neutral, inanimate, ending with "-e"
|
||||
nChislo : Str -> N ; -- neutral, inanimate, ending with "-o"
|
||||
|
||||
-- Masculine patterns.
|
||||
|
||||
nStomatolog : Str -> N ; -- masculine, animate, ending with consonant
|
||||
|
||||
-- the next two differ only in
|
||||
-- plural nominative (= accusative) form(s) :
|
||||
nAdres : Str -> N ; -- адрес-а
|
||||
nTelefon : Str -> N ; -- телефон-ы
|
||||
-- masculine, inanimate, ending with consonant
|
||||
|
||||
nNol : Str -> N ; -- masculine, inanimate, ending with "-ь" (soft sign)
|
||||
nUroven : Str -> N ; -- masculine, inanimate, ending with "-ень"
|
||||
|
||||
-- Nouns used as functions need a preposition. The most common is with Genitive.
|
||||
|
||||
mkFun : N -> Preposition -> Case -> Fun ;
|
||||
funGen : N -> Fun ;
|
||||
|
||||
-- Proper names.
|
||||
|
||||
mkPN : Str -> Gender -> Animacy -> PN ; -- "Иван", "Маша"
|
||||
|
||||
-- On the top level, it is maybe $CN$ that is used rather than $N$, and
|
||||
-- $NP$ rather than $PN$.
|
||||
|
||||
mkCN : N -> CN ;
|
||||
mkNP : Str -> Gender -> Animacy -> NP ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
-- Non-comparison (only positive degree) one-place adjectives need 28 (4 by 7)
|
||||
-- forms in the worst case:
|
||||
|
||||
|
||||
-- Masculine | Feminine | Neutral | Plural
|
||||
-- Nominative
|
||||
-- Genitive
|
||||
-- Dative
|
||||
-- Accusative Inanimate
|
||||
-- Accusative Animate
|
||||
-- Instructive
|
||||
-- Prepositional
|
||||
|
||||
|
||||
-- Notice that 4 short forms, which exist for some adjectives are not included
|
||||
-- in the current description, otherwise there would be 32 forms for
|
||||
-- positive degree.
|
||||
|
||||
-- mkAdj1 : ( : Str) -> Adj1 ;
|
||||
|
||||
-- Invariable adjective is a special case.
|
||||
|
||||
adjInvar : Str -> Adj1 ; -- khaki, mini, hindi, netto
|
||||
|
||||
-- Some regular patterns depending on the ending.
|
||||
|
||||
adj1Staruyj : Str -> Adj1 ; -- ending with "-ый"
|
||||
adj1Malenkij : Str -> Adj1 ; -- endign with "-ий"
|
||||
adj1Molodoj : Str -> Adj1 ; -- ending with "-ой",
|
||||
-- plural - молод-ые"
|
||||
adj1Kakoj_Nibud : Str -> Str -> Adj1 ; -- ending with "-ой",
|
||||
-- plural - "как-ие"
|
||||
|
||||
-- Two-place adjectives need a preposition and a case as extra arguments.
|
||||
|
||||
mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- "делим на"
|
||||
|
||||
-- Comparison adjectives need a positive adjective
|
||||
-- (28 forms without short forms).
|
||||
-- Taking only one comparative form (non-syntaxic) and
|
||||
-- only one superlative form (syntaxic) we can produce the
|
||||
-- comparison adjective with only one extra argument -
|
||||
-- non-syntaxic comparative form.
|
||||
-- Syntaxic forms are based on the positive forms.
|
||||
|
||||
|
||||
mkAdjDeg : Adj1 -> Str -> AdjDeg ;
|
||||
|
||||
-- On top level, there are adjectival phrases. The most common case is
|
||||
-- just to use a one-place adjective.
|
||||
|
||||
ap : Adj1 -> IsPostfixAdj -> AP ;
|
||||
|
||||
|
||||
--2 Verbs
|
||||
--
|
||||
-- In our lexicon description ("Verbum") there are 62 forms:
|
||||
-- 2 (Voice) by { 1 (infinitive) + [2(number) by 3 (person)](imperative) +
|
||||
-- [ [2(Number) by 3(Person)](present) + [2(Number) by 3(Person)](future) +
|
||||
-- 4(GenNum)(past) ](indicative)+ 4 (GenNum) (subjunctive) }
|
||||
-- Participles (Present and Past) and Gerund forms are not included,
|
||||
-- since they fuction more like Adjectives and Adverbs correspondingly
|
||||
-- rather than verbs. Aspect regarded as an inherent parameter of a verb.
|
||||
-- Notice, that some forms are never used for some verbs. Actually,
|
||||
-- the majority of verbs do not have many of the forms.
|
||||
Voice: Type;
|
||||
Aspect: Type;
|
||||
Tense : Type;
|
||||
Bool: Type;
|
||||
|
||||
true: Bool;
|
||||
false: Bool;
|
||||
|
||||
active: Voice ;
|
||||
passive: Voice ;
|
||||
imperfective: Aspect;
|
||||
perfective: Aspect ;
|
||||
present : Tense ;
|
||||
past : Tense ;
|
||||
|
||||
|
||||
-- The worst case need 6 forms of the present tense in indicative mood
|
||||
-- ("я бегу", "ты бежишь", "он бежит", "мы бежим", "вы бежите", "они бегут"),
|
||||
-- a past form (singular, masculine: "я бежал"), an imperative form
|
||||
-- (singular, second person: "беги"), an infinitive ("бежать").
|
||||
-- Inherent aspect should also be specified.
|
||||
|
||||
mkVerbum : Aspect -> (_,_,_,_,_,_,_,_,_ : Str) -> Verbum ;
|
||||
|
||||
-- Common conjugation patterns are two conjugations:
|
||||
-- first - verbs ending with "-ать/-ять" and second - "-ить/-еть".
|
||||
-- Instead of 6 present forms of the worst case, we only need
|
||||
-- a present stem and one ending (singular, first person):
|
||||
-- "я люб-лю", "я жд-у", etc. To determine where the border
|
||||
-- between stem and ending lies it is sufficient to compare
|
||||
-- first person from with second person form:
|
||||
-- "я люб-лю", "ты люб-ишь". Stems shoud be the same.
|
||||
-- So the definition for verb "любить" looks like:
|
||||
-- mkRegVerb Imperfective Second "люб" "лю" "любил" "люби" "любить";
|
||||
|
||||
mkRegVerb :Aspect -> Conjugation -> (_,_,_,_,_ : Str) -> Verbum ;
|
||||
|
||||
-- For writing an application grammar one usualy 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.
|
||||
-- The "V" type, that have these parameters fixed.
|
||||
-- We can extract the "V" from the lexicon.
|
||||
|
||||
mkV: Verbum -> Voice -> Tense -> V ;
|
||||
mkPresentV: Verbum -> Voice -> V ;
|
||||
|
||||
|
||||
-- Two-place verbs, and the special case with direct object. Notice that
|
||||
-- a particle can be included in a $V$.
|
||||
|
||||
mkTV : V -> Str -> Case -> TV ; -- "войти в дом"; "в", accusative
|
||||
tvDir : V -> TV ; -- "видеть", "любить"
|
||||
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
--.
|
||||
Gender = SyntaxRus.Gender ;
|
||||
Case = SyntaxRus.Case ;
|
||||
Number = SyntaxRus.Number ;
|
||||
Animacy = SyntaxRus.Animacy;
|
||||
Aspect = SyntaxRus.Aspect;
|
||||
Voice = SyntaxRus.Voice ;
|
||||
Tense = SyntaxRus.Tense ;
|
||||
Bool = Prelude.Bool ;
|
||||
|
||||
true = True;
|
||||
false = False ;
|
||||
masculine = Masc ;
|
||||
feminine = Fem ;
|
||||
neuter = Neut ;
|
||||
nominative = Nom ;
|
||||
accusative = Acc ;
|
||||
dative = Dat ;
|
||||
genitive = Gen ;
|
||||
instructive = Inst ;
|
||||
prepositional = Prepos ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
animate = Animate ;
|
||||
inanimate = Inanimate ;
|
||||
active = Act ;
|
||||
passive = Pass ;
|
||||
imperfective = Imperfective ;
|
||||
perfective = Perfective ;
|
||||
present = Present ;
|
||||
past = Past ;
|
||||
-- Degree = Pos | Comp | Super ;
|
||||
-- Person = P1 | P2 | P3 ;
|
||||
-- AfterPrep = Yes | No ;
|
||||
-- Possessive = NonPoss | Poss GenNum ;
|
||||
|
||||
-- Noun definitions
|
||||
|
||||
mkIndeclinableNoun = \s,g, anim ->
|
||||
{
|
||||
s = table { SF _ _ => s } ;
|
||||
g = g ;
|
||||
anim = anim
|
||||
} ** {lock_N = <>};
|
||||
|
||||
|
||||
mkN = \nomSg, genSg, datSg, accSg, instSg, preposSg,
|
||||
nomPl, genPl, datPl, accPl, instPl, preposPl, g, anim ->
|
||||
{
|
||||
s = table {
|
||||
SF Sg Nom => nomSg ;
|
||||
SF Sg Gen => genSg ;
|
||||
SF Sg Dat => datSg ;
|
||||
SF Sg Acc => accSg ;
|
||||
SF Sg Inst => instSg ;
|
||||
SF Sg Prepos => preposSg ;
|
||||
SF Pl Nom => nomPl ;
|
||||
SF Pl Gen => genPl ;
|
||||
SF Pl Dat => datPl ;
|
||||
SF Pl Acc => accPl ;
|
||||
SF Pl Inst => instPl ;
|
||||
SF Pl Prepos => preposPl
|
||||
} ;
|
||||
g = g ;
|
||||
anim = anim
|
||||
} ** {lock_N = <>} ;
|
||||
|
||||
nMashina = \s -> aEndInAnimateDecl s ** {lock_N = <>};
|
||||
nEdinica = \s -> ej_aEndInAnimateDecl s ** {lock_N = <>};
|
||||
nZhenchina = \s -> (aEndAnimateDecl s) ** { g = Fem ; anim = Animate } ** {lock_N = <>};
|
||||
nNoga = \s -> aEndG_K_KH_Decl s ** {lock_N = <>};
|
||||
nMalyariya = \s -> i_yaEndDecl s ** {lock_N = <>};
|
||||
nTetya = \s -> (yaEndAnimateDecl s) ** {g = Fem; anim = Animate; lock_N = <>} ;
|
||||
nBol = \s -> softSignEndDeclFem s ** {lock_N = <>};
|
||||
|
||||
-- Neuter patterns.
|
||||
|
||||
nObezbolivauchee = \s -> eeEndInAnimateDecl s ** {lock_N = <>};
|
||||
nProizvedenie = \s -> eEndInAnimateDecl s ** {lock_N = <>};
|
||||
nChislo = \s -> oEndInAnimateDecl s ** {lock_N = <>};
|
||||
|
||||
|
||||
-- Masculine patterns.
|
||||
|
||||
nStomatolog = \s -> nullEndAnimateDecl s ** {lock_N = <>};
|
||||
|
||||
nAdres = \s -> nullEndInAnimateDecl2 s ** {lock_N = <>};
|
||||
nTelefon = \s -> nullEndInAnimateDecl1 s ** {lock_N = <>};
|
||||
|
||||
nNol = \s -> softSignEndDeclMasc s ** {lock_N = <>};
|
||||
nUroven = \s -> EN_softSignEndDeclMasc s ** {lock_N = <>};
|
||||
|
||||
-- mkFun defined in syntax.RusU
|
||||
-- funGen defined in syntax.RusU
|
||||
|
||||
mkPN = \ivan, g, anim ->
|
||||
case g of {
|
||||
Masc => mkProperNameMasc ivan anim ;
|
||||
_ => mkProperNameFem ivan anim
|
||||
} ** {lock_PN =<>};
|
||||
mkCN = UseN ;
|
||||
mkNP = \x,y,z -> UsePN (mkPN x y z) ;
|
||||
|
||||
-- Adjective definitions
|
||||
|
||||
adjInvar = \s -> { s = \\af => s } ** {lock_Adj1= <>};
|
||||
|
||||
adj1Staruyj s = uy_j_EndDecl s ** {lock_Adj1 = <>} ;
|
||||
adj1Malenkij s = ij_EndK_G_KH_Decl s ** {lock_Adj1= <>};
|
||||
adj1Molodoj s = uy_oj_EndDecl s ** {lock_Adj1= <>};
|
||||
adj1Kakoj_Nibud s t = i_oj_EndDecl s t ** {lock_Adj1= <>};
|
||||
|
||||
mkAdj2 a p c= mkAdjective2 a p c ** {lock_Adj2 = <>};
|
||||
-- mkAdjDeg defined in morpho.RusU
|
||||
|
||||
ap a p = mkAdjPhrase a p ** {lock_AP = <>}; -- defined in syntax module
|
||||
|
||||
-- Verb definitions
|
||||
|
||||
mkVerbum = \asp, sgP1, sgP2, sgP3, plP1, plP2, plP3,
|
||||
sgMascPast, imperSgP2, inf -> case asp of {
|
||||
Perfective =>
|
||||
mkVerb (perfectiveActivePattern inf imperSgP2
|
||||
(presentConj sgP1 sgP2 sgP3 plP1 plP2 plP3) (pastConj sgMascPast))
|
||||
(pastConj sgMascPast);
|
||||
Imperfective =>
|
||||
mkVerb (imperfectiveActivePattern inf imperSgP2
|
||||
(presentConj sgP1 sgP2 sgP3 plP1 plP2 plP3) (pastConj sgMascPast))
|
||||
(pastConj sgMascPast)
|
||||
};
|
||||
|
||||
oper presentConj: (_,_,_,_,_,_: Str) -> PresentVerb =
|
||||
\sgP1, sgP2, sgP3, plP1, plP2, plP3 ->
|
||||
table {
|
||||
PRF (ASg _) P1 => sgP1 ;
|
||||
PRF (ASg _) P2 => sgP2 ;
|
||||
PRF (ASg _) P3 => sgP3 ;
|
||||
PRF APl P1 => plP1 ;
|
||||
PRF APl P2 => plP2 ;
|
||||
PRF APl P3 => plP3
|
||||
};
|
||||
|
||||
|
||||
mkRegVerb = verbDecl ; -- defined in morpho.RusU.gf
|
||||
|
||||
mkV a b c = extVerb a b c ** {lock_V = <>}; -- defined in types.RusU.gf
|
||||
|
||||
mkPresentV = \aller, vox ->
|
||||
{ s = table {
|
||||
VFin gn p => aller.s ! VFORM vox (VIND (VPresent (numGNum gn) p)) ;
|
||||
VImper n p => aller.s ! VFORM vox (VIMP n p) ;
|
||||
VInf => aller.s ! VFORM vox VINF ;
|
||||
VSubj gn => aller.s ! VFORM vox (VSUB gn)
|
||||
}; t = Present ; a = aller.asp ; w = vox ; lock_V = <>} ;
|
||||
|
||||
mkTV a b c = mkTransVerb a b c ** {lock_TV = <>}; -- defined in syntax.RusU.gf
|
||||
tvDir v = mkDirectVerb v ** {lock_TV = <>}; -- defined in syntax.RusU.gf
|
||||
|
||||
} ;
|
||||
3
lib/resource/russian/ResourceRus.gf
Normal file
3
lib/resource/russian/ResourceRus.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
instance ResourceRus of Resource = reuse AllResourceRus ;
|
||||
142
lib/resource/russian/RulesRus.gf
Normal file
142
lib/resource/russian/RulesRus.gf
Normal file
@@ -0,0 +1,142 @@
|
||||
concrete RulesRus of Rules = CategoriesRus ** open Prelude, SyntaxRus in {
|
||||
|
||||
lin
|
||||
|
||||
UsePN = nameNounPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PredVP = predVerbPhrase ;
|
||||
UseA1 = adj2adjPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModGenOne = npGenDet Sg noNum ;
|
||||
ModGenNum = npGenDet Pl ;
|
||||
UseN2 = funAsCommNounPhrase ;
|
||||
AppN2 = appFunComm ;
|
||||
AppN3 = appFun2 ;
|
||||
PositADeg = positAdjPhrase ;
|
||||
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 ;
|
||||
|
||||
--- 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 ;
|
||||
IndefNumNP = indefNounPhraseNum Pl ;
|
||||
DefOneNP = indefNounPhrase Sg ;
|
||||
DefNumNP = indefNounPhraseNum Pl ;
|
||||
MassNP = indefNounPhrase Sg;
|
||||
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV v = v ; -- From Swedish: PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredV2 = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV v = v ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = 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 ;
|
||||
AdvVP = adVerbPhrase ;
|
||||
--LocNP = locativeNounPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
--From Swedish: AdvPP p = p ;
|
||||
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ;
|
||||
ThereNP = thereIs ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelVP = relVerbPhrase ;
|
||||
RelSlash = relSlash ;
|
||||
ModRC = modRelClause ;
|
||||
RelSuch = relSuch ;
|
||||
|
||||
WhoOne = intPronKto Sg ;
|
||||
WhoMany = intPronKto Pl ;
|
||||
WhatOne = intPronChto Sg ;
|
||||
WhatMany = intPronChto Pl ;
|
||||
FunIP = funIntPron ;
|
||||
NounIPOne = nounIntPron Sg ;
|
||||
NounIPMany = nounIntPron Pl ;
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
IsThereNP = isThere ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
-- From Swedish: PrepS p = ss (p.s ++ ",") ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance Masc Sg ;
|
||||
ImperMany = imperUtterance Masc Pl ;
|
||||
AdvS = advSentence ;
|
||||
|
||||
TwoS = twoSentence ;
|
||||
ConsS = consSentence ;
|
||||
ConjS = conjunctSentence ;
|
||||
ConjDS = conjunctDistrSentence ;
|
||||
|
||||
TwoAP = twoAdjPhrase ;
|
||||
ConsAP = consAdjPhrase ;
|
||||
ConjAP = conjunctAdjPhrase ;
|
||||
ConjDAP = conjunctDistrAdjPhrase ;
|
||||
|
||||
TwoNP = twoNounPhrase ;
|
||||
ConsNP = consNounPhrase ;
|
||||
ConjNP = conjunctNounPhrase ;
|
||||
ConjDNP = conjunctDistrNounPhrase ;
|
||||
|
||||
SubjS = subjunctSentence ;
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQu = subjunctQuestion ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase Sg ;
|
||||
PhrManyCN = useCommonNounPhrase Pl ;
|
||||
PhrIP ip = postfixSS "?" ip ;
|
||||
PhrIAdv ia = postfixSS "?" ia ;
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
|
||||
} ;
|
||||
|
||||
136
lib/resource/russian/StructuralRus.gf
Normal file
136
lib/resource/russian/StructuralRus.gf
Normal file
@@ -0,0 +1,136 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level Russian Resource Grammar
|
||||
--
|
||||
-- Janna Khegai 2003
|
||||
-- on the basis of code for other languages by Aarne Ranta
|
||||
--
|
||||
-- This is the Russian concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $syntax.RusU.gf$.
|
||||
-- However, for the purpose of documentation, we make here explicit the
|
||||
-- linearization types of each category, so that their structures and
|
||||
-- dependencies can be seen.
|
||||
-- Another substantial part is the linearization rules of some
|
||||
-- structural words.
|
||||
--
|
||||
-- The users of the resource grammar should not look at this file for the
|
||||
-- linearization rules, which are in fact hidden in the document version.
|
||||
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||
-- one has to know how the syntactic categories are
|
||||
-- implemented. The parameter types are defined in $types.RusU.gf$.
|
||||
|
||||
concrete StructuralRus of Structural = CategoriesRus, NumeralsRus ** open Prelude, SyntaxRus in {
|
||||
flags
|
||||
coding=utf8 ;
|
||||
|
||||
lin
|
||||
INP = pron2NounPhrase pronYa Animate;
|
||||
ThouNP = pron2NounPhrase pronTu Animate;
|
||||
HeNP = pron2NounPhrase pronOn Animate;
|
||||
SheNP = pron2NounPhrase pronOna Animate;
|
||||
ItNP = pron2NounPhrase pronOno Inanimate;
|
||||
WeNumNP = pronWithNum (pron2NounPhrase pronMu Animate);
|
||||
YeNumNP = pronWithNum (pron2NounPhrase pronVu Animate);
|
||||
YouNP = pron2NounPhrase pronVu Animate;
|
||||
TheyNP = pron2NounPhrase pronOni Animate;
|
||||
TheyFemNP = pron2NounPhrase pronOni Animate;
|
||||
|
||||
EveryDet = kazhdujDet ** {n = Sg ; g = PNoGen; c= Nom} ;
|
||||
AllMassDet = vesDet ** {n = Sg; g = PNoGen; c = Nom} ;
|
||||
AllNumDet = mkDeterminerNum (vseDetPl ** {n = Pl; g = PNoGen; c = Nom} );
|
||||
WhichDet = kotorujDet ** {n = Sg; g = PNoGen; c= Nom} ;
|
||||
WhichNumDet = mkDeterminerNum (kotorujDet ** {n = Pl; g = PNoGen; c= Nom} );
|
||||
MostDet = bolshinstvoSgDet ** {n = Sg; g = (PGen Neut); c= Gen} ;
|
||||
-- inanimate, Sg: "большинство телефонов безмолству-ет"
|
||||
MostsDet = bolshinstvoPlDet ** {n = Pl; g = (PGen Neut); c= Gen} ;
|
||||
-- animate, Pl: "большинство учащихся хорошо подготовлен-ы"
|
||||
HowManyDet = skolkoSgDet ** {n = Sg; g = (PGen Neut); c= Gen};
|
||||
ManyDet = mnogoSgDet ** {n = Sg; g = (PGen Neut); c= Gen} ;
|
||||
MuchDet = mnogoSgDet ** {n = Sg; g = (PGen Neut); c= Gen} ; -- same as previous
|
||||
SomeDet = nekotorujDet ** {n = Sg; g = PNoGen; c= Nom} ;
|
||||
SomeNumDet = mkDeterminerNum (nekotorujDet ** {n = Pl; g = PNoGen; c= Nom} );
|
||||
AnyDet = lubojDet ** {n = Sg; g = PNoGen; c= Nom} ;
|
||||
AnyNumDet = mkDeterminerNum (lubojDet ** {n = Pl; g = PNoGen; c= Nom} );
|
||||
NoDet = nikakojDet ** {n = Sg; g = PNoGen; c= Nom} ;
|
||||
NoNumDet = mkDeterminerNum (nikakojDet ** {n = Pl; g = PNoGen; c= Nom} );
|
||||
ThisDet = etotDet ** {n = Sg; g = PNoGen; c= Nom} ;
|
||||
TheseNumDet = mkDeterminerNum (etotDet ** {n = Pl; g = PNoGen; c= Nom} );
|
||||
ThatDet = totDet ** {n = Sg; g = PNoGen; c= Nom} ;
|
||||
ThoseNumDet = mkDeterminerNum (totDet ** {n = Pl; g = PNoGen; c= Nom} );
|
||||
|
||||
UseNumeral i = i ;
|
||||
|
||||
ThisNP = det2NounPhrase etotDet ; -- inanimate form only
|
||||
ThatNP = det2NounPhrase totDet ; -- inanimate form only
|
||||
TheseNumNP n = { s =\\_ => [] ; n = Pl; p = P3; g= PGen Fem ; anim = Animate ; pron = True} ;
|
||||
-- missing in Russian
|
||||
ThoseNumNP n = { s =\\_ => [] ; n = Pl; p = P3; g=PGen Fem ; anim = Animate ; pron = True} ;
|
||||
-- missing in Russian
|
||||
|
||||
EverybodyNP = mkNounPhrase Pl (noun2CommNounPhrase (eEnd_Decl "вс")) ;
|
||||
SomebodyNP = pron2NounPhrase pronKtoTo Animate;
|
||||
NobodyNP = pron2NounPhrase pronNikto Animate;
|
||||
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 ;
|
||||
|
||||
HowIAdv = ss "как" ;
|
||||
WhenIAdv = ss "когда" ;
|
||||
WhereIAdv = ss "где" ;
|
||||
WhyIAdv = ss "почему" ;
|
||||
|
||||
AndConj = ss "и" ** {n = Pl} ;
|
||||
OrConj = ss "или" ** {n = Sg} ;
|
||||
BothAnd = sd2 "как" [", так и"] ** {n = Pl} ;
|
||||
EitherOr = sd2 "либо" [", либо"] ** {n = Sg} ;
|
||||
-- comma is not visible in GUI!
|
||||
|
||||
-- In case of "neither.. no" expression double negation is not
|
||||
-- only possible, but also required in Russian.
|
||||
-- There is no means of control for this however in the resource grammar.
|
||||
|
||||
NeitherNor = sd2 "ни" [", ни"] ** {n = Sg} ;
|
||||
|
||||
IfSubj = ss "если" ;
|
||||
WhenSubj = ss "когда" ;
|
||||
AlthoughSubj = ss "хотя" ;
|
||||
|
||||
PhrYes = ss ["Да ."] ;
|
||||
PhrNo = ss ["Нет ."] ;
|
||||
|
||||
EverywhereNP = ss "везде" ;
|
||||
SomewhereNP = ss "где-нибудь" ;
|
||||
NowhereNP = ss "нигде" ;
|
||||
VeryAdv = ss "очень" ;
|
||||
TooAdv = ss "слишком" ;
|
||||
OtherwiseAdv = ss "иначе" ;
|
||||
AlmostAdv = ss "почти" ;
|
||||
QuiteAdv = ss "довольно" ;
|
||||
ThereforeAdv = ss "следовательно" ;
|
||||
|
||||
InPrep = { s2 = "в" ; c = Prepos };
|
||||
OnPrep = { s2 = "на" ; c = Prepos };
|
||||
ToPrep = { s2 = "к" ; c = Dat };
|
||||
ThroughPrep = { s2 = "через" ; c = Acc };
|
||||
AbovePrep = { s2 = "над" ; c = Inst};
|
||||
UnderPrep = { s2 = "под" ; c = Inst };
|
||||
InFrontPrep = { s2 = "перед" ; c = Inst};
|
||||
BehindPrep = { s2 = "за" ; c = Inst };
|
||||
BetweenPrep = { s2 = "между" ; c = Inst};
|
||||
FromPrep = { s2 = "от" ; c = Gen };
|
||||
BeforePrep = { s2 = "перед" ; c = Inst};
|
||||
DuringPrep = { s2 = ["в течение"] ; c = Gen};
|
||||
AfterPrep = { s2 = "после" ; c = Gen };
|
||||
WithPrep = { s2 = "с" ; c = Inst};
|
||||
WithoutPrep = { s2 = "без" ; c = Gen};
|
||||
ByMeansPrep = { s2 = ["с помощью"] ; c = Gen};
|
||||
PossessPrep = { s2 = "" ; c = Gen}; --- ?? AR 19/2/2004
|
||||
PartPrep = { s2 = "" ; c = Nom}; -- missing in Russian
|
||||
AgentPrep = { s2 = "" ; c = Nom}; -- missing in Russian
|
||||
} ;
|
||||
1047
lib/resource/russian/SyntaxRus.gf
Normal file
1047
lib/resource/russian/SyntaxRus.gf
Normal file
File diff suppressed because it is too large
Load Diff
53
lib/resource/russian/TestResourceRus.gf
Normal file
53
lib/resource/russian/TestResourceRus.gf
Normal file
@@ -0,0 +1,53 @@
|
||||
-- use this path to read the grammar from the same directory
|
||||
--# -path=.:../abstract:../../prelude
|
||||
concrete TestResourceRus of TestResource = StructuralRus ** open SyntaxRus in {
|
||||
|
||||
flags
|
||||
coding=utf8 ;
|
||||
startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
|
||||
|
||||
-- a random sample from the lexicon
|
||||
|
||||
lin
|
||||
Big = bolshoj ;
|
||||
Small = malenkij ;
|
||||
Old = staruj ;
|
||||
Young = molodoj ;
|
||||
|
||||
Connection = (noun2CommNounPhrase (doroga) )** {s2 = "из" ; c = Gen; s3 = "в"; c2=Acc} ;
|
||||
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 ;
|
||||
Bar = bar ;
|
||||
Bottle = butyulka ;
|
||||
Wine = vino ;
|
||||
Drink = mkDirectVerb (extVerb verbPit Act Present ) ;
|
||||
Happy = schastlivyuj ;
|
||||
|
||||
Man = muzhchina ;
|
||||
Woman = zhenchina ;
|
||||
Car = mashina ;
|
||||
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 ) ;
|
||||
|
||||
Mother = funGen mama ;
|
||||
Uncle = funGen dyadya ;
|
||||
|
||||
Always = vsegda ;
|
||||
Well = chorosho ;
|
||||
|
||||
John = mkProperNameMasc "Иван" Animate ;
|
||||
Mary = mkProperNameFem "Маш" Animate ;
|
||||
};
|
||||
293
lib/resource/russian/TypesRus.gf
Normal file
293
lib/resource/russian/TypesRus.gf
Normal file
@@ -0,0 +1,293 @@
|
||||
--1 Russian Word Classes and Morphological Parameters
|
||||
--
|
||||
-- Aarne Ranta, Janna Khegai 2003
|
||||
--
|
||||
-- This is a resource module for Russian morphology, defining the
|
||||
-- morphological parameters and word classes of Russian. It is aimed
|
||||
-- to be complete w.r.t. the description of word forms.
|
||||
-- However, it does not include those parameters that are not needed for
|
||||
-- analysing individual words: such parameters are defined in syntax modules.
|
||||
--
|
||||
|
||||
resource TypesRus = open Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
--2 Enumerated parameter types
|
||||
--
|
||||
-- These types are the ones found in school grammars.
|
||||
-- Their parameter values are atomic.
|
||||
|
||||
param
|
||||
Gender = Masc | Fem | Neut ;
|
||||
Number = Sg | Pl ;
|
||||
Case = Nom | Gen | Dat | Acc | Inst | Prepos ;
|
||||
Voice = Act | Pass ;
|
||||
Aspect = Imperfective | Perfective ;
|
||||
Tense = Present | Past ;
|
||||
Degree = Pos | Comp | Super ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
AfterPrep = Yes | No ;
|
||||
Possessive = NonPoss | Poss GenNum ;
|
||||
Animacy = Animate | Inanimate ;
|
||||
|
||||
-- A number of Russian nouns have common gender. They can
|
||||
-- denote both males and females: "умница" (a clever person), "инженер" (an engineer).
|
||||
-- We overlook this phenomenon for now.
|
||||
|
||||
-- The AfterPrep parameter is introduced in order to describe
|
||||
-- the variations of the third person personal pronoun forms
|
||||
-- depending on whether they come after a preposition or not.
|
||||
|
||||
-- The Possessive parameter is introduced in order to describe
|
||||
-- the possessives of personal pronouns, which are used in the
|
||||
-- Genetive constructions like "мама моя" (my mother) instead of
|
||||
-- "мама меня" (the mother of mine).
|
||||
|
||||
--2 Word classes and hierarchical parameter types
|
||||
--
|
||||
-- Real parameter types (i.e. ones on which words and phrases depend)
|
||||
-- are mostly hierarchical. The alternative would be cross-products of
|
||||
-- simple parameters, but this would usually overgenerate.
|
||||
|
||||
-- However, we use the cross-products in complex cases
|
||||
-- (for example, aspect and tense parameter in the verb description)
|
||||
-- where the relationship between the parameters are non-trivial
|
||||
-- even though we aware that some combinations do not exist
|
||||
-- (for example, present perfective does not exist, but removing
|
||||
-- this combination would lead to having different descriptions
|
||||
-- for perfective and imperfective verbs, which we do not want for the
|
||||
-- sake of uniformity).
|
||||
|
||||
--3 Nouns
|
||||
--
|
||||
-- Common nouns decline according to number and case.
|
||||
-- For the sake of shorter description these parameters are
|
||||
-- combined in the type SubstForm.
|
||||
|
||||
|
||||
param SubstForm = SF Number Case ;
|
||||
|
||||
-- Substantives moreover have an inherent gender.
|
||||
|
||||
oper
|
||||
CommNoun : Type = {s : SubstForm => Str ; g : Gender ; anim : Animacy } ;
|
||||
numSF: SubstForm -> Number = \sf -> case sf of
|
||||
{
|
||||
SF Sg _ => Sg ;
|
||||
_ => Pl
|
||||
} ;
|
||||
|
||||
caseSF: SubstForm -> Case = \sf -> case sf of
|
||||
{
|
||||
SF _ Nom => Nom ;
|
||||
SF _ Gen => Gen ;
|
||||
SF _ Dat => Dat ;
|
||||
SF _ Inst => Inst ;
|
||||
SF _ Acc => Acc ;
|
||||
SF _ Prepos => Prepos
|
||||
} ;
|
||||
|
||||
--
|
||||
--3 Pronouns
|
||||
--
|
||||
|
||||
oper
|
||||
Pronoun : Type = { s : PronForm => Str ; n : Number ;
|
||||
p : Person ; g: PronGen ; pron: Bool} ;
|
||||
|
||||
param PronForm = PF Case AfterPrep Possessive;
|
||||
|
||||
-- Gender is not morphologically determined for first
|
||||
-- and second person pronouns.
|
||||
|
||||
PronGen = PGen Gender | PNoGen ;
|
||||
|
||||
-- The following coercion is useful:
|
||||
|
||||
oper
|
||||
pgen2gen : PronGen -> Gender = \p -> case p of {
|
||||
PGen g => g ;
|
||||
PNoGen => variants {Masc ; Fem} --- the best we can do for ya, tu
|
||||
} ;
|
||||
|
||||
oper
|
||||
extCase: PronForm -> Case = \pf -> case pf of
|
||||
{ PF Nom _ _ => Nom ;
|
||||
PF Gen _ _ => Gen ;
|
||||
PF Dat _ _ => Dat ;
|
||||
PF Inst _ _ => Inst ;
|
||||
PF Acc _ _ => Acc ;
|
||||
PF Prepos _ _ => Prepos
|
||||
} ;
|
||||
|
||||
mkPronForm: Case -> AfterPrep -> Possessive -> PronForm =
|
||||
\c,n,p -> PF c n p ;
|
||||
|
||||
--3 Adjectives
|
||||
--
|
||||
-- Adjectives is a very complex class.
|
||||
-- The major division is between the comparison degrees.
|
||||
|
||||
param
|
||||
AdjForm = AF Case Animacy GenNum | AdvF;
|
||||
|
||||
-- Declination forms depend on Case, Animacy , Gender:
|
||||
-- "большие дома" - "больших домов" (big houses - big houses'),
|
||||
-- Animacy plays role only in the Accusative case (Masc Sg and Plural forms):
|
||||
-- Accusative Animate = Genetive, Accusaive Inanimate = Nominative
|
||||
-- "я люблю большие дома"-"я люблю больших мужчин"
|
||||
-- (I love big houses - I love big men);
|
||||
-- and on Number: "большой дом" - "большие дома"
|
||||
-- (a big house - big houses).
|
||||
-- The plural never makes a gender distinction.
|
||||
|
||||
GenNum = ASg Gender | APl ;
|
||||
|
||||
oper numGNum : GenNum -> Number = \gn ->
|
||||
case gn of { APl => Pl ; _ => Sg } ;
|
||||
|
||||
oper genGNum : GenNum -> Gender = \gn ->
|
||||
case gn of { ASg Fem => Fem; _ => Masc } ;
|
||||
|
||||
oper numAF: AdjForm -> Number = \af ->
|
||||
case af of { AdvF => Sg; AF _ _ gn => (numGNum gn) } ;
|
||||
|
||||
oper genAF: AdjForm -> Gender = \af ->
|
||||
case af of { AdvF => Neut; AF _ _ gn => (genGNum gn) } ;
|
||||
|
||||
oper caseAF: AdjForm -> Case = \af ->
|
||||
case af of { AdvF => Nom; AF c _ _ => c } ;
|
||||
|
||||
-- The Degree parameter should also be more complex, since most Russian
|
||||
-- adjectives have two comparative forms:
|
||||
-- attributive (syntactic (compound), declinable) -
|
||||
-- "более высокий" (corresponds to "more high")
|
||||
-- and predicative (indeclinable)- "выше" (higher) and more than one
|
||||
-- superlative forms: "самый высокий" (corresponds to "the most high") -
|
||||
-- "наивысший" (the highest).
|
||||
|
||||
-- Even one more parameter independent of the degree can be added,
|
||||
-- since Russian adjectives in the positive degree also have two forms:
|
||||
-- long (attributive and predicative) - "высокий" (high) and short (predicative) - "высок"
|
||||
-- although this parameter will not be exactly orthogonal to the
|
||||
-- degree parameter.
|
||||
-- Short form has no case declension, so in principle
|
||||
-- it can be considered as an additional case.
|
||||
|
||||
-- Note: although the predicative usage of the long
|
||||
-- form is perfectly grammatical, it can have a slightly different meaning
|
||||
-- compared to the short form.
|
||||
-- For example: "он - больной" (long, predicative) vs.
|
||||
-- "он - болен" (short, predicative).
|
||||
|
||||
oper
|
||||
AdjDegr : Type = {s : Degree => AdjForm => Str} ;
|
||||
|
||||
-- Adjective type includes both non-degree adjective classes:
|
||||
-- possesive ("мамин"[mother's], "лисий" [fox'es])
|
||||
-- and relative ("русский" [Russian]) adjectives.
|
||||
|
||||
Adjective : Type = {s : AdjForm => Str} ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
|
||||
-- Mood is the main verb classification parameter.
|
||||
-- The verb mood can be infinitive, subjunctive, imperative, and indicative.
|
||||
|
||||
-- Note: subjunctive mood is analytical, i.e. formed from the past form of the
|
||||
-- indicative mood plus the particle "бы". That is why they have the same GenNum
|
||||
-- parameter. We choose to keep the "redundant" form in order to indicate
|
||||
-- the presence of the subjunctive mood in Russian verbs.
|
||||
|
||||
-- Aspect and Voice parameters are present in every mood, so Voice is put
|
||||
-- before the mood parameter in verb form description the hierachy.
|
||||
-- Moreover Aspect is regarded as an inherent parameter of a verb entry.
|
||||
-- The primary reason for that is that one imperfective form can have several
|
||||
-- perfective forms: "ломать" - "с-ломать" - "по-ломать" (to break).
|
||||
-- Besides, the perfective form could be formed from imperfective
|
||||
-- by prefixation, but also by taking a completely different stem:
|
||||
-- "говорить"-"сказать" (to say). In the later case it is even natural to
|
||||
-- regard them as different verb entries.
|
||||
-- Another reason is that looking at the Aspect as an inherent verb parameter
|
||||
-- seem to be customary in other similar projects:
|
||||
-- http://starling.rinet.ru/morph.htm
|
||||
|
||||
-- Note: Of course, the whole inflection table has many redundancies
|
||||
-- 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).
|
||||
|
||||
-- Depending on the tense verbs conjugate according to combinations
|
||||
-- of gender, person and number of the verb objects.
|
||||
-- Participles (Present and Past) and Gerund forms are not included in the
|
||||
-- current description. This is the verb type used in the lexicon:
|
||||
|
||||
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 ;
|
||||
|
||||
-- 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.
|
||||
-- So we define the "Verb" type, that have these parameters fixed.
|
||||
-- The conjugation parameters left (Gender, Number, Person)
|
||||
-- are combined in the "VF" type:
|
||||
|
||||
param VF =
|
||||
VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum;
|
||||
|
||||
oper
|
||||
Verb : Type = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ;
|
||||
|
||||
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))
|
||||
} ;
|
||||
VImper n p => aller.s ! VFORM vox (VIMP n p) ;
|
||||
VInf => aller.s ! VFORM vox VINF ;
|
||||
VSubj gn => aller.s ! VFORM vox (VSUB gn)
|
||||
}; t = t ; a = aller.asp ; w = vox } ;
|
||||
|
||||
|
||||
--3 Other open classes
|
||||
--
|
||||
-- Proper names and adverbs are the remaining open classes.
|
||||
|
||||
oper
|
||||
PNm : Type = {s : Case => Str ; g : Gender} ;
|
||||
|
||||
-- Adverbials are not inflected (we ignore comparison, and treat
|
||||
-- compared adverbials as separate expressions; this could be done another way).
|
||||
|
||||
Adverb : Type = SS ;
|
||||
|
||||
|
||||
--3 Closed classes
|
||||
--
|
||||
-- The rest of the Russian word classes are closed, i.e. not extensible by new
|
||||
-- lexical entries. Thus we don't have to know how to build them, but only
|
||||
-- how to use them, i.e. which parameters they have.
|
||||
--
|
||||
|
||||
--3 Relative pronouns
|
||||
--
|
||||
-- Relative pronouns are inflected in
|
||||
-- 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
|
||||
-- the internal Haskell error during grammar compilation (heap size exausted)!
|
||||
Preposition = { s2: Str; c: Case };
|
||||
};
|
||||
Reference in New Issue
Block a user