Fix bug that censor was not censoring a slur if it was followed by '.' or ','

This commit is contained in:
Yo Mama 2021-10-20 00:37:23 +02:00
parent 7ece47cba3
commit 6a350e8242
2 changed files with 5 additions and 4 deletions

View file

@ -43,7 +43,7 @@ def create_slur_regex() -> Pattern[str]:
"""Creates the regex that will find the slurs"""
single_words = "|".join([slur.strip().lower() for slur in SLURS.keys()])
return re.compile(rf"(?i)(?<=\s|>)({single_words})(?=\s|<)")
return re.compile(rf"(?i)(?<=\s|>)({single_words})(?=[\s<,.])")
def create_replace_map() -> Dict[str, str]: