ansible-later/env_27/lib/python2.7/site-packages/snowballstemmer/russian_stemmer.py
Robert Kaussow 10aaa8e7e3 fix pytest
2019-04-11 15:56:20 +02:00

637 lines
20 KiB
Python

# self file was generated automatically by the Snowball to Python interpreter
from .basestemmer import BaseStemmer
from .among import Among
class RussianStemmer(BaseStemmer):
'''
self class was automatically generated by a Snowball to Python interpreter
It implements the stemming algorithm defined by a snowball script.
'''
serialVersionUID = 1
a_0 = [
Among(u"\u0432", -1, 1),
Among(u"\u0438\u0432", 0, 2),
Among(u"\u044B\u0432", 0, 2),
Among(u"\u0432\u0448\u0438", -1, 1),
Among(u"\u0438\u0432\u0448\u0438", 3, 2),
Among(u"\u044B\u0432\u0448\u0438", 3, 2),
Among(u"\u0432\u0448\u0438\u0441\u044C", -1, 1),
Among(u"\u0438\u0432\u0448\u0438\u0441\u044C", 6, 2),
Among(u"\u044B\u0432\u0448\u0438\u0441\u044C", 6, 2)
]
a_1 = [
Among(u"\u0435\u0435", -1, 1),
Among(u"\u0438\u0435", -1, 1),
Among(u"\u043E\u0435", -1, 1),
Among(u"\u044B\u0435", -1, 1),
Among(u"\u0438\u043C\u0438", -1, 1),
Among(u"\u044B\u043C\u0438", -1, 1),
Among(u"\u0435\u0439", -1, 1),
Among(u"\u0438\u0439", -1, 1),
Among(u"\u043E\u0439", -1, 1),
Among(u"\u044B\u0439", -1, 1),
Among(u"\u0435\u043C", -1, 1),
Among(u"\u0438\u043C", -1, 1),
Among(u"\u043E\u043C", -1, 1),
Among(u"\u044B\u043C", -1, 1),
Among(u"\u0435\u0433\u043E", -1, 1),
Among(u"\u043E\u0433\u043E", -1, 1),
Among(u"\u0435\u043C\u0443", -1, 1),
Among(u"\u043E\u043C\u0443", -1, 1),
Among(u"\u0438\u0445", -1, 1),
Among(u"\u044B\u0445", -1, 1),
Among(u"\u0435\u044E", -1, 1),
Among(u"\u043E\u044E", -1, 1),
Among(u"\u0443\u044E", -1, 1),
Among(u"\u044E\u044E", -1, 1),
Among(u"\u0430\u044F", -1, 1),
Among(u"\u044F\u044F", -1, 1)
]
a_2 = [
Among(u"\u0435\u043C", -1, 1),
Among(u"\u043D\u043D", -1, 1),
Among(u"\u0432\u0448", -1, 1),
Among(u"\u0438\u0432\u0448", 2, 2),
Among(u"\u044B\u0432\u0448", 2, 2),
Among(u"\u0449", -1, 1),
Among(u"\u044E\u0449", 5, 1),
Among(u"\u0443\u044E\u0449", 6, 2)
]
a_3 = [
Among(u"\u0441\u044C", -1, 1),
Among(u"\u0441\u044F", -1, 1)
]
a_4 = [
Among(u"\u043B\u0430", -1, 1),
Among(u"\u0438\u043B\u0430", 0, 2),
Among(u"\u044B\u043B\u0430", 0, 2),
Among(u"\u043D\u0430", -1, 1),
Among(u"\u0435\u043D\u0430", 3, 2),
Among(u"\u0435\u0442\u0435", -1, 1),
Among(u"\u0438\u0442\u0435", -1, 2),
Among(u"\u0439\u0442\u0435", -1, 1),
Among(u"\u0435\u0439\u0442\u0435", 7, 2),
Among(u"\u0443\u0439\u0442\u0435", 7, 2),
Among(u"\u043B\u0438", -1, 1),
Among(u"\u0438\u043B\u0438", 10, 2),
Among(u"\u044B\u043B\u0438", 10, 2),
Among(u"\u0439", -1, 1),
Among(u"\u0435\u0439", 13, 2),
Among(u"\u0443\u0439", 13, 2),
Among(u"\u043B", -1, 1),
Among(u"\u0438\u043B", 16, 2),
Among(u"\u044B\u043B", 16, 2),
Among(u"\u0435\u043C", -1, 1),
Among(u"\u0438\u043C", -1, 2),
Among(u"\u044B\u043C", -1, 2),
Among(u"\u043D", -1, 1),
Among(u"\u0435\u043D", 22, 2),
Among(u"\u043B\u043E", -1, 1),
Among(u"\u0438\u043B\u043E", 24, 2),
Among(u"\u044B\u043B\u043E", 24, 2),
Among(u"\u043D\u043E", -1, 1),
Among(u"\u0435\u043D\u043E", 27, 2),
Among(u"\u043D\u043D\u043E", 27, 1),
Among(u"\u0435\u0442", -1, 1),
Among(u"\u0443\u0435\u0442", 30, 2),
Among(u"\u0438\u0442", -1, 2),
Among(u"\u044B\u0442", -1, 2),
Among(u"\u044E\u0442", -1, 1),
Among(u"\u0443\u044E\u0442", 34, 2),
Among(u"\u044F\u0442", -1, 2),
Among(u"\u043D\u044B", -1, 1),
Among(u"\u0435\u043D\u044B", 37, 2),
Among(u"\u0442\u044C", -1, 1),
Among(u"\u0438\u0442\u044C", 39, 2),
Among(u"\u044B\u0442\u044C", 39, 2),
Among(u"\u0435\u0448\u044C", -1, 1),
Among(u"\u0438\u0448\u044C", -1, 2),
Among(u"\u044E", -1, 2),
Among(u"\u0443\u044E", 44, 2)
]
a_5 = [
Among(u"\u0430", -1, 1),
Among(u"\u0435\u0432", -1, 1),
Among(u"\u043E\u0432", -1, 1),
Among(u"\u0435", -1, 1),
Among(u"\u0438\u0435", 3, 1),
Among(u"\u044C\u0435", 3, 1),
Among(u"\u0438", -1, 1),
Among(u"\u0435\u0438", 6, 1),
Among(u"\u0438\u0438", 6, 1),
Among(u"\u0430\u043C\u0438", 6, 1),
Among(u"\u044F\u043C\u0438", 6, 1),
Among(u"\u0438\u044F\u043C\u0438", 10, 1),
Among(u"\u0439", -1, 1),
Among(u"\u0435\u0439", 12, 1),
Among(u"\u0438\u0435\u0439", 13, 1),
Among(u"\u0438\u0439", 12, 1),
Among(u"\u043E\u0439", 12, 1),
Among(u"\u0430\u043C", -1, 1),
Among(u"\u0435\u043C", -1, 1),
Among(u"\u0438\u0435\u043C", 18, 1),
Among(u"\u043E\u043C", -1, 1),
Among(u"\u044F\u043C", -1, 1),
Among(u"\u0438\u044F\u043C", 21, 1),
Among(u"\u043E", -1, 1),
Among(u"\u0443", -1, 1),
Among(u"\u0430\u0445", -1, 1),
Among(u"\u044F\u0445", -1, 1),
Among(u"\u0438\u044F\u0445", 26, 1),
Among(u"\u044B", -1, 1),
Among(u"\u044C", -1, 1),
Among(u"\u044E", -1, 1),
Among(u"\u0438\u044E", 30, 1),
Among(u"\u044C\u044E", 30, 1),
Among(u"\u044F", -1, 1),
Among(u"\u0438\u044F", 33, 1),
Among(u"\u044C\u044F", 33, 1)
]
a_6 = [
Among(u"\u043E\u0441\u0442", -1, 1),
Among(u"\u043E\u0441\u0442\u044C", -1, 1)
]
a_7 = [
Among(u"\u0435\u0439\u0448\u0435", -1, 1),
Among(u"\u043D", -1, 2),
Among(u"\u0435\u0439\u0448", -1, 1),
Among(u"\u044C", -1, 3)
]
g_v = [33, 65, 8, 232]
I_p2 = 0
I_pV = 0
def copy_from(self, other):
self.I_p2 = other.I_p2
self.I_pV = other.I_pV
super.copy_from(other)
def r_mark_regions(self):
# (, line 57
self.I_pV = self.limit;
self.I_p2 = self.limit;
# do, line 61
v_1 = self.cursor
try:
# (, line 61
# gopast, line 62
try:
while True:
try:
if not self.in_grouping(RussianStemmer.g_v, 1072, 1103):
raise lab2()
raise lab1()
except lab2: pass
if self.cursor >= self.limit:
raise lab0()
self.cursor += 1
except lab1: pass
# setmark pV, line 62
self.I_pV = self.cursor
# gopast, line 62
try:
while True:
try:
if not self.out_grouping(RussianStemmer.g_v, 1072, 1103):
raise lab4()
raise lab3()
except lab4: pass
if self.cursor >= self.limit:
raise lab0()
self.cursor += 1
except lab3: pass
# gopast, line 63
try:
while True:
try:
if not self.in_grouping(RussianStemmer.g_v, 1072, 1103):
raise lab6()
raise lab5()
except lab6: pass
if self.cursor >= self.limit:
raise lab0()
self.cursor += 1
except lab5: pass
# gopast, line 63
try:
while True:
try:
if not self.out_grouping(RussianStemmer.g_v, 1072, 1103):
raise lab8()
raise lab7()
except lab8: pass
if self.cursor >= self.limit:
raise lab0()
self.cursor += 1
except lab7: pass
# setmark p2, line 63
self.I_p2 = self.cursor
except lab0: pass
self.cursor = v_1
return True
def r_R2(self):
if not self.I_p2 <= self.cursor:
return False
return True
def r_perfective_gerund(self):
# (, line 71
# [, line 72
self.ket = self.cursor
# substring, line 72
among_var = self.find_among_b(RussianStemmer.a_0, 9)
if among_var == 0:
return False
# ], line 72
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 76
# or, line 76
try:
v_1 = self.limit - self.cursor
try:
# literal, line 76
if not self.eq_s_b(1, u"\u0430"):
raise lab1()
raise lab0()
except lab1: pass
self.cursor = self.limit - v_1
# literal, line 76
if not self.eq_s_b(1, u"\u044F"):
return False
except lab0: pass
# delete, line 76
if not self.slice_del():
return False
elif among_var == 2:
# (, line 83
# delete, line 83
if not self.slice_del():
return False
return True
def r_adjective(self):
# (, line 87
# [, line 88
self.ket = self.cursor
# substring, line 88
among_var = self.find_among_b(RussianStemmer.a_1, 26)
if among_var == 0:
return False
# ], line 88
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 97
# delete, line 97
if not self.slice_del():
return False
return True
def r_adjectival(self):
# (, line 101
# call adjective, line 102
if not self.r_adjective():
return False
# try, line 109
v_1 = self.limit - self.cursor
try:
# (, line 109
# [, line 110
self.ket = self.cursor
# substring, line 110
among_var = self.find_among_b(RussianStemmer.a_2, 8)
if among_var == 0:
self.cursor = self.limit - v_1
raise lab0()
# ], line 110
self.bra = self.cursor
if among_var == 0:
self.cursor = self.limit - v_1
raise lab0()
elif among_var == 1:
# (, line 115
# or, line 115
try:
v_2 = self.limit - self.cursor
try:
# literal, line 115
if not self.eq_s_b(1, u"\u0430"):
raise lab2()
raise lab1()
except lab2: pass
self.cursor = self.limit - v_2
# literal, line 115
if not self.eq_s_b(1, u"\u044F"):
self.cursor = self.limit - v_1
raise lab0()
except lab1: pass
# delete, line 115
if not self.slice_del():
return False
elif among_var == 2:
# (, line 122
# delete, line 122
if not self.slice_del():
return False
except lab0: pass
return True
def r_reflexive(self):
# (, line 128
# [, line 129
self.ket = self.cursor
# substring, line 129
among_var = self.find_among_b(RussianStemmer.a_3, 2)
if among_var == 0:
return False
# ], line 129
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 132
# delete, line 132
if not self.slice_del():
return False
return True
def r_verb(self):
# (, line 136
# [, line 137
self.ket = self.cursor
# substring, line 137
among_var = self.find_among_b(RussianStemmer.a_4, 46)
if among_var == 0:
return False
# ], line 137
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 143
# or, line 143
try:
v_1 = self.limit - self.cursor
try:
# literal, line 143
if not self.eq_s_b(1, u"\u0430"):
raise lab1()
raise lab0()
except lab1: pass
self.cursor = self.limit - v_1
# literal, line 143
if not self.eq_s_b(1, u"\u044F"):
return False
except lab0: pass
# delete, line 143
if not self.slice_del():
return False
elif among_var == 2:
# (, line 151
# delete, line 151
if not self.slice_del():
return False
return True
def r_noun(self):
# (, line 159
# [, line 160
self.ket = self.cursor
# substring, line 160
among_var = self.find_among_b(RussianStemmer.a_5, 36)
if among_var == 0:
return False
# ], line 160
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 167
# delete, line 167
if not self.slice_del():
return False
return True
def r_derivational(self):
# (, line 175
# [, line 176
self.ket = self.cursor
# substring, line 176
among_var = self.find_among_b(RussianStemmer.a_6, 2)
if among_var == 0:
return False
# ], line 176
self.bra = self.cursor
# call R2, line 176
if not self.r_R2():
return False
if among_var == 0:
return False
elif among_var == 1:
# (, line 179
# delete, line 179
if not self.slice_del():
return False
return True
def r_tidy_up(self):
# (, line 183
# [, line 184
self.ket = self.cursor
# substring, line 184
among_var = self.find_among_b(RussianStemmer.a_7, 4)
if among_var == 0:
return False
# ], line 184
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 188
# delete, line 188
if not self.slice_del():
return False
# [, line 189
self.ket = self.cursor
# literal, line 189
if not self.eq_s_b(1, u"\u043D"):
return False
# ], line 189
self.bra = self.cursor
# literal, line 189
if not self.eq_s_b(1, u"\u043D"):
return False
# delete, line 189
if not self.slice_del():
return False
elif among_var == 2:
# (, line 192
# literal, line 192
if not self.eq_s_b(1, u"\u043D"):
return False
# delete, line 192
if not self.slice_del():
return False
elif among_var == 3:
# (, line 194
# delete, line 194
if not self.slice_del():
return False
return True
def _stem(self):
# (, line 199
# do, line 201
v_1 = self.cursor
try:
# call mark_regions, line 201
if not self.r_mark_regions():
raise lab0()
except lab0: pass
self.cursor = v_1
# backwards, line 202
self.limit_backward = self.cursor
self.cursor = self.limit
# setlimit, line 202
v_2 = self.limit - self.cursor
# tomark, line 202
if self.cursor < self.I_pV:
return False
self.cursor = self.I_pV
v_3 = self.limit_backward
self.limit_backward = self.cursor
self.cursor = self.limit - v_2
# (, line 202
# do, line 203
v_4 = self.limit - self.cursor
try:
# (, line 203
# or, line 204
try:
v_5 = self.limit - self.cursor
try:
# call perfective_gerund, line 204
if not self.r_perfective_gerund():
raise lab3()
raise lab2()
except lab3: pass
self.cursor = self.limit - v_5
# (, line 205
# try, line 205
v_6 = self.limit - self.cursor
try:
# call reflexive, line 205
if not self.r_reflexive():
self.cursor = self.limit - v_6
raise lab4()
except lab4: pass
# or, line 206
try:
v_7 = self.limit - self.cursor
try:
# call adjectival, line 206
if not self.r_adjectival():
raise lab6()
raise lab5()
except lab6: pass
self.cursor = self.limit - v_7
try:
# call verb, line 206
if not self.r_verb():
raise lab7()
raise lab5()
except lab7: pass
self.cursor = self.limit - v_7
# call noun, line 206
if not self.r_noun():
raise lab1()
except lab5: pass
except lab2: pass
except lab1: pass
self.cursor = self.limit - v_4
# try, line 209
v_8 = self.limit - self.cursor
try:
# (, line 209
# [, line 209
self.ket = self.cursor
# literal, line 209
if not self.eq_s_b(1, u"\u0438"):
self.cursor = self.limit - v_8
raise lab8()
# ], line 209
self.bra = self.cursor
# delete, line 209
if not self.slice_del():
return False
except lab8: pass
# do, line 212
v_9 = self.limit - self.cursor
try:
# call derivational, line 212
if not self.r_derivational():
raise lab9()
except lab9: pass
self.cursor = self.limit - v_9
# do, line 213
v_10 = self.limit - self.cursor
try:
# call tidy_up, line 213
if not self.r_tidy_up():
raise lab10()
except lab10: pass
self.cursor = self.limit - v_10
self.limit_backward = v_3
self.cursor = self.limit_backward
return True
def equals(self, o):
return isinstance(o, RussianStemmer)
def hashCode(self):
return hash("RussianStemmer")
class lab0(BaseException): pass
class lab1(BaseException): pass
class lab2(BaseException): pass
class lab3(BaseException): pass
class lab4(BaseException): pass
class lab5(BaseException): pass
class lab6(BaseException): pass
class lab7(BaseException): pass
class lab8(BaseException): pass
class lab9(BaseException): pass
class lab10(BaseException): pass