mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-14 09:10:39 +00:00
620 lines
21 KiB
Python
620 lines
21 KiB
Python
|
# self file was generated automatically by the Snowball to Python interpreter
|
||
|
|
||
|
from .basestemmer import BaseStemmer
|
||
|
from .among import Among
|
||
|
|
||
|
|
||
|
class GermanStemmer(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, 6),
|
||
|
Among(u"U", 0, 2),
|
||
|
Among(u"Y", 0, 1),
|
||
|
Among(u"\u00E4", 0, 3),
|
||
|
Among(u"\u00F6", 0, 4),
|
||
|
Among(u"\u00FC", 0, 5)
|
||
|
]
|
||
|
|
||
|
a_1 = [
|
||
|
Among(u"e", -1, 2),
|
||
|
Among(u"em", -1, 1),
|
||
|
Among(u"en", -1, 2),
|
||
|
Among(u"ern", -1, 1),
|
||
|
Among(u"er", -1, 1),
|
||
|
Among(u"s", -1, 3),
|
||
|
Among(u"es", 5, 2)
|
||
|
]
|
||
|
|
||
|
a_2 = [
|
||
|
Among(u"en", -1, 1),
|
||
|
Among(u"er", -1, 1),
|
||
|
Among(u"st", -1, 2),
|
||
|
Among(u"est", 2, 1)
|
||
|
]
|
||
|
|
||
|
a_3 = [
|
||
|
Among(u"ig", -1, 1),
|
||
|
Among(u"lich", -1, 1)
|
||
|
]
|
||
|
|
||
|
a_4 = [
|
||
|
Among(u"end", -1, 1),
|
||
|
Among(u"ig", -1, 2),
|
||
|
Among(u"ung", -1, 1),
|
||
|
Among(u"lich", -1, 3),
|
||
|
Among(u"isch", -1, 2),
|
||
|
Among(u"ik", -1, 2),
|
||
|
Among(u"heit", -1, 3),
|
||
|
Among(u"keit", -1, 4)
|
||
|
]
|
||
|
|
||
|
g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8]
|
||
|
|
||
|
g_s_ending = [117, 30, 5]
|
||
|
|
||
|
g_st_ending = [117, 30, 4]
|
||
|
|
||
|
I_x = 0
|
||
|
I_p2 = 0
|
||
|
I_p1 = 0
|
||
|
|
||
|
def copy_from(self, other):
|
||
|
self.I_x = other.I_x
|
||
|
self.I_p2 = other.I_p2
|
||
|
self.I_p1 = other.I_p1
|
||
|
super.copy_from(other)
|
||
|
|
||
|
|
||
|
def r_prelude(self):
|
||
|
# (, line 33
|
||
|
# test, line 35
|
||
|
v_1 = self.cursor
|
||
|
# repeat, line 35
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
v_2 = self.cursor
|
||
|
try:
|
||
|
# (, line 35
|
||
|
# or, line 38
|
||
|
try:
|
||
|
v_3 = self.cursor
|
||
|
try:
|
||
|
# (, line 36
|
||
|
# [, line 37
|
||
|
self.bra = self.cursor
|
||
|
# literal, line 37
|
||
|
if not self.eq_s(1, u"\u00DF"):
|
||
|
raise lab4()
|
||
|
# ], line 37
|
||
|
self.ket = self.cursor
|
||
|
# <-, line 37
|
||
|
if not self.slice_from(u"ss"):
|
||
|
return False
|
||
|
raise lab3()
|
||
|
except lab4: pass
|
||
|
self.cursor = v_3
|
||
|
# next, line 38
|
||
|
if self.cursor >= self.limit:
|
||
|
raise lab2()
|
||
|
self.cursor += 1
|
||
|
except lab3: pass
|
||
|
raise lab1()
|
||
|
except lab2: pass
|
||
|
self.cursor = v_2
|
||
|
raise lab0()
|
||
|
except lab1: pass
|
||
|
except lab0: pass
|
||
|
self.cursor = v_1
|
||
|
# repeat, line 41
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
v_4 = self.cursor
|
||
|
try:
|
||
|
# goto, line 41
|
||
|
try:
|
||
|
while True:
|
||
|
v_5 = self.cursor
|
||
|
try:
|
||
|
# (, line 41
|
||
|
if not self.in_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab9()
|
||
|
# [, line 42
|
||
|
self.bra = self.cursor
|
||
|
# or, line 42
|
||
|
try:
|
||
|
v_6 = self.cursor
|
||
|
try:
|
||
|
# (, line 42
|
||
|
# literal, line 42
|
||
|
if not self.eq_s(1, u"u"):
|
||
|
raise lab11()
|
||
|
# ], line 42
|
||
|
self.ket = self.cursor
|
||
|
if not self.in_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab11()
|
||
|
# <-, line 42
|
||
|
if not self.slice_from(u"U"):
|
||
|
return False
|
||
|
raise lab10()
|
||
|
except lab11: pass
|
||
|
self.cursor = v_6
|
||
|
# (, line 43
|
||
|
# literal, line 43
|
||
|
if not self.eq_s(1, u"y"):
|
||
|
raise lab9()
|
||
|
# ], line 43
|
||
|
self.ket = self.cursor
|
||
|
if not self.in_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab9()
|
||
|
# <-, line 43
|
||
|
if not self.slice_from(u"Y"):
|
||
|
return False
|
||
|
except lab10: pass
|
||
|
self.cursor = v_5
|
||
|
raise lab8()
|
||
|
except lab9: pass
|
||
|
self.cursor = v_5
|
||
|
if self.cursor >= self.limit:
|
||
|
raise lab7()
|
||
|
self.cursor += 1
|
||
|
except lab8: pass
|
||
|
raise lab6()
|
||
|
except lab7: pass
|
||
|
self.cursor = v_4
|
||
|
raise lab5()
|
||
|
except lab6: pass
|
||
|
except lab5: pass
|
||
|
return True
|
||
|
|
||
|
def r_mark_regions(self):
|
||
|
# (, line 47
|
||
|
self.I_p1 = self.limit;
|
||
|
self.I_p2 = self.limit;
|
||
|
# test, line 52
|
||
|
v_1 = self.cursor
|
||
|
# (, line 52
|
||
|
# hop, line 52
|
||
|
c = self.cursor + 3
|
||
|
if 0 > c or c > self.limit:
|
||
|
return False
|
||
|
self.cursor = c
|
||
|
# setmark x, line 52
|
||
|
self.I_x = self.cursor
|
||
|
self.cursor = v_1
|
||
|
# gopast, line 54
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
if not self.in_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab1()
|
||
|
raise lab0()
|
||
|
except lab1: pass
|
||
|
if self.cursor >= self.limit:
|
||
|
return False
|
||
|
self.cursor += 1
|
||
|
except lab0: pass
|
||
|
# gopast, line 54
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
if not self.out_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab3()
|
||
|
raise lab2()
|
||
|
except lab3: pass
|
||
|
if self.cursor >= self.limit:
|
||
|
return False
|
||
|
self.cursor += 1
|
||
|
except lab2: pass
|
||
|
# setmark p1, line 54
|
||
|
self.I_p1 = self.cursor
|
||
|
# try, line 55
|
||
|
try:
|
||
|
# (, line 55
|
||
|
if not (self.I_p1 < self.I_x):
|
||
|
raise lab4()
|
||
|
self.I_p1 = self.I_x;
|
||
|
except lab4: pass
|
||
|
# gopast, line 56
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
if not self.in_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab6()
|
||
|
raise lab5()
|
||
|
except lab6: pass
|
||
|
if self.cursor >= self.limit:
|
||
|
return False
|
||
|
self.cursor += 1
|
||
|
except lab5: pass
|
||
|
# gopast, line 56
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
if not self.out_grouping(GermanStemmer.g_v, 97, 252):
|
||
|
raise lab8()
|
||
|
raise lab7()
|
||
|
except lab8: pass
|
||
|
if self.cursor >= self.limit:
|
||
|
return False
|
||
|
self.cursor += 1
|
||
|
except lab7: pass
|
||
|
# setmark p2, line 56
|
||
|
self.I_p2 = self.cursor
|
||
|
return True
|
||
|
|
||
|
def r_postlude(self):
|
||
|
# repeat, line 60
|
||
|
try:
|
||
|
while True:
|
||
|
try:
|
||
|
v_1 = self.cursor
|
||
|
try:
|
||
|
# (, line 60
|
||
|
# [, line 62
|
||
|
self.bra = self.cursor
|
||
|
# substring, line 62
|
||
|
among_var = self.find_among(GermanStemmer.a_0, 6)
|
||
|
if among_var == 0:
|
||
|
raise lab2()
|
||
|
# ], line 62
|
||
|
self.ket = self.cursor
|
||
|
if among_var == 0:
|
||
|
raise lab2()
|
||
|
elif among_var == 1:
|
||
|
# (, line 63
|
||
|
# <-, line 63
|
||
|
if not self.slice_from(u"y"):
|
||
|
return False
|
||
|
elif among_var == 2:
|
||
|
# (, line 64
|
||
|
# <-, line 64
|
||
|
if not self.slice_from(u"u"):
|
||
|
return False
|
||
|
elif among_var == 3:
|
||
|
# (, line 65
|
||
|
# <-, line 65
|
||
|
if not self.slice_from(u"a"):
|
||
|
return False
|
||
|
elif among_var == 4:
|
||
|
# (, line 66
|
||
|
# <-, line 66
|
||
|
if not self.slice_from(u"o"):
|
||
|
return False
|
||
|
elif among_var == 5:
|
||
|
# (, line 67
|
||
|
# <-, line 67
|
||
|
if not self.slice_from(u"u"):
|
||
|
return False
|
||
|
elif among_var == 6:
|
||
|
# (, line 68
|
||
|
# next, line 68
|
||
|
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_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 78
|
||
|
# do, line 79
|
||
|
v_1 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 79
|
||
|
# [, line 80
|
||
|
self.ket = self.cursor
|
||
|
# substring, line 80
|
||
|
among_var = self.find_among_b(GermanStemmer.a_1, 7)
|
||
|
if among_var == 0:
|
||
|
raise lab0()
|
||
|
# ], line 80
|
||
|
self.bra = self.cursor
|
||
|
# call R1, line 80
|
||
|
if not self.r_R1():
|
||
|
raise lab0()
|
||
|
if among_var == 0:
|
||
|
raise lab0()
|
||
|
elif among_var == 1:
|
||
|
# (, line 82
|
||
|
# delete, line 82
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
elif among_var == 2:
|
||
|
# (, line 85
|
||
|
# delete, line 85
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
# try, line 86
|
||
|
v_2 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 86
|
||
|
# [, line 86
|
||
|
self.ket = self.cursor
|
||
|
# literal, line 86
|
||
|
if not self.eq_s_b(1, u"s"):
|
||
|
self.cursor = self.limit - v_2
|
||
|
raise lab1()
|
||
|
# ], line 86
|
||
|
self.bra = self.cursor
|
||
|
# literal, line 86
|
||
|
if not self.eq_s_b(3, u"nis"):
|
||
|
self.cursor = self.limit - v_2
|
||
|
raise lab1()
|
||
|
# delete, line 86
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
except lab1: pass
|
||
|
elif among_var == 3:
|
||
|
# (, line 89
|
||
|
if not self.in_grouping_b(GermanStemmer.g_s_ending, 98, 116):
|
||
|
raise lab0()
|
||
|
# delete, line 89
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
except lab0: pass
|
||
|
self.cursor = self.limit - v_1
|
||
|
# do, line 93
|
||
|
v_3 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 93
|
||
|
# [, line 94
|
||
|
self.ket = self.cursor
|
||
|
# substring, line 94
|
||
|
among_var = self.find_among_b(GermanStemmer.a_2, 4)
|
||
|
if among_var == 0:
|
||
|
raise lab2()
|
||
|
# ], line 94
|
||
|
self.bra = self.cursor
|
||
|
# call R1, line 94
|
||
|
if not self.r_R1():
|
||
|
raise lab2()
|
||
|
if among_var == 0:
|
||
|
raise lab2()
|
||
|
elif among_var == 1:
|
||
|
# (, line 96
|
||
|
# delete, line 96
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
elif among_var == 2:
|
||
|
# (, line 99
|
||
|
if not self.in_grouping_b(GermanStemmer.g_st_ending, 98, 116):
|
||
|
raise lab2()
|
||
|
# hop, line 99
|
||
|
c = self.cursor - 3
|
||
|
if self.limit_backward > c or c > self.limit:
|
||
|
raise lab2()
|
||
|
self.cursor = c
|
||
|
# delete, line 99
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
except lab2: pass
|
||
|
self.cursor = self.limit - v_3
|
||
|
# do, line 103
|
||
|
v_4 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 103
|
||
|
# [, line 104
|
||
|
self.ket = self.cursor
|
||
|
# substring, line 104
|
||
|
among_var = self.find_among_b(GermanStemmer.a_4, 8)
|
||
|
if among_var == 0:
|
||
|
raise lab3()
|
||
|
# ], line 104
|
||
|
self.bra = self.cursor
|
||
|
# call R2, line 104
|
||
|
if not self.r_R2():
|
||
|
raise lab3()
|
||
|
if among_var == 0:
|
||
|
raise lab3()
|
||
|
elif among_var == 1:
|
||
|
# (, line 106
|
||
|
# delete, line 106
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
# try, line 107
|
||
|
v_5 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 107
|
||
|
# [, line 107
|
||
|
self.ket = self.cursor
|
||
|
# literal, line 107
|
||
|
if not self.eq_s_b(2, u"ig"):
|
||
|
self.cursor = self.limit - v_5
|
||
|
raise lab4()
|
||
|
# ], line 107
|
||
|
self.bra = self.cursor
|
||
|
# not, line 107
|
||
|
v_6 = self.limit - self.cursor
|
||
|
try:
|
||
|
# literal, line 107
|
||
|
if not self.eq_s_b(1, u"e"):
|
||
|
raise lab5()
|
||
|
self.cursor = self.limit - v_5
|
||
|
raise lab4()
|
||
|
except lab5: pass
|
||
|
self.cursor = self.limit - v_6
|
||
|
# call R2, line 107
|
||
|
if not self.r_R2():
|
||
|
self.cursor = self.limit - v_5
|
||
|
raise lab4()
|
||
|
# delete, line 107
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
except lab4: pass
|
||
|
elif among_var == 2:
|
||
|
# (, line 110
|
||
|
# not, line 110
|
||
|
v_7 = self.limit - self.cursor
|
||
|
try:
|
||
|
# literal, line 110
|
||
|
if not self.eq_s_b(1, u"e"):
|
||
|
raise lab6()
|
||
|
raise lab3()
|
||
|
except lab6: pass
|
||
|
self.cursor = self.limit - v_7
|
||
|
# delete, line 110
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
elif among_var == 3:
|
||
|
# (, line 113
|
||
|
# delete, line 113
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
# try, line 114
|
||
|
v_8 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 114
|
||
|
# [, line 115
|
||
|
self.ket = self.cursor
|
||
|
# or, line 115
|
||
|
try:
|
||
|
v_9 = self.limit - self.cursor
|
||
|
try:
|
||
|
# literal, line 115
|
||
|
if not self.eq_s_b(2, u"er"):
|
||
|
raise lab9()
|
||
|
raise lab8()
|
||
|
except lab9: pass
|
||
|
self.cursor = self.limit - v_9
|
||
|
# literal, line 115
|
||
|
if not self.eq_s_b(2, u"en"):
|
||
|
self.cursor = self.limit - v_8
|
||
|
raise lab7()
|
||
|
except lab8: pass
|
||
|
# ], line 115
|
||
|
self.bra = self.cursor
|
||
|
# call R1, line 115
|
||
|
if not self.r_R1():
|
||
|
self.cursor = self.limit - v_8
|
||
|
raise lab7()
|
||
|
# delete, line 115
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
except lab7: pass
|
||
|
elif among_var == 4:
|
||
|
# (, line 119
|
||
|
# delete, line 119
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
# try, line 120
|
||
|
v_10 = self.limit - self.cursor
|
||
|
try:
|
||
|
# (, line 120
|
||
|
# [, line 121
|
||
|
self.ket = self.cursor
|
||
|
# substring, line 121
|
||
|
among_var = self.find_among_b(GermanStemmer.a_3, 2)
|
||
|
if among_var == 0:
|
||
|
self.cursor = self.limit - v_10
|
||
|
raise lab10()
|
||
|
# ], line 121
|
||
|
self.bra = self.cursor
|
||
|
# call R2, line 121
|
||
|
if not self.r_R2():
|
||
|
self.cursor = self.limit - v_10
|
||
|
raise lab10()
|
||
|
if among_var == 0:
|
||
|
self.cursor = self.limit - v_10
|
||
|
raise lab10()
|
||
|
elif among_var == 1:
|
||
|
# (, line 123
|
||
|
# delete, line 123
|
||
|
if not self.slice_del():
|
||
|
return False
|
||
|
|
||
|
except lab10: pass
|
||
|
except lab3: pass
|
||
|
self.cursor = self.limit - v_4
|
||
|
return True
|
||
|
|
||
|
def _stem(self):
|
||
|
# (, line 133
|
||
|
# do, line 134
|
||
|
v_1 = self.cursor
|
||
|
try:
|
||
|
# call prelude, line 134
|
||
|
if not self.r_prelude():
|
||
|
raise lab0()
|
||
|
except lab0: pass
|
||
|
self.cursor = v_1
|
||
|
# do, line 135
|
||
|
v_2 = self.cursor
|
||
|
try:
|
||
|
# call mark_regions, line 135
|
||
|
if not self.r_mark_regions():
|
||
|
raise lab1()
|
||
|
except lab1: pass
|
||
|
self.cursor = v_2
|
||
|
# backwards, line 136
|
||
|
self.limit_backward = self.cursor
|
||
|
self.cursor = self.limit
|
||
|
# do, line 137
|
||
|
v_3 = self.limit - self.cursor
|
||
|
try:
|
||
|
# call standard_suffix, line 137
|
||
|
if not self.r_standard_suffix():
|
||
|
raise lab2()
|
||
|
except lab2: pass
|
||
|
self.cursor = self.limit - v_3
|
||
|
self.cursor = self.limit_backward
|
||
|
# do, line 138
|
||
|
v_4 = self.cursor
|
||
|
try:
|
||
|
# call postlude, line 138
|
||
|
if not self.r_postlude():
|
||
|
raise lab3()
|
||
|
except lab3: pass
|
||
|
self.cursor = v_4
|
||
|
return True
|
||
|
|
||
|
def equals(self, o):
|
||
|
return isinstance(o, GermanStemmer)
|
||
|
|
||
|
def hashCode(self):
|
||
|
return hash("GermanStemmer")
|
||
|
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
|