Merge pull request #3446 from jepler/python35-compression-fix
makeqstrdata: Work around python3.5/3.6 compatibility problem
This commit is contained in:
commit
df067b498d
@ -109,7 +109,11 @@ class TextSplitter:
|
||||
def __init__(self, words):
|
||||
words.sort(key=lambda x: len(x), reverse=True)
|
||||
self.words = set(words)
|
||||
self.pat = re.compile("|".join(re.escape(w) for w in words) + "|.", flags=re.DOTALL)
|
||||
if words:
|
||||
pat = "|".join(re.escape(w) for w in words) + "|."
|
||||
else:
|
||||
pat = "."
|
||||
self.pat = re.compile(pat, flags=re.DOTALL)
|
||||
|
||||
def iter_words(self, text):
|
||||
s = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user