Skip to content

Commit

Permalink
Merge pull request #195 from nhymxu/fix-regex-syntax
Browse files Browse the repository at this point in the history
fix: regex SyntaxWarning invalid escape sequence
  • Loading branch information
coleifer authored Mar 22, 2024
2 parents f4260d4 + 54cc53f commit e7b76f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion walrus/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _load_stopwords(self):
def tokenize_title(self, phrase, stopwords=True):
if isinstance(phrase, bytes):
phrase = decode(phrase)
phrase = re.sub('[^a-z0-9_\-\s]', '', phrase.lower())
phrase = re.sub(r'[^a-z0-9_\-\s]', '', phrase.lower())
if stopwords and self._stopwords:
return [w for w in phrase.split() if w not in self._stopwords]
else:
Expand Down
2 changes: 1 addition & 1 deletion walrus/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, stemmer=True, metaphone=False,
self._use_metaphone = metaphone
self._min_word_length = min_word_length
self._symbols_re = re.compile(
'[\.,;:"\'\\/!@#\$%\?\*\(\)\-=+\[\]\{\}_]')
r'[\.,;:"\'\\/!@#\$%\?\*\(\)\-=+\[\]\{\}_]')

self._stopwords = self._load_stopwords(stopwords_file)

Expand Down

0 comments on commit e7b76f6

Please sign in to comment.