From 6b5df036e38105268f13e649199f3060a8fddad4 Mon Sep 17 00:00:00 2001 From: EkaterinaVoloshina Date: Tue, 26 Nov 2024 21:26:54 +0100 Subject: [PATCH] added a contruction; fixed negation --- src/russian/CatRus.gf | 10 ++++++++-- src/russian/ConjunctionRus.gf | 7 +++++-- src/russian/ConstructionRus.gf | 1 + src/russian/ExtendRus.gf | 22 ++++++++++++++++++---- src/russian/ExtraRus.gf | 14 ++++++++++++++ src/russian/ExtraRusAbs.gf | 2 ++ src/russian/GrammarRus.gf | 2 +- src/russian/IdiomRus.gf | 6 ++++-- src/russian/ParadigmsRus.gf | 13 ++++++++----- src/russian/ParamRus.gf | 2 +- src/russian/ResRus.gf | 25 +++++++++++++++++++++---- src/russian/SentenceRus.gf | 2 +- src/russian/StructuralRus.gf | 5 +++-- src/russian/TenseRus.gf | 2 +- src/russian/VerbRus.gf | 29 +++++++++++++++++++---------- 15 files changed, 107 insertions(+), 35 deletions(-) diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index 581e5230..f45881e1 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -1,4 +1,4 @@ -concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { +concrete CatRus of Cat = CommonX - [AdV, mkAdV] ** open ResRus, Prelude in { flags coding=utf8 ; optimize=all ; lincat N = ResRus.NounForms ; @@ -29,6 +29,11 @@ lincat A, Ord = ResRus.AdjForms ; A2 = ResRus.AdjForms ** {c : ComplementCase} ; + AdV = { + s : Str ; + p : Polarity + } ; + V, VS, VQ, VA = ResRus.VerbForms ; V2, V2S, V2Q, V2A, V2V = ResRus.VerbForms2 ; V3 = ResRus.VerbForms3 ; @@ -136,7 +141,8 @@ linref = {verb = s.verb ; adv = s.adv ; dep = s.dep ; - compl = \\p, a => s.compl1 ! p ! a ++ s.c.s ++ s.compl2 ! p ! a + compl = \\p, a => s.compl1 ! p ! a ++ s.c.s ++ s.compl2 ! p ! a ; + p = s.p } in vp.adv ! Ag (GSg Neut) P3 ++ (verbInf vp.verb) ++ vp.dep ++ vp.compl ! Pos ! Ag (GSg Neut) P3 ; Cl = \s -> s.subj ++ s.adv ++ (verbInf s.verb) ++ s.dep ++ s.compl ! Pos ; diff --git a/src/russian/ConjunctionRus.gf b/src/russian/ConjunctionRus.gf index 4e4bfa4c..096a20ed 100644 --- a/src/russian/ConjunctionRus.gf +++ b/src/russian/ConjunctionRus.gf @@ -102,8 +102,11 @@ concrete ConjunctionRus of Conjunction = ConjAdv = conjunctDistrSS ; -- : Conj -> ListIAdv -> IAdv ; -- where or why ConjIAdv = conjunctDistrSS ; - -- : Conj -> ListAdV -> AdV ; -- always or sometimes - ConjAdV = conjunctDistrSS ; + -- : Conj -> ListAdV -> AdV ; -- always or sometimes; + ConjAdV conj xs = { + s = conj.s1 ++ xs.s1 ++ conj.s2 ++ xs.s2 ; + p = Pos + } ; -- : Conj -> ListAP -> AP ; -- cold and warm ConjAP conj xs = conjunctDistrTable3 GenNum Animacy Case conj xs ** { diff --git a/src/russian/ConstructionRus.gf b/src/russian/ConstructionRus.gf index 7b939cf6..bf42f960 100644 --- a/src/russian/ConstructionRus.gf +++ b/src/russian/ConstructionRus.gf @@ -45,6 +45,7 @@ lin verb=copulaEll ; dep=[] ; compl=\\p,a => (timeunitAdv card year_Timeunit).s; + p = Pos } ; -- : NP -> QCl ; -- how old is x / quanti anni ha x (Ita) diff --git a/src/russian/ExtendRus.gf b/src/russian/ExtendRus.gf index a48c9b16..906d0a4b 100644 --- a/src/russian/ExtendRus.gf +++ b/src/russian/ExtendRus.gf @@ -14,7 +14,8 @@ concrete ExtendRus of Extend = -- AdvIsNPAP, AdAdV, AdjAsNP, ApposNP, -- BaseVPS, ConsVPS, BaseVPI, ConsVPI, BaseVPS2, ConsVPS2, BaseVPI2, ConsVPI2, - -- MkVPS, ConjVPS, MkVPI, ConjVPI, ComplVPIVV, + -- MkVPS, + -- ConjVPS, MkVPI, ConjVPI, ComplVPIVV, -- MkVPS2, ConjVPS2, ComplVPS2, MkVPI2, ConjVPI2, ComplVPI2, -- Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ByVP, CompBareCN, -- CompQS, CompS, CompVP, ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP, @@ -42,7 +43,8 @@ concrete ExtendRus of Extend = PastPartAP, PastPartAgentAP, PositAdVAdj, - -- PredVPS, PredVPSVV, PredetRNP, PrepCN, + PredVPS, + -- PredVPSVV, PredetRNP, PrepCN, -- EmbedSSlash, PresPartAP, PurposeVP, -- ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash, @@ -89,7 +91,7 @@ lin ExistsNP np = { subj=[] ; adv=[] ; - verb=M.to_exist ; + verb=copulaFull ; dep=[] ; compl=table { Pos => np.s ! Nom ; @@ -98,6 +100,8 @@ lin a=np.a } ; + + iFem_Pron = personalPron (Ag (GSg Fem) P1) ; youFem_Pron = personalPron (Ag (GSg Fem) P2) ; @@ -221,7 +225,7 @@ lin UttAdV adv = {s=adv.s} ; -- : A -> AdV ; -- (that she) positively (sleeps) - PositAdVAdj a = ss a.sn ; + PositAdVAdj a = ss a.sn ** {p=Pos} ; -- : NP -> SSlash -> Utt ; -- her I love FocusObj np ss = { @@ -314,6 +318,16 @@ lin a=Ag (gennum g (numSizeNumber det.size)) P3 } ; + --PredVPS np vps = {s = np.s ! Nom ++ vps.c.s } ; + + -- mkVPS : Temp -> Pol -> VP -> VPS + --MkVPS t p vp = { + -- s = \\a => + -- let verb = vp.verb ; + -- compl = vp.compl + -- in verb + -- } ; + oper rus_quoted : Str -> Str = \s -> "«" ++ s ++ "»" ; ---- TODO bind ; move to Prelude? diff --git a/src/russian/ExtraRus.gf b/src/russian/ExtraRus.gf index 82ef563b..00fb68b3 100644 --- a/src/russian/ExtraRus.gf +++ b/src/russian/ExtraRus.gf @@ -170,6 +170,19 @@ lin -- : NP -> Comp ; -- (Париж) - столица Франции CompNomNP np = {s=\\a=>np.s ! Nom ; adv=[] ; cop=NomCopula} ; + -- : NP -> Adv -> Cl ; -- у них есть дети + ExistsNPAdv np adv = { + subj=[] ; + adv=adv.s ; + verb=copulaFull ; + dep=[] ; + compl=table { + Pos => np.s ! Nom ; + Neg => np.s ! Gen + } ; + a=np.a + } ; + oper est_V : V = lin V { inf="есть"; @@ -190,6 +203,7 @@ oper -- refl=NonReflexive; -- tran=Transitive } ; + est_ell_V = est_V ** {prsg1, prsg2, prsg3, prpl1, prpl2, prpl3=""} ; be_ell_V = est_ell_V ** {inf=""} ; net_V : V = lin V { diff --git a/src/russian/ExtraRusAbs.gf b/src/russian/ExtraRusAbs.gf index d5564af0..ee238a3f 100644 --- a/src/russian/ExtraRusAbs.gf +++ b/src/russian/ExtraRusAbs.gf @@ -46,6 +46,7 @@ fun that_way_Adv : Adv ; any_way_Adv : Adv ; never_Adv : Adv ; + never_AdV : AdV ; from_nowhere_Adv : Adv ; to_nowhere_Adv : Adv ; nowhere_Adv : Adv ; @@ -112,4 +113,5 @@ fun TransgrAsAdv1 : Temp -> Pol -> VPSlash -> Adv ; UttImpImm : Pol -> Imp -> Utt ; CompNomNP : NP -> Comp ; + ExistsNPAdv : NP -> Adv -> Cl ; } diff --git a/src/russian/GrammarRus.gf b/src/russian/GrammarRus.gf index 1090a301..4bfdf178 100644 --- a/src/russian/GrammarRus.gf +++ b/src/russian/GrammarRus.gf @@ -11,7 +11,7 @@ concrete GrammarRus of Grammar = RelativeRus, ConjunctionRus, PhraseRus, - TextX, + TextX- [AdV], StructuralRus, IdiomRus, TenseRus, diff --git a/src/russian/IdiomRus.gf b/src/russian/IdiomRus.gf index c5d29172..b7b1b97d 100644 --- a/src/russian/IdiomRus.gf +++ b/src/russian/IdiomRus.gf @@ -64,15 +64,17 @@ lin compl=\\_ => [] ; a=ip.a } ; + -- : NP -> Adv -> Cl ; -- there is a house in Paris ExistNPAdv np adv = { - subj=np.s ! Nom ; adv=adv.s ; - verb=to_exist ; + subj=np.s ! Nom ; + verb= copulaEll ; dep=[] ; compl=\\_ => [] ; a=np.a } ; + -- : IP -> Adv -> QCl ; -- which houses are there in Paris ExistIPAdv ip adv = { subj=ip.nom ; -- gen? diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index 2717ee0e..ecab4331 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -1,7 +1,7 @@ ---# -path=.:../abstract:../common +--# -path=.:../abstract:../../prelude:../common --1 Russian Lexical Paradigms -resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe, MorphoRus in { +resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), TenseRus, Maybe, MorphoRus, Prelude in { --2 Parameters -- @@ -742,15 +742,18 @@ oper = \s -> lin Adv (makeAdverb s) ; } ; - mkAdV : Str -> AdV - = \s -> lin AdV (makeAdverb s) ; - mkAdA : Str -> AdA = \s -> lin AdA (makeAdverb s) ; mkAdN : Str -> AdN = \s -> lin AdN (makeAdverb s) ; + mkAdV : Str -> AdV + = \s -> lin AdV {s = s; p = Pos} ; + + mkAdVNeg : Str -> AdV + = \s -> lin AdV {s = s; p = Neg} ; + mkIAdv : Str -> IAdv = \s -> lin IAdv (makeAdverb s) ; diff --git a/src/russian/ParamRus.gf b/src/russian/ParamRus.gf index e5fd6633..83f5d526 100644 --- a/src/russian/ParamRus.gf +++ b/src/russian/ParamRus.gf @@ -1,4 +1,4 @@ -resource ParamRus = ParamX, CommonX [Temp] ** open Prelude, Maybe in { +resource ParamRus = ParamX - [mkAdV, AdV], CommonX [Temp] ** open Prelude, Maybe in { -- Mostly follows https://en.wikipedia.org/wiki/List_of_glossing_abbreviations -- see theory.txt diff --git a/src/russian/ResRus.gf b/src/russian/ResRus.gf index 8830011c..2af96104 100644 --- a/src/russian/ResRus.gf +++ b/src/russian/ResRus.gf @@ -203,6 +203,12 @@ oper ellNoun : NounForms -> NounForms = \n -> noMinorCases (immutableNounCases "" n.g n.anim) ; + orPol : Polarity -> Polarity -> Polarity = \p1,p2 -> + case p1 of { + Neg => Neg; + Pos => p2 + } ; + AgrTable = Agr => Str ; ComplTable = Polarity => Agr => Str ; PolarityTable = Polarity => Str ; @@ -399,6 +405,8 @@ oper the_most = guessAdjectiveForms "самый" ; utmost_Adv = makeAdverb "наиболее" ; + + -- [ISACHENKO],p.220 there are three forms in Russian: самый важный; наиболее важный/важен; важнее (всех, всего) -- here only first one: long_superlative : AdjForms -> AdjForms @@ -589,6 +597,8 @@ oper comp = a1.sn ++ l ++ a2.comp ; } ; + + --------------------- -- Verbs -- Глаголы @@ -603,7 +613,8 @@ oper adv : AgrTable ; -- modals are in position of adverbials ones numgen gets fixed verb : ResRus.VerbForms ; dep : Str ; -- dependent infinitives and such - compl : ComplTable + compl : ComplTable ; + p : Polarity } ; VPSlash = { @@ -614,6 +625,7 @@ oper compl2 : ComplTable ; c : ComplementCase ; isSimple : Bool ; -- regulates the place of participle used as adjective + p : Polarity } ; ---- slashV : VerbForms -> ComplementCase -> VPSlash = \verb,c -> { @@ -623,6 +635,7 @@ oper compl2 = \\_,a => [] ; dep = [] ; c = c ; + p = Pos ; isSimple = True } ; @@ -645,7 +658,8 @@ oper } ; c = {s="" ; c=Acc ; neggen=True ; hasPrep=False}; dep = slash.dep ; - isSimple = False + isSimple = False ; + p = slash.p } ; insertSlashObj1 : (Polarity => Agr => Str) -> ComplementCase -> VPSlash -> VPSlash = \obj,c,slash -> { @@ -655,7 +669,8 @@ oper compl2 = slash.compl2 ; c = slash.c ; dep = slash.dep ; - isSimple = False + isSimple = False ; + p = slash.p } ; insertSlashObj2 : (Polarity => Agr => Str) -> ComplementCase -> VPSlash -> VPSlash = \obj,c,slash -> { @@ -665,7 +680,8 @@ oper compl2 =\\p,a => slash.compl2 ! p ! a ++ obj ! p ! a; c = slash.c ; dep = slash.dep ; - isSimple = False + isSimple = False ; + p = slash.p } ; @@ -1582,6 +1598,7 @@ oper makeAdverb : Str -> Adverb = \word -> {s=word} ; + -------------------------------- -- combining nouns with numerals diff --git a/src/russian/SentenceRus.gf b/src/russian/SentenceRus.gf index 295deb1a..42cc3480 100644 --- a/src/russian/SentenceRus.gf +++ b/src/russian/SentenceRus.gf @@ -81,7 +81,7 @@ lin -- : VP -> Imp ; -- love yourselves ImpVP vp = { s = \\polarity, gn => - let pol = case polarity of {Neg => PNeg; Pos => PPos} in + let pol = case (R.orPol vp.p polarity) of {Neg => PNeg; Pos => PPos} in let a = Ag gn P2 in (R.verbEnvAgr "" "" vp.verb Imperative Pres a pol) ++ vp.dep diff --git a/src/russian/StructuralRus.gf b/src/russian/StructuralRus.gf index 3ae8fffb..effeb75e 100644 --- a/src/russian/StructuralRus.gf +++ b/src/russian/StructuralRus.gf @@ -1,5 +1,5 @@ concrete StructuralRus of Structural = CatRus ** - open ParadigmsRus, ResRus, MorphoRus, (X = ConstructX), Coordination, Prelude in { + open ParadigmsRus, ResRus, MorphoRus, ParamRus, Maybe, (X = ConstructX), Coordination, Prelude in { lin i_Pron = personalPron (Ag MSg P1) ; @@ -82,6 +82,8 @@ lin there_Adv = mkAdv "там" ; there7to_Adv = mkAdv "туда" ; there7from_Adv = mkAdv "оттуда" ; + always_AdV = mkAdV "всегда"; + --always_AdV = {s="всегда"; p=Pos} ; how_IAdv = ss "как" ; how8much_IAdv = ss "сколько" ; @@ -162,7 +164,6 @@ lin almost_AdA = ss "почти" ; almost_AdN = ss "почти" ; - always_AdV = ss "всегда" ; at_least_AdN = ss "по меньшей мере" ; at_most_AdN = ss "самое большее" ; too_AdA = ss "слишком" ; diff --git a/src/russian/TenseRus.gf b/src/russian/TenseRus.gf index 02ee7297..467f8a5a 100644 --- a/src/russian/TenseRus.gf +++ b/src/russian/TenseRus.gf @@ -1,4 +1,4 @@ -concrete TenseRus of Tense = TenseX - [PNeg,PPos] ** open (R = ParamX) in { +concrete TenseRus of Tense = TenseX - [PNeg,PPos,AdV] ** open (R = ParamX) in { flags coding=utf8 ; optimize=all ; lin PNeg = { diff --git a/src/russian/VerbRus.gf b/src/russian/VerbRus.gf index 73dd6d5c..076ee511 100644 --- a/src/russian/VerbRus.gf +++ b/src/russian/VerbRus.gf @@ -6,7 +6,8 @@ lin adv = \\a=>[] ; verb = v ; dep=[] ; - compl = \\_,_ => [] + compl = \\_,_ => [] ; + p = Pos } ; -- : V2 -> VP ; -- be loved @@ -14,14 +15,16 @@ lin adv = \\a=>[] ; verb = passivate v2 ; dep=[] ; - compl = \\p,a => [] + compl = \\p,a => [] ; + p = Pos } ; -- : VV -> VP -> VP ; -- want to run ComplVV vv vp = vp ** { verb=vv.v ; dep=verbInf vp.verb ++ vp.dep ; - adv=\\a=>vv.modal ! a ++ vp.adv ! a + adv=\\a=>vv.modal ! a ++ vp.adv ! a ; + p = Pos } ; -- : VS -> S -> VP ; -- say that she runs @@ -29,7 +32,8 @@ lin verb = vs ; dep=[] ; adv=\\a=>[] ; - compl=\\_,_ => comma ++ "что" ++ s.s ! Ind + compl=\\_,_ => comma ++ "что" ++ s.s ! Ind ; + p = Pos } ; -- : VQ -> QS -> VP ; -- wonder who runs @@ -37,7 +41,8 @@ lin verb = vq ; dep=[] ; adv=\\a=>[] ; - compl=\\_,_ => comma ++ "что" ++ qs.s ! QDir + compl=\\_,_ => comma ++ "что" ++ qs.s ! QDir ; + p = Pos } ; @@ -49,7 +54,8 @@ lin compl=\\_ => case ap.preferShort of { PreferFull => (\\a => ap.s ! agrGenNum a ! Inanimate ! Ins) ; PrefShort => ap.short - } + } ; + p = Pos } ; -- : V2 -> VPSlash ; -- love (it) @@ -79,13 +85,15 @@ lin adv = vps.adv ; dep = vps.dep ; compl = \\p,a => vps.compl1 ! p ! a ++ applyPolPrep p vps.c np ++ vps.compl2 ! p ! a ; + p = Pos } ; -- : VV -> VPSlash -> VPSlash ; -- want to buy SlashVV vv vps = vps ** { verb=vv.v ; dep=(verbInf vps.verb) ++ vps.dep ; - adv=\\a=>vv.modal ! a ++ vps.adv ! a + adv=\\a=>vv.modal ! a ++ vps.adv ! a ; + p = Pos } ; {- This is very heavy, but can be replaced (see todo.txt) @@ -109,7 +117,8 @@ lin adv=\\a => comp.adv ; verb=selectCopula comp.cop ; dep=[] ; - compl=\\p => comp.s + compl=\\p => comp.s; + p = Pos } ; -- : VP -> Adv -> VP ; -- sleep here @@ -123,7 +132,7 @@ lin } ; -- : AdV -> VP -> VP ; -- always sleep - AdVVP adv vp = vp ** {adv=\\a => adv.s ++ vp.adv ! a} ; + AdVVP adv vp = vp ** {adv=\\a => adv.s ++ vp.adv ! a; p = orPol adv.p vp.p} ; -- : VPSlash -> Adv -> VPSlash ; -- use (it) here AdvVPSlash vps adv = vps ** {compl1=\\p,a => vps.compl1 ! p ! a ++ adv.s; isSimple=False} ; @@ -153,5 +162,5 @@ lin } ; -- : VP ; -- be - UseCopula = {adv=\\a=>[] ; verb=copulaIns ; dep=[] ; compl=\\p,a=>[]} ; + UseCopula = {adv=\\a=>[] ; verb=copulaIns ; dep=[] ; compl=\\p,a=>[]; p=Pos} ; }