logger = logging.getLogger(__name__)
@decorator_utils.singleton
class ProfanityFilter(object):
def __init__(self):
logger = logging.getLogger(__name__)
@decorator_utils.singleton
class ProfanityFilter(object):
def __init__(self):
self.stemmer = PorterStemmer()
def _normalize(self, text: str) -> str:
self.stemmer = PorterStemmer()
def _normalize(self, text: str) -> str:
result = result.replace('3', 'e')
for x in string.punctuation:
result = result.replace(x, "")
result = result.replace('3', 'e')
for x in string.punctuation:
result = result.replace(x, "")
return ' '.join(chunks)
def tokenize(self, text: str):
for x in nltk.word_tokenize(text):
return ' '.join(chunks)
def tokenize(self, text: str):
for x in nltk.word_tokenize(text):
def obscure_bad_words(self, text: str) -> str:
"""Obscure bad words that are detected by inserting random punctuation
characters.
"""
def obscure_bad_words(self, text: str) -> str:
"""Obscure bad words that are detected by inserting random punctuation
characters.
"""