ansible-later/env_27/lib/python2.7/site-packages/snowballstemmer/portuguese_stemmer.py

966 lines
31 KiB
Python
Raw Normal View History

2019-04-11 13:56:20 +00:00
# self file was generated automatically by the Snowball to Python interpreter
from .basestemmer import BaseStemmer
from .among import Among
class PortugueseStemmer(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"", -1, 3),
Among(u"\u00E3", 0, 1),
Among(u"\u00F5", 0, 2)
]
a_1 = [
Among(u"", -1, 3),
Among(u"a~", 0, 1),
Among(u"o~", 0, 2)
]
a_2 = [
Among(u"ic", -1, -1),
Among(u"ad", -1, -1),
Among(u"os", -1, -1),
Among(u"iv", -1, 1)
]
a_3 = [
Among(u"ante", -1, 1),
Among(u"avel", -1, 1),
Among(u"\u00EDvel", -1, 1)
]
a_4 = [
Among(u"ic", -1, 1),
Among(u"abil", -1, 1),
Among(u"iv", -1, 1)
]
a_5 = [
Among(u"ica", -1, 1),
Among(u"\u00E2ncia", -1, 1),
Among(u"\u00EAncia", -1, 4),
Among(u"ira", -1, 9),
Among(u"adora", -1, 1),
Among(u"osa", -1, 1),
Among(u"ista", -1, 1),
Among(u"iva", -1, 8),
Among(u"eza", -1, 1),
Among(u"log\u00EDa", -1, 2),
Among(u"idade", -1, 7),
Among(u"ante", -1, 1),
Among(u"mente", -1, 6),
Among(u"amente", 12, 5),
Among(u"\u00E1vel", -1, 1),
Among(u"\u00EDvel", -1, 1),
Among(u"uci\u00F3n", -1, 3),
Among(u"ico", -1, 1),
Among(u"ismo", -1, 1),
Among(u"oso", -1, 1),
Among(u"amento", -1, 1),
Among(u"imento", -1, 1),
Among(u"ivo", -1, 8),
Among(u"a\u00E7a~o", -1, 1),
Among(u"ador", -1, 1),
Among(u"icas", -1, 1),
Among(u"\u00EAncias", -1, 4),
Among(u"iras", -1, 9),
Among(u"adoras", -1, 1),
Among(u"osas", -1, 1),
Among(u"istas", -1, 1),
Among(u"ivas", -1, 8),
Among(u"ezas", -1, 1),
Among(u"log\u00EDas", -1, 2),
Among(u"idades", -1, 7),
Among(u"uciones", -1, 3),
Among(u"adores", -1, 1),
Among(u"antes", -1, 1),
Among(u"a\u00E7o~es", -1, 1),
Among(u"icos", -1, 1),
Among(u"ismos", -1, 1),
Among(u"osos", -1, 1),
Among(u"amentos", -1, 1),
Among(u"imentos", -1, 1),
Among(u"ivos", -1, 8)
]
a_6 = [
Among(u"ada", -1, 1),
Among(u"ida", -1, 1),
Among(u"ia", -1, 1),
Among(u"aria", 2, 1),
Among(u"eria", 2, 1),
Among(u"iria", 2, 1),
Among(u"ara", -1, 1),
Among(u"era", -1, 1),
Among(u"ira", -1, 1),
Among(u"ava", -1, 1),
Among(u"asse", -1, 1),
Among(u"esse", -1, 1),
Among(u"isse", -1, 1),
Among(u"aste", -1, 1),
Among(u"este", -1, 1),
Among(u"iste", -1, 1),
Among(u"ei", -1, 1),
Among(u"arei", 16, 1),
Among(u"erei", 16, 1),
Among(u"irei", 16, 1),
Among(u"am", -1, 1),
Among(u"iam", 20, 1),
Among(u"ariam", 21, 1),
Among(u"eriam", 21, 1),
Among(u"iriam", 21, 1),
Among(u"aram", 20, 1),
Among(u"eram", 20, 1),
Among(u"iram", 20, 1),
Among(u"avam", 20, 1),
Among(u"em", -1, 1),
Among(u"arem", 29, 1),
Among(u"erem", 29, 1),
Among(u"irem", 29, 1),
Among(u"assem", 29, 1),
Among(u"essem", 29, 1),
Among(u"issem", 29, 1),
Among(u"ado", -1, 1),
Among(u"ido", -1, 1),
Among(u"ando", -1, 1),
Among(u"endo", -1, 1),
Among(u"indo", -1, 1),
Among(u"ara~o", -1, 1),
Among(u"era~o", -1, 1),
Among(u"ira~o", -1, 1),
Among(u"ar", -1, 1),
Among(u"er", -1, 1),
Among(u"ir", -1, 1),
Among(u"as", -1, 1),
Among(u"adas", 47, 1),
Among(u"idas", 47, 1),
Among(u"ias", 47, 1),
Among(u"arias", 50, 1),
Among(u"erias", 50, 1),
Among(u"irias", 50, 1),
Among(u"aras", 47, 1),
Among(u"eras", 47, 1),
Among(u"iras", 47, 1),
Among(u"avas", 47, 1),
Among(u"es", -1, 1),
Among(u"ardes", 58, 1),
Among(u"erdes", 58, 1),
Among(u"irdes", 58, 1),
Among(u"ares", 58, 1),
Among(u"eres", 58, 1),
Among(u"ires", 58, 1),
Among(u"asses", 58, 1),
Among(u"esses", 58, 1),
Among(u"isses", 58, 1),
Among(u"astes", 58, 1),
Among(u"estes", 58, 1),
Among(u"istes", 58, 1),
Among(u"is", -1, 1),
Among(u"ais", 71, 1),
Among(u"eis", 71, 1),
Among(u"areis", 73, 1),
Among(u"ereis", 73, 1),
Among(u"ireis", 73, 1),
Among(u"\u00E1reis", 73, 1),
Among(u"\u00E9reis", 73, 1),
Among(u"\u00EDreis", 73, 1),
Among(u"\u00E1sseis", 73, 1),
Among(u"\u00E9sseis", 73, 1),
Among(u"\u00EDsseis", 73, 1),
Among(u"\u00E1veis", 73, 1),
Among(u"\u00EDeis", 73, 1),
Among(u"ar\u00EDeis", 84, 1),
Among(u"er\u00EDeis", 84, 1),
Among(u"ir\u00EDeis", 84, 1),
Among(u"ados", -1, 1),
Among(u"idos", -1, 1),
Among(u"amos", -1, 1),
Among(u"\u00E1ramos", 90, 1),
Among(u"\u00E9ramos", 90, 1),
Among(u"\u00EDramos", 90, 1),
Among(u"\u00E1vamos", 90, 1),
Among(u"\u00EDamos", 90, 1),
Among(u"ar\u00EDamos", 95, 1),
Among(u"er\u00EDamos", 95, 1),
Among(u"ir\u00EDamos", 95, 1),
Among(u"emos", -1, 1),
Among(u"aremos", 99, 1),
Among(u"eremos", 99, 1),
Among(u"iremos", 99, 1),
Among(u"\u00E1ssemos", 99, 1),
Among(u"\u00EAssemos", 99, 1),
Among(u"\u00EDssemos", 99, 1),
Among(u"imos", -1, 1),
Among(u"armos", -1, 1),
Among(u"ermos", -1, 1),
Among(u"irmos", -1, 1),
Among(u"\u00E1mos", -1, 1),
Among(u"ar\u00E1s", -1, 1),
Among(u"er\u00E1s", -1, 1),
Among(u"ir\u00E1s", -1, 1),
Among(u"eu", -1, 1),
Among(u"iu", -1, 1),
Among(u"ou", -1, 1),
Among(u"ar\u00E1", -1, 1),
Among(u"er\u00E1", -1, 1),
Among(u"ir\u00E1", -1, 1)
]
a_7 = [
Among(u"a", -1, 1),
Among(u"i", -1, 1),
Among(u"o", -1, 1),
Among(u"os", -1, 1),
Among(u"\u00E1", -1, 1),
Among(u"\u00ED", -1, 1),
Among(u"\u00F3", -1, 1)
]
a_8 = [
Among(u"e", -1, 1),
Among(u"\u00E7", -1, 2),
Among(u"\u00E9", -1, 1),
Among(u"\u00EA", -1, 1)
]
g_v = [17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2]
I_p2 = 0
I_p1 = 0
I_pV = 0
def copy_from(self, other):
self.I_p2 = other.I_p2
self.I_p1 = other.I_p1
self.I_pV = other.I_pV
super.copy_from(other)
def r_prelude(self):
# repeat, line 36
try:
while True:
try:
v_1 = self.cursor
try:
# (, line 36
# [, line 37
self.bra = self.cursor
# substring, line 37
among_var = self.find_among(PortugueseStemmer.a_0, 3)
if among_var == 0:
raise lab2()
# ], line 37
self.ket = self.cursor
if among_var == 0:
raise lab2()
elif among_var == 1:
# (, line 38
# <-, line 38
if not self.slice_from(u"a~"):
return False
elif among_var == 2:
# (, line 39
# <-, line 39
if not self.slice_from(u"o~"):
return False
elif among_var == 3:
# (, line 40
# next, line 40
if self.cursor >= self.limit:
raise lab2()
self.cursor += 1
raise lab1()
except lab2: pass
self.cursor = v_1
raise lab0()
except lab1: pass
except lab0: pass
return True
def r_mark_regions(self):
# (, line 44
self.I_pV = self.limit;
self.I_p1 = self.limit;
self.I_p2 = self.limit;
# do, line 50
v_1 = self.cursor
try:
# (, line 50
# or, line 52
try:
v_2 = self.cursor
try:
# (, line 51
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab2()
# or, line 51
try:
v_3 = self.cursor
try:
# (, line 51
if not self.out_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab4()
# gopast, line 51
try:
while True:
try:
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab6()
raise lab5()
except lab6: pass
if self.cursor >= self.limit:
raise lab4()
self.cursor += 1
except lab5: pass
raise lab3()
except lab4: pass
self.cursor = v_3
# (, line 51
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab2()
# gopast, line 51
try:
while True:
try:
if not self.out_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab8()
raise lab7()
except lab8: pass
if self.cursor >= self.limit:
raise lab2()
self.cursor += 1
except lab7: pass
except lab3: pass
raise lab1()
except lab2: pass
self.cursor = v_2
# (, line 53
if not self.out_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab0()
# or, line 53
try:
v_6 = self.cursor
try:
# (, line 53
if not self.out_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab10()
# gopast, line 53
try:
while True:
try:
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab12()
raise lab11()
except lab12: pass
if self.cursor >= self.limit:
raise lab10()
self.cursor += 1
except lab11: pass
raise lab9()
except lab10: pass
self.cursor = v_6
# (, line 53
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab0()
# next, line 53
if self.cursor >= self.limit:
raise lab0()
self.cursor += 1
except lab9: pass
except lab1: pass
# setmark pV, line 54
self.I_pV = self.cursor
except lab0: pass
self.cursor = v_1
# do, line 56
v_8 = self.cursor
try:
# (, line 56
# gopast, line 57
try:
while True:
try:
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab15()
raise lab14()
except lab15: pass
if self.cursor >= self.limit:
raise lab13()
self.cursor += 1
except lab14: pass
# gopast, line 57
try:
while True:
try:
if not self.out_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab17()
raise lab16()
except lab17: pass
if self.cursor >= self.limit:
raise lab13()
self.cursor += 1
except lab16: pass
# setmark p1, line 57
self.I_p1 = self.cursor
# gopast, line 58
try:
while True:
try:
if not self.in_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab19()
raise lab18()
except lab19: pass
if self.cursor >= self.limit:
raise lab13()
self.cursor += 1
except lab18: pass
# gopast, line 58
try:
while True:
try:
if not self.out_grouping(PortugueseStemmer.g_v, 97, 250):
raise lab21()
raise lab20()
except lab21: pass
if self.cursor >= self.limit:
raise lab13()
self.cursor += 1
except lab20: pass
# setmark p2, line 58
self.I_p2 = self.cursor
except lab13: pass
self.cursor = v_8
return True
def r_postlude(self):
# repeat, line 62
try:
while True:
try:
v_1 = self.cursor
try:
# (, line 62
# [, line 63
self.bra = self.cursor
# substring, line 63
among_var = self.find_among(PortugueseStemmer.a_1, 3)
if among_var == 0:
raise lab2()
# ], line 63
self.ket = self.cursor
if among_var == 0:
raise lab2()
elif among_var == 1:
# (, line 64
# <-, line 64
if not self.slice_from(u"\u00E3"):
return False
elif among_var == 2:
# (, line 65
# <-, line 65
if not self.slice_from(u"\u00F5"):
return False
elif among_var == 3:
# (, line 66
# next, line 66
if self.cursor >= self.limit:
raise lab2()
self.cursor += 1
raise lab1()
except lab2: pass
self.cursor = v_1
raise lab0()
except lab1: pass
except lab0: pass
return True
def r_RV(self):
if not self.I_pV <= self.cursor:
return False
return True
def r_R1(self):
if not self.I_p1 <= self.cursor:
return False
return True
def r_R2(self):
if not self.I_p2 <= self.cursor:
return False
return True
def r_standard_suffix(self):
# (, line 76
# [, line 77
self.ket = self.cursor
# substring, line 77
among_var = self.find_among_b(PortugueseStemmer.a_5, 45)
if among_var == 0:
return False
# ], line 77
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 92
# call R2, line 93
if not self.r_R2():
return False
# delete, line 93
if not self.slice_del():
return False
elif among_var == 2:
# (, line 97
# call R2, line 98
if not self.r_R2():
return False
# <-, line 98
if not self.slice_from(u"log"):
return False
elif among_var == 3:
# (, line 101
# call R2, line 102
if not self.r_R2():
return False
# <-, line 102
if not self.slice_from(u"u"):
return False
elif among_var == 4:
# (, line 105
# call R2, line 106
if not self.r_R2():
return False
# <-, line 106
if not self.slice_from(u"ente"):
return False
elif among_var == 5:
# (, line 109
# call R1, line 110
if not self.r_R1():
return False
# delete, line 110
if not self.slice_del():
return False
# try, line 111
v_1 = self.limit - self.cursor
try:
# (, line 111
# [, line 112
self.ket = self.cursor
# substring, line 112
among_var = self.find_among_b(PortugueseStemmer.a_2, 4)
if among_var == 0:
self.cursor = self.limit - v_1
raise lab0()
# ], line 112
self.bra = self.cursor
# call R2, line 112
if not self.r_R2():
self.cursor = self.limit - v_1
raise lab0()
# delete, line 112
if not self.slice_del():
return False
if among_var == 0:
self.cursor = self.limit - v_1
raise lab0()
elif among_var == 1:
# (, line 113
# [, line 113
self.ket = self.cursor
# literal, line 113
if not self.eq_s_b(2, u"at"):
self.cursor = self.limit - v_1
raise lab0()
# ], line 113
self.bra = self.cursor
# call R2, line 113
if not self.r_R2():
self.cursor = self.limit - v_1
raise lab0()
# delete, line 113
if not self.slice_del():
return False
except lab0: pass
elif among_var == 6:
# (, line 121
# call R2, line 122
if not self.r_R2():
return False
# delete, line 122
if not self.slice_del():
return False
# try, line 123
v_2 = self.limit - self.cursor
try:
# (, line 123
# [, line 124
self.ket = self.cursor
# substring, line 124
among_var = self.find_among_b(PortugueseStemmer.a_3, 3)
if among_var == 0:
self.cursor = self.limit - v_2
raise lab1()
# ], line 124
self.bra = self.cursor
if among_var == 0:
self.cursor = self.limit - v_2
raise lab1()
elif among_var == 1:
# (, line 127
# call R2, line 127
if not self.r_R2():
self.cursor = self.limit - v_2
raise lab1()
# delete, line 127
if not self.slice_del():
return False
except lab1: pass
elif among_var == 7:
# (, line 133
# call R2, line 134
if not self.r_R2():
return False
# delete, line 134
if not self.slice_del():
return False
# try, line 135
v_3 = self.limit - self.cursor
try:
# (, line 135
# [, line 136
self.ket = self.cursor
# substring, line 136
among_var = self.find_among_b(PortugueseStemmer.a_4, 3)
if among_var == 0:
self.cursor = self.limit - v_3
raise lab2()
# ], line 136
self.bra = self.cursor
if among_var == 0:
self.cursor = self.limit - v_3
raise lab2()
elif among_var == 1:
# (, line 139
# call R2, line 139
if not self.r_R2():
self.cursor = self.limit - v_3
raise lab2()
# delete, line 139
if not self.slice_del():
return False
except lab2: pass
elif among_var == 8:
# (, line 145
# call R2, line 146
if not self.r_R2():
return False
# delete, line 146
if not self.slice_del():
return False
# try, line 147
v_4 = self.limit - self.cursor
try:
# (, line 147
# [, line 148
self.ket = self.cursor
# literal, line 148
if not self.eq_s_b(2, u"at"):
self.cursor = self.limit - v_4
raise lab3()
# ], line 148
self.bra = self.cursor
# call R2, line 148
if not self.r_R2():
self.cursor = self.limit - v_4
raise lab3()
# delete, line 148
if not self.slice_del():
return False
except lab3: pass
elif among_var == 9:
# (, line 152
# call RV, line 153
if not self.r_RV():
return False
# literal, line 153
if not self.eq_s_b(1, u"e"):
return False
# <-, line 154
if not self.slice_from(u"ir"):
return False
return True
def r_verb_suffix(self):
# setlimit, line 159
v_1 = self.limit - self.cursor
# tomark, line 159
if self.cursor < self.I_pV:
return False
self.cursor = self.I_pV
v_2 = self.limit_backward
self.limit_backward = self.cursor
self.cursor = self.limit - v_1
# (, line 159
# [, line 160
self.ket = self.cursor
# substring, line 160
among_var = self.find_among_b(PortugueseStemmer.a_6, 120)
if among_var == 0:
self.limit_backward = v_2
return False
# ], line 160
self.bra = self.cursor
if among_var == 0:
self.limit_backward = v_2
return False
elif among_var == 1:
# (, line 179
# delete, line 179
if not self.slice_del():
return False
self.limit_backward = v_2
return True
def r_residual_suffix(self):
# (, line 183
# [, line 184
self.ket = self.cursor
# substring, line 184
among_var = self.find_among_b(PortugueseStemmer.a_7, 7)
if among_var == 0:
return False
# ], line 184
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 187
# call RV, line 187
if not self.r_RV():
return False
# delete, line 187
if not self.slice_del():
return False
return True
def r_residual_form(self):
# (, line 191
# [, line 192
self.ket = self.cursor
# substring, line 192
among_var = self.find_among_b(PortugueseStemmer.a_8, 4)
if among_var == 0:
return False
# ], line 192
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 194
# call RV, line 194
if not self.r_RV():
return False
# delete, line 194
if not self.slice_del():
return False
# [, line 194
self.ket = self.cursor
# or, line 194
try:
v_1 = self.limit - self.cursor
try:
# (, line 194
# literal, line 194
if not self.eq_s_b(1, u"u"):
raise lab1()
# ], line 194
self.bra = self.cursor
# test, line 194
v_2 = self.limit - self.cursor
# literal, line 194
if not self.eq_s_b(1, u"g"):
raise lab1()
self.cursor = self.limit - v_2
raise lab0()
except lab1: pass
self.cursor = self.limit - v_1
# (, line 195
# literal, line 195
if not self.eq_s_b(1, u"i"):
return False
# ], line 195
self.bra = self.cursor
# test, line 195
v_3 = self.limit - self.cursor
# literal, line 195
if not self.eq_s_b(1, u"c"):
return False
self.cursor = self.limit - v_3
except lab0: pass
# call RV, line 195
if not self.r_RV():
return False
# delete, line 195
if not self.slice_del():
return False
elif among_var == 2:
# (, line 196
# <-, line 196
if not self.slice_from(u"c"):
return False
return True
def _stem(self):
# (, line 201
# do, line 202
v_1 = self.cursor
try:
# call prelude, line 202
if not self.r_prelude():
raise lab0()
except lab0: pass
self.cursor = v_1
# do, line 203
v_2 = self.cursor
try:
# call mark_regions, line 203
if not self.r_mark_regions():
raise lab1()
except lab1: pass
self.cursor = v_2
# backwards, line 204
self.limit_backward = self.cursor
self.cursor = self.limit
# (, line 204
# do, line 205
v_3 = self.limit - self.cursor
try:
# (, line 205
# or, line 209
try:
v_4 = self.limit - self.cursor
try:
# (, line 206
# and, line 207
v_5 = self.limit - self.cursor
# (, line 206
# or, line 206
try:
v_6 = self.limit - self.cursor
try:
# call standard_suffix, line 206
if not self.r_standard_suffix():
raise lab6()
raise lab5()
except lab6: pass
self.cursor = self.limit - v_6
# call verb_suffix, line 206
if not self.r_verb_suffix():
raise lab4()
except lab5: pass
self.cursor = self.limit - v_5
# do, line 207
v_7 = self.limit - self.cursor
try:
# (, line 207
# [, line 207
self.ket = self.cursor
# literal, line 207
if not self.eq_s_b(1, u"i"):
raise lab7()
# ], line 207
self.bra = self.cursor
# test, line 207
v_8 = self.limit - self.cursor
# literal, line 207
if not self.eq_s_b(1, u"c"):
raise lab7()
self.cursor = self.limit - v_8
# call RV, line 207
if not self.r_RV():
raise lab7()
# delete, line 207
if not self.slice_del():
return False
except lab7: pass
self.cursor = self.limit - v_7
raise lab3()
except lab4: pass
self.cursor = self.limit - v_4
# call residual_suffix, line 209
if not self.r_residual_suffix():
raise lab2()
except lab3: pass
except lab2: pass
self.cursor = self.limit - v_3
# do, line 211
v_9 = self.limit - self.cursor
try:
# call residual_form, line 211
if not self.r_residual_form():
raise lab8()
except lab8: pass
self.cursor = self.limit - v_9
self.cursor = self.limit_backward
# do, line 213
v_10 = self.cursor
try:
# call postlude, line 213
if not self.r_postlude():
raise lab9()
except lab9: pass
self.cursor = v_10
return True
def equals(self, o):
return isinstance(o, PortugueseStemmer)
def hashCode(self):
return hash("PortugueseStemmer")
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
class lab11(BaseException): pass
class lab12(BaseException): pass
class lab13(BaseException): pass
class lab14(BaseException): pass
class lab15(BaseException): pass
class lab16(BaseException): pass
class lab17(BaseException): pass
class lab18(BaseException): pass
class lab19(BaseException): pass
class lab20(BaseException): pass
class lab21(BaseException): pass