diff --git a/cool_domain/word_list.py b/cool_domain/word_list.py index 39702b3..9194748 100644 --- a/cool_domain/word_list.py +++ b/cool_domain/word_list.py @@ -1,5 +1,6 @@ import logging import pathlib +import re import typing import unidecode @@ -22,10 +23,7 @@ class WordList: self.logger.info("[%s] Loaded %d words", self.__name, len(self.words)) def __escape_word(self, word: str) -> str: - word = unidecode.unidecode(word.strip()).lower() - if " " in word: - return "" - return word + return re.sub(r"[^a-z0-9-]", "", unidecode.unidecode(word.strip()).lower()) def close(self) -> None: pass