Used isort to sort imports. Also added to the git pre-commit hook.
[python_utils.git] / profanity_filter.py
index 95540fa7b36f0bd8fcf813196e2f9f2390569fce..e227165ba19a2b258847a9e8b86f9adc87de8fb5 100755 (executable)
@@ -12,7 +12,6 @@ from nltk.stem import PorterStemmer
 import decorator_utils
 import string_utils
 
-
 logger = logging.getLogger(__name__)
 
 
@@ -494,14 +493,12 @@ class ProfanityFilter(object):
         result = result.replace('3', 'e')
         for x in string.punctuation:
             result = result.replace(x, "")
-        chunks = [
-            self.stemmer.stem(word) for word in nltk.word_tokenize(result)
-        ]
+        chunks = [self.stemmer.stem(word) for word in nltk.word_tokenize(result)]
         return ' '.join(chunks)
 
     def tokenize(self, text: str):
         for x in nltk.word_tokenize(text):
-            for y in re.split('\W+', x):
+            for y in re.split(r'\W+', x):
                 yield y
 
     def contains_bad_word(self, text: str) -> bool: