1
0
forked from GitHub/gf-core

*** empty log message ***

This commit is contained in:
janna
2004-01-04 21:03:27 +00:00
parent 1dcf3b8f50
commit 122d2592b2
4 changed files with 192 additions and 136 deletions

View File

@@ -269,7 +269,7 @@ oper pronChtoTo: Pronoun =
{ s = table { { s = table {
PF Nom _ _ => "что-то" ; PF Nom _ _ => "что-то" ;
PF Gen _ _ => "чего-то" ; PF Gen _ _ => "чего-то" ;
PF Dat _ _ => "чему-то" ; PF Dat _ _ => "чему-то" ;
PF Acc _ _ => "что-то" ; PF Acc _ _ => "что-то" ;
PF Inst _ _ => "чем-то" ; PF Inst _ _ => "чем-то" ;
PF Prepos _ _ => "чём-то" PF Prepos _ _ => "чём-то"
@@ -1022,7 +1022,7 @@ oper verbPredpochitat : Verbum = verbDecl Imperfective First "предпочит
-- 2 Adverbs -- 2 Adverbs
oper vsegda: Adverb = { s = "всегда" } ; oper vsegda: Adverb = { s = "всегда" } ;
oper chorosho: Adverb = { s = "хорошо" } ; oper chorosho: Adverb = { s = "хорошо" } ;
@@ -1051,52 +1051,67 @@ oper AspectVoice: Type = { s : VerbConj => Str ; asp: Aspect } ;
oper verbBegat : Verbum = verbDecl Imperfective First "бега" "ю" "бегал" "бегай" "бегать"; oper verbBegat : Verbum = verbDecl Imperfective First "бега" "ю" "бегал" "бегай" "бегать";
oper verbPrinimat : Verbum = verbDecl Imperfective First "принима" "ю" "принимал" "принимай" "принимать"; oper verbPrinimat : Verbum = verbDecl Imperfective First "принима" "ю" "принимал" "принимай" "принимать";
oper verbDokazuvat : Verbum = verbDecl Imperfective First "доказыва" "ю" "доказывал" "доказывай" "доказывать"; oper verbDokazuvat : Verbum = verbDecl Imperfective First "доказыва" "ю" "доказывал" "доказывай" "доказывать";
oper verbPredpochitat : Verbum = verbDecl Imperfective First "предпочита" "ю" "предпочитал" "предпочитай" "предпочитать"; oper verbPredpochitat : Verbum = verbDecl Imperfective First "предпочита" "ю" "предпочитал" "предпочитай" "предпочитать";
oper verbOtpravlyat : Verbum = verbDecl Imperfective First "отправля" "ю" "отправлял" "отправляй" "отправлять"; oper verbOtpravlyat : Verbum = verbDecl Imperfective First "отправля" "ю" "отправлял" "отправляй" "отправлять";
oper verbSlomat : Verbum = verbDecl Perfective First "слома" "ю" "сломал" "сломай" "сломать"; oper verbSlomat : Verbum = verbDecl Perfective First "слома" "ю" "сломал" "сломай" "сломать";
oper verbByut : Verbum = verbDecl Perfective First "буд" "у" "был" "будь" "быть"; oper verbByut : Verbum = verbDecl Perfective First "буд" "у" "был" "будь" "быть";
oper verbMoch : Verbum = verbDecl Imperfective First "мог" "у" "мог" "моги" "мочь"; oper verbMoch : Verbum = verbDeclMoch Imperfective First "мог" "у" "мог" "моги" "мочь" "мож";
-- Verbs with vowel "ё": "даёшь" (give), "пьёшь" (drink) : -- Verbs with vowel "ё": "даёшь" (give), "пьёшь" (drink) :
oper verbDavat : Verbum = verbDecl Imperfective FirstE "да" "ю" "давал" "давай" "давать"; oper verbDavat : Verbum = verbDecl Imperfective FirstE "да" "ю" "давал" "давай" "давать";
oper verbPit : Verbum = verbDecl Imperfective FirstE "пь" "ю" "пил" "пей" "пить"; oper verbPit : Verbum = verbDecl Imperfective FirstE "пь" "ю" "пил" "пей" "пить";
--3 Second conjugation (in Present) verbs :
oper verbLubit : Verbum = verbDecl Imperfective Second "люб" "лю" "любил" "люби" "любить";
oper verbGovorit : Verbum = verbDecl Imperfective Second "говор" "ю" "говорил" "говори" "говорить";
oper verbBolet_2 : Verbum = verbDecl Imperfective Second "бол" "ю" "болел" "боли" "болеть"; oper verbBolet_2 : Verbum = verbDecl Imperfective Second "бол" "ю" "болел" "боли" "болеть";
oper verbPoranit : Verbum = verbDecl Perfective Second "поран" "ю" "поранил" "порань" "поранить"; oper verbPoranit : Verbum = verbDecl Perfective Second "поран" "ю" "поранил" "порань" "поранить";
oper verbLubit : Verbum = verbDecl Imperfective Second "люб" "лю" "любил" "люби" "любить";
oper verbGovorit : Verbum = verbDecl Imperfective Second "говор" "ю" "говорил" "говори" "говорить"; -- Irregular Mixed:
oper verbKhotet : Verbum = verbDecl Imperfective Mixed "хоч" "у" "хотел" "хоти" "хотеть";
oper verbBolet_2 : Verbum = verbDecl Imperfective Second "бол" "ю" "болел" "боли" "болеть";
oper verbPoranit : Verbum = verbDecl Perfective Second "поран" "ю" "поранил" "порань" "поранить"; -- Irregular
oper verbDolzhen : Verbum = verbDecl Imperfective Dolzhen "долж" "ен" "долж" ["будь должен"] ["быть должным"] ;
-- To reduces the redundancies in the definitions -- To reduces the redundancies in the definitions
-- we introduce some intermediate types, -- we introduce some intermediate types,
-- Irregular -- so that the full type can be described as a combination
oper verbDolzhen : Verbum = verbDecl Imperfective Dolzhen "долж" "ен" "долж" ["будь должен"] ["быть должным"] ; -- of the intermediate types. For example "AspectVoice"
-- is a type for defining a pattern for a particular
-- To reduces the redundancies in the definitions -- aspect and voice.
-- we introduce some intermediate types,
-- so that the full type can be described as a combination oper AspectVoice: Type = { s : VerbConj => Str ; asp: Aspect } ;
-- "PresentVerb" takes care of the present tense conjugation. -- "PresentVerb" takes care of the present tense conjugation.
param PresentVF = PRF GenNum Person; param PresentVF = PRF GenNum Person;
oper AspectVoice: Type = { s : VerbConj => Str ; asp: Aspect } ; oper PresentVerb : Type = PresentVF => Str ;
oper presentConjDolzhen: Str -> Str -> PresentVerb = \del, sgP1End ->
-- "PresentVerb" takes care of the present tense conjugation. table {
PRF APl _ => del+ "ны" ;
param PresentVF = PRF Number Person ; PRF (ASg Masc) P1 => del+ sgP1End ;
oper PresentVerb : Type = PresentVF => Str ; PRF (ASg Fem) P1 => del+ "на" ;
PRF (ASg Neut) P1 => del+ "но" ; PRF (ASg Neut) P1 => del+ "но" ;
PRF (ASg Masc) P2 => del+ sgP1End ; PRF (ASg Masc) P2 => del+ sgP1End ;
PRF (ASg Fem) P2 => del+ "на" ; PRF (ASg Fem) P2 => del+ "на" ;
PRF Sg P2 => del+ sgP1End ; PRF (ASg Neut) P2 => del+ "но" ;
PRF Sg P3 => del+ "на" ; PRF (ASg Masc) P3 => del+ sgP1End ;
PRF Pl _ => del+ "ны" PRF (ASg Fem) P3 => del+ "на" ;
}; PRF (ASg Neut) P3 => del+ "но" };
oper presentConjMixed: Str -> Str -> PresentVerb = \del, sgP1End -> oper presentConjMixed: Str -> Str -> PresentVerb = \del, sgP1End ->
table {
PRF (ASg _) P1 => del+ sgP1End ;
PRF (ASg _) P2 => del+ "ешь" ;
PRF (ASg _) P3 => del+ "ет" ;
PRF APl P1 => del+ "им" ;
PRF APl P2 => del+ "ите" ;
PRF APl P3 => del+ "ят"
};
oper presentConj2: Str -> Str -> PresentVerb = \del, sgP1End ->
table {
PRF (ASg _) P1 => del+ sgP1End ; PRF (ASg _) P1 => del+ sgP1End ;
PRF (ASg _) P2 => del+ "ишь" ; PRF (ASg _) P2 => del+ "ишь" ;
PRF (ASg _) P3 => del+ "ит" ; PRF (ASg _) P3 => del+ "ит" ;
@@ -1140,6 +1155,14 @@ oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum
-- "PastVerb" takes care of the past tense conjugation. -- "PastVerb" takes care of the past tense conjugation.
param PastVF = PSF GenNum ; param PastVF = PSF GenNum ;
oper PastVerb : Type = PastVF => Str ;
oper pastConj: Str -> PastVerb = \del ->
table {
PSF (ASg Masc) => del ;
PSF (ASg Fem) => del +"а" ;
PSF (ASg Neut) => del+"о" ;
PSF APl => del+ "и"
};
oper pastConjDolzhen: Str -> PastVerb = \del -> oper pastConjDolzhen: Str -> PastVerb = \del ->
table { table {
@@ -1206,25 +1229,25 @@ oper
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 P2 => av.s! (VIMP Pl P2) +"сь";
VIMP Sg P3 => av.s ! (VIMP Sg P3) +"ся"; VIMP Sg P3 => av.s ! (VIMP Sg P3) +"ся";
VIMP Pl P3 => av.s ! (VIMP Pl P3) +"ся";
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)) + "сь"+[" бы"];
VSUB (ASg Neut) => pv ! (PSF (ASg Neut)) + "сь"+[" бы"]; VSUB (ASg Neut) => pv ! (PSF (ASg Neut)) + "сь"+[" бы"];
VSUB APl => pv ! (PSF APl) + "сь"+[" бы"] ; VSUB APl => pv ! (PSF APl) + "сь"+[" бы"] ;
-- case av.asp of { Imperfective => VIND (VPresent Sg P1) =>
av.s ! (VIND (VPresent Sg P1)) + "сь" ; -- case av.asp of { Imperfective =>
-- Perfective = > nonExist av.s ! (VIND (VPresent Sg P1)) + "сь" ;
-- } ; -- Perfective = > nonExist
VIND (VPresent Sg P2) => av.s ! (VIND (VPresent Sg P2))+ "ся" ; -- } ;
VIND (VPresent Sg P2) => av.s ! (VIND (VPresent Sg P2))+ "ся" ;
VIND (VPresent Sg P3) => av.s ! (VIND (VPresent Sg P3))+ "ся" ;
VIND (VPresent Pl P1) => av.s !( VIND (VPresent Pl P1)) + "ся" ; VIND (VPresent Sg P3) => av.s ! (VIND (VPresent Sg P3))+ "ся" ;
VIND (VPresent Pl P2) => av.s !( VIND (VPresent Pl P2)) + "сь'" ; VIND (VPresent Pl P1) => av.s !( VIND (VPresent Pl P1)) + "ся" ;
VIND (VPresent Pl P3) => av.s !( VIND (VPresent Pl P3)) + "ся" ; VIND (VPresent Pl P2) => av.s !( VIND (VPresent Pl P2)) + "сь'" ;
VIND (VFuture Sg P1) => av.s ! (VIND (VFuture Sg P1)) + "сь"; VIND (VPresent Pl P3) => av.s !( VIND (VPresent Pl P3)) + "ся" ;
VIND (VFuture Sg P2) => av.s! (VIND (VFuture Sg P2) )+ "ся"; VIND (VFuture Sg P1) => av.s ! (VIND (VFuture Sg P1)) + "сь";
VIND (VFuture Sg P2) => av.s! (VIND (VFuture Sg P2) )+ "ся"; VIND (VFuture Sg P2) => av.s! (VIND (VFuture Sg P2) )+ "ся";
VIND (VFuture Sg P3) => av.s! (VIND (VFuture Sg P3)) + "ся"; VIND (VFuture Sg P3) => av.s! (VIND (VFuture Sg P3)) + "ся";
VIND (VFuture Pl P1) => av.s! (VIND (VFuture Pl P1) )+ "ся"; VIND (VFuture Pl P1) => av.s! (VIND (VFuture Pl P1) )+ "ся";
@@ -1237,12 +1260,12 @@ oper
VIND (VPast APl) => av.s ! (VIND (VPast APl)) + "сь" VIND (VPast APl) => av.s ! (VIND (VPast APl)) + "сь"
} ; } ;
asp = av.asp asp = av.asp
};
};
-- Generation the imperfective active pattern given -- Generation the imperfective active pattern given
-- a number of basic conjugation forms.
oper
oper oper
imperfectiveActivePattern : Str -> Str -> PresentVerb -> PastVerb -> AspectVoice = imperfectiveActivePattern : Str -> Str -> PresentVerb -> PastVerb -> AspectVoice =
\inf, imper, presentFuture, past -> { s= table { \inf, imper, presentFuture, past -> { s= table {
@@ -1254,12 +1277,12 @@ oper
VIMP Sg P3 => ["пускай "] + presentFuture ! (PRF (ASg Masc) P3) ; VIMP Sg P3 => ["пускай "] + presentFuture ! (PRF (ASg Masc) P3) ;
VIMP Pl P3 => ["пускай "] + presentFuture ! (PRF APl P3) ; VIMP Pl P3 => ["пускай "] + presentFuture ! (PRF APl P3) ;
VSUB (ASg Masc) => past ! (PSF (ASg Masc)) +[" бы"]; VSUB (ASg Masc) => past ! (PSF (ASg Masc)) +[" бы"];
VSUB (ASg Fem) => past ! (PSF (ASg Fem)) +[" бы"];
VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"];
VSUB APl => past ! (PSF APl) +[" бы"]; VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"];
VSUB APl => past ! (PSF APl) +[" бы"];
VIND (VPresent Sg P1) => presentFuture ! ( PRF Sg P1);
VIND (VPresent Sg P1) => presentFuture ! ( PRF (ASg Masc) P1); VIND (VPresent Sg P1) => presentFuture ! ( PRF (ASg Masc) P1);
VIND (VPresent Sg P2) => presentFuture! (PRF (ASg Masc) P2) ; VIND (VPresent Sg P2) => presentFuture! (PRF (ASg Masc) P2) ;
VIND (VPresent Sg P3) => presentFuture ! (PRF (ASg Masc) P3) ; VIND (VPresent Sg P3) => presentFuture ! (PRF (ASg Masc) P3) ;

View File

@@ -59,9 +59,9 @@ lin
ThisNP = det2NounPhrase etotDet ; -- inanimate form only ThisNP = det2NounPhrase etotDet ; -- inanimate form only
ThatNP = det2NounPhrase totDet ; -- inanimate form only ThatNP = det2NounPhrase totDet ; -- inanimate form only
TheseNP n = { s =\\_ => [] ; n = Pl; p = P3; g=Fem ; anim = Animate ; pron = True} ; TheseNP n = { s =\\_ => [] ; n = Pl; p = P3; g= PGen Fem ; anim = Animate ; pron = True} ;
-- missing in Russian -- missing in Russian
ThoseNP n = { s =\\_ => [] ; n = Pl; p = P3; g=Fem ; anim = Animate ; pron = True} ; ThoseNP n = { s =\\_ => [] ; n = Pl; p = P3; g=PGen Fem ; anim = Animate ; pron = True} ;
-- missing in Russian -- missing in Russian
EverybodyNP = mkNounPhrase Pl (noun2CommNounPhrase (eEnd_Decl "вс")) ; EverybodyNP = mkNounPhrase Pl (noun2CommNounPhrase (eEnd_Decl "вс")) ;
@@ -85,6 +85,7 @@ WantVV = extVerb verbKhotet Act Present ;
OrConj = ss "или" ** {n = Sg} ; OrConj = ss "или" ** {n = Sg} ;
BothAnd = sd2 "как" [", так"] ** {n = Pl} ; BothAnd = sd2 "как" [", так"] ** {n = Pl} ;
EitherOr = sd2 "либо" [", либо"] ** {n = Sg} ; EitherOr = sd2 "либо" [", либо"] ** {n = Sg} ;
-- comma is not visible in GUI!
-- In case of "neither.. no" expression double negation is not -- In case of "neither.. no" expression double negation is not
-- only possible, but also required in Russian. -- only possible, but also required in Russian.

View File

@@ -41,51 +41,56 @@ oper
oper oper
NounPhrase : Type = { s : PronForm => Str ; n : Number ; NounPhrase : Type = { s : PronForm => Str ; n : Number ;
p : Person ; g: Gender ; anim : Animacy ; pron: Bool} ; p : Person ; g: PronGen ; anim : Animacy ; pron: Bool} ;
-- The following construction has to be refined for genitive forms: -- The following construction has to be refined for genitive forms:
-- "we two", "us two" are OK, but "our two" is not. -- "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 -> pronWithNum : NounPhrase -> Numeral -> NounPhrase = \mu,dva ->
{s = \\pf => mu.s!pf ++ dva.s ! (extCase pf) ! mu.g ; {s = \\pf => mu.s!pf ++ dva.s ! (extCase pf) ! (pgen2gen mu.g) ;
n = mu.n ; p = mu.p; g = mu.g ; pron = mu.pron; anim = mu.anim } ; n = mu.n ; p = mu.p; g = mu.g ; pron = mu.pron; anim = mu.anim } ;
noNum : Numeral = {s = \\_,_ => []} ; noNum : Numeral = {s = \\_,_ => []} ;
-- unclear how to tell apart the numbers from their string representation,
-- so just leave a decimal representation, without case-suffixes:
useInt : Str -> Numeral = \i -> useInt : Str -> Numeral = \i ->
{s = table { {s = table { _ => table {_ => i }
Nom => table {_ => i }; -- Nom => table {_ => i };
Gen => table {_ => i ++ "'-х"}; -- Gen => table {_ => i ++ "-х"};
Dat => table {_ => i ++ "'-м"}; -- Dat => table {_ => i ++ "'-м"};
Acc => table {_ => i }; -- Acc => table {_ => i };
Inst => table {_ => i ++ "-мя"}; -- Inst => table {_ => i ++ "-мя"};
Prepos => table {_ => i ++ "'-х"} -- Prepos => table {_ => i ++ "-х"}
} }
} ; } ;
-- A function specific for Russian for setting the gender for -- A function specific for Russian for setting the gender for
-- personal pronouns in first and second person, singular : -- personal pronouns in first and second person, singular :
setNPGender : Gender -> NounPhrase -> NounPhrase = \gen, pronI -> setNPGender : Gender -> NounPhrase -> NounPhrase = \gen, pronI ->
{ s = pronI.s ; g = gen ; anim = pronI.anim ; { s = pronI.s ; g = PGen gen; anim = pronI.anim ;
n = pronI.n ; nComp = pronI.nComp ; p = pronI.p ; pron = pronI.pron } ; n = pronI.n ; nComp = pronI.nComp ; p = pronI.p ; pron = pronI.pron } ;
mkNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,chelovek -> mkNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,chelovek ->
{s = \\cas => chelovek.s ! n ! (extCase cas) ; {s = \\cas => chelovek.s ! n ! (extCase cas) ;
n = n ; g = chelovek.g ; p = P3 ; pron =False ; n = n ; g = PGen chelovek.g ; p = P3 ; pron =False ;
anim = chelovek.anim anim = chelovek.anim
} ; } ;
pron2NounPhrase : Pronoun -> Animacy -> NounPhrase = \ona, anim -> pron2NounPhrase : Pronoun -> Animacy -> NounPhrase = \ona, anim ->
{s = ona.s ; n = ona.n ; g = pgen2gen ona.g ; {s = ona.s ; n = ona.n ; g = ona.g ;
pron = ona.pron; p = ona.p ; anim = anim } ; pron = ona.pron; p = ona.p ; anim = anim } ;
det2NounPhrase : Adjective -> NounPhrase = \eto -> det2NounPhrase : Adjective -> NounPhrase = \eto ->
{s = \\pf => eto.s ! (AF (extCase pf) Inanimate (ASg Neut)); n = Sg ; g = Neut ; pron = False ; p = P3 ; anim = Inanimate } ; {s = \\pf => eto.s ! (AF (extCase pf) Inanimate (ASg Neut)); n = Sg ; g = PGen Neut ; pron = False ; p = P3 ; anim = Inanimate } ;
nameNounPhrase : ProperName -> NounPhrase = nameNounPhrase : ProperName -> NounPhrase =
\masha -> {s = \\c => masha.s ! (extCase c) ; \masha -> {s = \\c => masha.s ! (extCase c) ;
p = P3; g = masha.g ; anim = masha.anim ; p = P3; g = PGen masha.g ; anim = masha.anim ;
n = Sg; nComp = Sg; pron = False} ; n = Sg; nComp = Sg; pron = False} ;
@@ -120,17 +125,18 @@ oper
n = kazhduj.n ; n = kazhduj.n ;
p = P3 ; p = P3 ;
pron = False; pron = False;
g = case kazhduj.g of { PNoGen => okhotnik.g; _=> pgen2gen kazhduj.g } ; g = kazhduj.g ;
anim = okhotnik.anim anim = okhotnik.anim
} ; } ;
indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n -> indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n ->
indefNounPhraseNum n noNum ; indefNounPhraseNum n noNum ;
-- a problem: "2 бутылки", but "5 бутылок" in Nominative case! Ignored for the moment:
indefNounPhraseNum : Number -> Numeral ->CommNounPhrase -> NounPhrase = indefNounPhraseNum : Number -> Numeral ->CommNounPhrase -> NounPhrase =
\n,dva,mashina -> \n,dva,mashina ->
{s = \\c => dva.s ! (extCase c) ! mashina.g ++ mashina.s ! n ! (extCase c) ; {s = \\c => dva.s ! (extCase c) ! mashina.g ++ mashina.s ! n ! (extCase c) ;
n = n ; p = P3; g = mashina.g ; anim = mashina.anim ; n = n ; p = P3; g = PGen mashina.g ; anim = mashina.anim ;
pron = False pron = False
} ; } ;
@@ -157,7 +163,7 @@ oper
False => dva.s ! (extCase c) ! mashina.g ++ mashina.s ! n ! (extCase c) ++ False => dva.s ! (extCase c) ! mashina.g ++ mashina.s ! n ! (extCase c) ++
masha.s ! (mkPronForm Gen No (Poss (gNum mashina.g n))) masha.s ! (mkPronForm Gen No (Poss (gNum mashina.g n)))
} ; } ;
n = n ; p = P3 ; g = mashina.g ; anim = mashina.anim ; pron = False n = n ; p = P3 ; g = PGen mashina.g ; anim = mashina.anim ; pron = False
} ; } ;
-- Constructions like "the idea that two is even" are formed at the -- Constructions like "the idea that two is even" are formed at the
@@ -181,13 +187,25 @@ oper
-- Coercions between the compound gen-num type and gender and number: -- Coercions between the compound gen-num type and gender and number:
gNum : Gender -> Number -> GenNum = \g,n -> gNum : Gender -> Number -> GenNum = \g,n ->
case n of {Sg => case g of case n of
{ Sg => case g of
{ Fem => ASg Fem ; { Fem => ASg Fem ;
Masc => ASg Masc ; Masc => ASg Masc ;
Neut => ASg Neut Neut => ASg Neut } ;
-- _ => variants {ASg Masc ; ASg Fem} Pl => APl
} ; Pl => APl} ; } ;
pgNum : PronGen -> Number -> GenNum = \g,n ->
case n of
{ Sg => case g of
{ PGen Fem => ASg Fem ;
PGen Masc => ASg Masc ;
PGen Neut => ASg Neut ;
_ => ASg Masc } ;
Pl => APl
} ;
-- _ => variants {ASg Masc ; ASg Fem} } ;
-- "variants" version cause "no term variants" error during linearization
--3 Adjective phrases --3 Adjective phrases
@@ -234,7 +252,7 @@ oper
p = P3 ; p = P3 ;
pron = False; pron = False;
anim = dom.anim ; anim = dom.anim ;
g = dom.g g = PGen dom.g
} ; } ;
@@ -288,9 +306,11 @@ oper
-- of the readings is meaningful. -- of the readings is meaningful.
appFunComm : Function -> NounPhrase -> CommNounPhrase = \mama,ivan -> appFunComm : Function -> NounPhrase -> CommNounPhrase = \mama,ivan ->
{s = \\n, cas => {s = \\n, cas => case ivan.pron of
mama.s ! n ! cas ++ mama.s2 ++ { True => ivan.s ! (mkPronForm cas No (Poss (gNum mama.g n))) ++ mama.s ! n ! cas;
ivan.s ! (mkPronForm mama.c No (Poss (gNum mama.g n))); False => mama.s ! n ! cas ++ mama.s2 ++
ivan.s ! (mkPronForm mama.c Yes (Poss (gNum mama.g n)))
};
g = mama.g ; g = mama.g ;
anim = mama.anim anim = mama.anim
} ; } ;
@@ -303,6 +323,12 @@ oper
mkFun : CommNoun -> Str -> Case -> Function = \f,p,c -> mkFun : CommNoun -> Str -> Case -> Function = \f,p,c ->
(n2n f) ** {s2 = p ; c = c} ; (n2n f) ** {s2 = p ; c = c} ;
-- The commonest cases are functions with Genitive.
funGen : CommNoun -> Function = \urovenCen ->
mkFun urovenCen [] Gen ;
-- The following is an aggregate corresponding to the original function application -- The following is an aggregate corresponding to the original function application
-- producing "детство Ивана" and "Иваново детство". It does not appear in the -- producing "детство Ивана" and "Иваново детство". It does not appear in the
-- resource abstract syntax any longer. -- resource abstract syntax any longer.
@@ -310,19 +336,14 @@ oper
-- must also be included -- must also be included
-- Such possesive form is only possible with proper names in Russian : -- Such possesive form is only possible with proper names in Russian :
appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll,detstvo, ivan -> appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll,detstvo, ivan ->
let {n = ivan.n ; nf = if_then_else Number coll Sg n} in let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
variants { variants {
indefNounPhrase nf (appFunComm detstvo ivan) ; -- detstvoIvana indefNounPhrase nf (appFunComm detstvo ivan) ; -- detstvoIvana
npGenDet nf noNum ivan detstvo npGenDet nf noNum ivan detstvo
} ; } ;
-- The commonest cases are functions with Genitive.
funGen : CommNoun -> Function = \urovenCen ->
mkFun urovenCen [] Gen ;
--3 Modification of common nouns --3 Modification of common nouns
-- --
-- The two main functions of adjective are in predication ("Иван - молод") -- The two main functions of adjective are in predication ("Иван - молод")
@@ -400,19 +421,21 @@ oper
verbOfPhrase : VerbPhrase -> Verb = \v -> verbOfPhrase : VerbPhrase -> Verb = \v ->
{s = v.s; t = v.t ; a = v.a ; w =v.w} ; {s = v.s; t = v.t ; a = v.a ; w =v.w} ;
-- Verb phrases can also be formed from adjectives (" молод"),
-- Verb phrases can also be formed from adjectives ("- молод"), -- common nouns (" человек"), and noun phrases (" самый молодой").
-- 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. -- on semantic grounds.
-- Note: in some case we can even omit a dash "-" : -- Note: we omit a dash "-" because it will cause problems with negation word order:
-- "Я думаю, что это хорошая машина". -- "Я не - волшебник". Alternatively, we can consider verb-based VP and
-- all the rest.
predAdverb : Adverb -> VerbGroup = \zloj -> predAdverb : Adverb -> VerbGroup = \zloj ->
{ s= \\vf => case vf of { { s= \\vf => case vf of {
VFin _ _ => "-" ++ zloj.s ; VFin _ _ => zloj.s ;
VImper _ _ => ""; VImper Sg _ => "будь" ++ zloj.s;
VInf => ""; VImper Pl _ => "будьте" ++ zloj.s;
-- person is ignored !
VInf => "быть" ++ zloj.s;
VSubj _ => "" VSubj _ => ""
} ; } ;
t = Present ; t = Present ;
@@ -423,11 +446,14 @@ oper
predAdjective : AdjPhrase -> VerbGroup = \zloj -> predAdjective : AdjPhrase -> VerbGroup = \zloj ->
{ s= \\vf => case vf of { { s= \\vf => case vf of {
VFin gn _ => case (numGNum gn) of { VFin gn _ => case (numGNum gn) of {
Sg => "-" ++ zloj.s ! AF Nom Animate (ASg (genGNum gn)) ; Sg => zloj.s ! AF Nom Animate (ASg (genGNum gn)) ;
Pl => "-" ++ zloj.s ! AF Nom Animate APl Pl => zloj.s ! AF Nom Animate APl
} ; } ;
VImper _ _ => ""; VImper Sg _ => "будь" ++ zloj.s ! AF Inst Animate (ASg Masc);
VInf => ""; 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 _ => "" VSubj _ => ""
} ; } ;
t = Present ; t = Present ;
@@ -437,10 +463,11 @@ oper
predCommNoun : CommNounPhrase -> VerbGroup = \chelovek -> predCommNoun : CommNounPhrase -> VerbGroup = \chelovek ->
{ s= \\vf => case vf of { { s= \\vf => case vf of {
VFin gn _ => "-" ++ VFin gn _ => (indefNounPhrase (numGNum gn) chelovek ).s ! (mkPronForm Nom No NonPoss) ;
(indefNounPhrase (numGNum gn) chelovek ).s ! (mkPronForm Nom No NonPoss) ; VImper Sg _ => "будь"++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss) ;
VImper _ _ => ""; VImper Pl _ => "будьте"++(indefNounPhrase Pl chelovek ).s ! (mkPronForm Inst No NonPoss);
VInf => ""; -- person is ignored !
VInf => "быть" ++ (indefNounPhrase Sg chelovek ).s ! (mkPronForm Inst No NonPoss) ;
VSubj _ => "" VSubj _ => ""
} ; } ;
t = Present ; t = Present ;
@@ -450,9 +477,11 @@ oper
predNounPhrase : NounPhrase -> VerbGroup = \masha -> predNounPhrase : NounPhrase -> VerbGroup = \masha ->
{ s= \\vf => case vf of { { s= \\vf => case vf of {
VFin _ _ => "-" ++ masha.s ! (mkPronForm Nom No NonPoss) ; VFin _ _ => masha.s ! (mkPronForm Nom No NonPoss) ;
VImper _ _ => ""; VImper Sg _ => "будь" ++ masha.s ! (mkPronForm Inst No NonPoss);
VInf => ""; VImper Pl _ => "будьте" ++ masha.s ! (mkPronForm Inst No NonPoss);
VInf => "быть" ++ masha.s ! (mkPronForm Inst No NonPoss);
-- infinitive does not save Number parameter!
VSubj _ => "" VSubj _ => ""
} ; } ;
t = Present ; t = Present ;
@@ -497,7 +526,7 @@ oper
\dat,tu,pivo -> \dat,tu,pivo ->
let let
tebepivo = dat.s2 ++ tebepivo = dat.s2 ++
tu.s ! PF dat.c Yes 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
{s = \\vf => (dat.s ! vf) ++ tebepivo ; {s = \\vf => (dat.s ! vf) ++ tebepivo ;
t = dat.t ; t = dat.t ;
@@ -557,8 +586,8 @@ oper
let let
{ ya = Ya.s ! (mkPronForm Nom No NonPoss); { ya = Ya.s ! (mkPronForm Nom No NonPoss);
ne = tebyaNeVizhu.s2; ne = tebyaNeVizhu.s2;
vizhu = tebyaNeVizhu.s ! VFin (gNum Ya.g Ya.n) Ya.p; vizhu = tebyaNeVizhu.s ! VFin (pgNum Ya.g Ya.n) Ya.p;
tebya = tebyaNeVizhu.s3 ! Ya.g ! Ya.n tebya = tebyaNeVizhu.s3 ! (pgen2gen Ya.g) ! Ya.n
} }
in in
if_then_else Str tebyaNeVizhu.negBefore if_then_else Str tebyaNeVizhu.negBefore
@@ -572,7 +601,7 @@ oper
\b,Ser,Jag,Dig -> { s = \b,Ser,Jag,Dig -> { s =
let { let {
menya = Jag.s ! (mkPronForm Gen Yes NonPoss) ; menya = Jag.s ! (mkPronForm Gen Yes NonPoss) ;
bolit = Ser.s ! VFin (gNum Dig.g Dig.n) Dig.p ; bolit = Ser.s ! VFin (gNum (pgen2gen Dig.g) Dig.n) Dig.p ;
golova = Dig.s ! (mkPronForm Nom No NonPoss) ; golova = Dig.s ! (mkPronForm Nom No NonPoss) ;
ne = negation b ne = negation b
} in } in
@@ -639,9 +668,7 @@ oper
complementOfTransVerb lubit ; complementOfTransVerb lubit ;
thereIs : NounPhrase -> Sentence = \bar -> thereIs : NounPhrase -> Sentence = \bar ->
predVerbPhrase {s = "есть" ++ bar.s ! PF Nom No NonPoss} ;
({s = \\_ => "есть" ; n = bar.n ; p = P3; g = bar.g; anim = bar.anim; pron = bar.pron })
(predVerbGroup True (predNounPhrase bar)) ;
--2 Coordination --2 Coordination
-- --
@@ -722,11 +749,15 @@ oper
-- to a relative pronoun to create a new one. We can reuse the rule applying -- to a relative pronoun to create a new one. We can reuse the rule applying
-- functions to noun phrases! -- functions to noun phrases!
funIntPron : Function -> IntPron -> IntPron = funIntPron : Function -> NounPhrase -> NounPhrase = \detstvo, ivan ->
appFun False ; indefNounPhrase ivan.n (appFunComm detstvo ivan) ; -- detstvoIvana
-- bug version:
-- funIntPron : Function -> IntPron -> IntPron =
-- appFun False ;
-- There is a variety of simple interrogative pronouns: -- There is a variety of simple interrogative pronouns:
-- "какая машина", "кто", "что". -- "какая машина", "кто", "что".
nounIntPron : Number -> CommNounPhrase -> IntPron = \n, x -> nounIntPron : Number -> CommNounPhrase -> IntPron = \n, x ->
@@ -740,7 +771,7 @@ oper
PF Acc _ _ => "кого" ; PF Acc _ _ => "кого" ;
PF Inst _ _ => "кем" ; PF Inst _ _ => "кем" ;
PF Prepos _ _ => ["о ком"] PF Prepos _ _ => ["о ком"]
g = Masc ; } ;
g = PGen Masc ; g = PGen Masc ;
anim = Animate ; anim = Animate ;
n = num ; n = num ;
@@ -757,8 +788,8 @@ oper
PF Dat _ _ => "чему" ; PF Dat _ _ => "чему" ;
PF Acc _ _ => "что" ; PF Acc _ _ => "что" ;
PF Inst _ _ => "чем" ; PF Inst _ _ => "чем" ;
} ; PF Prepos _ _=> ["о чем"]
g = Neut ; } ;
g = PGen Neut ; g = PGen Neut ;
anim = Inanimate ; anim = Inanimate ;
@@ -806,8 +837,8 @@ oper
-- but we are not considering this case. -- but we are not considering this case.
questVerbPhrase : NounPhrase -> VerbPhrase -> Question = questVerbPhrase : NounPhrase -> VerbPhrase -> Question =
spish = spish.s ! VFin (gNum tu.g tu.n) tu.p \tu,spish ->
++ spish.s2 ++ spish.s3 ! tu.g ! tu.n } in let { vu = tu.s ! (mkPronForm Nom No NonPoss);
spish = spish.s2 ++ spish.s ! VFin (gNum (pgen2gen tu.g) tu.n) tu.p spish = spish.s2 ++ spish.s ! VFin (gNum (pgen2gen tu.g) tu.n) tu.p
++ spish.s3 ! (pgen2gen tu.g) ! tu.n } in ++ spish.s3 ! (pgen2gen tu.g) ! tu.n } in
{ s = table { { s = table {
@@ -850,8 +881,8 @@ isThere : NounPhrase -> Question = \bar ->
-- sense is a semantic question. -- sense is a semantic question.
questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question =
pozhivaesh.s2 ++ pozhivaesh.s ! VFin (gNum tu.g tu.n) tu.p ++ \kak, tu, pozhivaesh ->
pozhivaesh.s3 ! tu.g ! tu.n } ; {s = \\q => kak.s ++ tu.s ! (mkPronForm Nom No NonPoss) ++
pozhivaesh.s2 ++ pozhivaesh.s ! VFin (gNum (pgen2gen tu.g) tu.n) tu.p ++ pozhivaesh.s2 ++ pozhivaesh.s ! VFin (gNum (pgen2gen tu.g) tu.n) tu.p ++
pozhivaesh.s3 ! (pgen2gen tu.g) ! tu.n } ; pozhivaesh.s3 ! (pgen2gen tu.g) ! tu.n } ;
@@ -860,7 +891,7 @@ isThere : NounPhrase -> Question = \bar ->
-- We only consider second-person imperatives. -- We only consider second-person imperatives.
Imperative: Type = { s: Gender => Number => Str } ; Imperative: Type = { s: Gender => Number => Str } ;
{s = \\g, n => budGotov.s ! VImper n P2 ++ budGotov.s2 ++ budGotov.s3 ! g ! n} ;
imperVerbPhrase : VerbPhrase -> Imperative = \budGotov -> imperVerbPhrase : VerbPhrase -> Imperative = \budGotov ->
{s = \\g, n => budGotov.s2 ++ budGotov.s ! VImper n P2 ++ budGotov.s3 ! g ! n} ; {s = \\g, n => budGotov.s2 ++ budGotov.s ! VImper n P2 ++ budGotov.s3 ! g ! n} ;
@@ -928,17 +959,17 @@ isThere : NounPhrase -> Question = \bar ->
--3 Coordinating noun phrases --3 Coordinating noun phrases
-- --
-- The structure is the same as for sentences. The result is either always plural -- The structure is the same as for sentences. The result is either always plural
ListNounPhrase : Type = { s1,s2 : PronForm => Str ; g: Gender ; -- or plural if any of the components is, depending on the conjunction.
ListNounPhrase : Type = { s1,s2 : PronForm => Str ; g: PronGen ; ListNounPhrase : Type = { s1,s2 : PronForm => Str ; g: PronGen ;
anim : Animacy ; n : Number ; p : Person ; pron : Bool } ; anim : Animacy ; n : Number ; p : Person ; pron : Bool } ;
g = conjGender x.g y.g ; p = conjPerson x.p y.p ; twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y ->
CO.twoTable PronForm x y ** {n = conjNumber x.n y.n ; CO.twoTable PronForm x y ** {n = conjNumber x.n y.n ;
g = conjPGender x.g y.g ; p = conjPerson x.p y.p ; g = conjPGender x.g y.g ; p = conjPerson x.p y.p ;
pron = conjPron x.pron y.pron ; anim = conjAnim x.anim y.anim } ; pron = conjPron x.pron y.pron ; anim = conjAnim x.anim y.anim } ;
{n = conjNumber xs.n x.n ; g = conjGender x.g xs.g ; consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x ->
CO.consTable PronForm CO.comma xs x ** CO.consTable PronForm CO.comma xs x **
{n = conjNumber xs.n x.n ; g = conjPGender x.g xs.g ; {n = conjNumber xs.n x.n ; g = conjPGender x.g xs.g ;
anim = conjAnim x.anim xs.anim ; anim = conjAnim x.anim xs.anim ;
@@ -982,6 +1013,7 @@ isThere : NounPhrase -> Question = \bar ->
-- "Маша или Оля - красивая", "Антон или Олег - красивый", -- "Маша или Оля - красивая", "Антон или Олег - красивый",
-- "Маша или Олег - красивый". -- "Маша или Олег - красивый".
-- The later is not totally correct, but there is no correct way to say that. -- The later is not totally correct, but there is no correct way to say that.
conjGender : Gender -> Gender -> Gender = \_,m -> m ; conjGender : Gender -> Gender -> Gender = \_,m -> m ;
conjPGender : PronGen -> PronGen -> PronGen = \_,m -> m ; conjPGender : PronGen -> PronGen -> PronGen = \_,m -> m ;

View File

@@ -21,7 +21,7 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener,
public MouseEvent m2; public MouseEvent m2;
public static String selectedText=""; public static String selectedText="";
public static boolean debug = true; public static boolean debug = false;
public static boolean debug3 = false; public static boolean debug3 = false;
public static boolean debug2 = true; public static boolean debug2 = true;
public static boolean selectionCheck = false; public static boolean selectionCheck = false;