Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def equals(self, o):
return isinstance(o, PorterStemmer)
def r_Step_1b(self):
# (, line 33
# [, line 34
self.ket = self.cursor
# substring, line 34
among_var = self.find_among_b(PorterStemmer.a_2, 3)
if among_var == 0:
return False
# ], line 34
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 35
# call R1, line 35
if not self.r_R1():
return False
# <-, line 35
if not self.slice_from(u"ee"):
return False
elif among_var == 2:
# (, line 37
def r_Step_4(self):
# (, line 91
# [, line 92
self.ket = self.cursor
# substring, line 92
among_var = self.find_among_b(PorterStemmer.a_5, 19)
if among_var == 0:
return False
# ], line 92
self.bra = self.cursor
# call R2, line 92
if not self.r_R2():
return False
if among_var == 0:
return False
elif among_var == 1:
# (, line 95
# delete, line 95
if not self.slice_del():
return False
elif among_var == 2:
def r_shortv(self):
# (, line 19
if not self.out_grouping_b(PorterStemmer.g_v_WXY, 89, 121):
return False
if not self.in_grouping_b(PorterStemmer.g_v, 97, 121):
return False
if not self.out_grouping_b(PorterStemmer.g_v, 97, 121):
return False
return True
raise lab1()
raise lab0()
except lab1: pass
if self.cursor <= self.limit_backward:
return False
self.cursor -= 1
except lab0: pass
self.cursor = self.limit - v_1
# delete, line 38
if not self.slice_del():
return False
# test, line 39
v_3 = self.limit - self.cursor
# substring, line 39
among_var = self.find_among_b(PorterStemmer.a_1, 13)
if among_var == 0:
return False
self.cursor = self.limit - v_3
if among_var == 0:
return False
elif among_var == 1:
# (, line 41
# <+, line 41
c = self.cursor
self.insert(self.cursor, self.cursor, u"e")
self.cursor = c
elif among_var == 2:
# (, line 44
# [, line 44
self.ket = self.cursor
# next, line 44
def r_Step_3(self):
# (, line 81
# [, line 82
self.ket = self.cursor
# substring, line 82
among_var = self.find_among_b(PorterStemmer.a_4, 7)
if among_var == 0:
return False
# ], line 82
self.bra = self.cursor
# call R1, line 82
if not self.r_R1():
return False
if among_var == 0:
return False
elif among_var == 1:
# (, line 83
# <-, line 83
if not self.slice_from(u"al"):
return False
elif among_var == 2:
# (, line 85
from .russian_stemmer import RussianStemmer
from .spanish_stemmer import SpanishStemmer
from .swedish_stemmer import SwedishStemmer
from .turkish_stemmer import TurkishStemmer
_languages = {
'danish': DanishStemmer,
'dutch': DutchStemmer,
'english': EnglishStemmer,
'finnish': FinnishStemmer,
'french': FrenchStemmer,
'german': GermanStemmer,
'hungarian': HungarianStemmer,
'italian': ItalianStemmer,
'norwegian': NorwegianStemmer,
'porter': PorterStemmer,
'portuguese': PortugueseStemmer,
'romanian': RomanianStemmer,
'russian': RussianStemmer,
'spanish': SpanishStemmer,
'swedish': SwedishStemmer,
'turkish': TurkishStemmer,
}
try:
import Stemmer
cext_available = True
except ImportError:
cext_available = False
def algorithms():
if cext_available:
def r_Step_1a(self):
# (, line 24
# [, line 25
self.ket = self.cursor
# substring, line 25
among_var = self.find_among_b(PorterStemmer.a_0, 4)
if among_var == 0:
return False
# ], line 25
self.bra = self.cursor
if among_var == 0:
return False
elif among_var == 1:
# (, line 26
# <-, line 26
if not self.slice_from(u"ss"):
return False
elif among_var == 2:
# (, line 27
# <-, line 27
if not self.slice_from(u"i"):
return False
def r_shortv(self):
# (, line 19
if not self.out_grouping_b(PorterStemmer.g_v_WXY, 89, 121):
return False
if not self.in_grouping_b(PorterStemmer.g_v, 97, 121):
return False
if not self.out_grouping_b(PorterStemmer.g_v, 97, 121):
return False
return True
def r_Step_2(self):
# (, line 57
# [, line 58
self.ket = self.cursor
# substring, line 58
among_var = self.find_among_b(PorterStemmer.a_3, 20)
if among_var == 0:
return False
# ], line 58
self.bra = self.cursor
# call R1, line 58
if not self.r_R1():
return False
if among_var == 0:
return False
elif among_var == 1:
# (, line 59
# <-, line 59
if not self.slice_from(u"tion"):
return False
elif among_var == 2:
# (, line 60