This commit is contained in:
Aevann1 2022-02-24 10:28:13 +02:00
parent f788a84093
commit e324257dce
61 changed files with 106 additions and 112 deletions

View file

@ -106,8 +106,8 @@ SLURS = {
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
SLUR_REGEX = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", re.I|re.A)
SLUR_REGEX_UPPER = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", re.A)
SLUR_REGEX = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", flags=re.I|re.A)
SLUR_REGEX_UPPER = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", flags=re.A)
def sub_matcher(match):
return SLURS[match.group(0).lower()]
@ -125,8 +125,8 @@ def torture_ap(body, username):
body = SLUR_REGEX_UPPER.sub(sub_matcher_upper, body)
body = SLUR_REGEX.sub(sub_matcher, body)
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = re.sub('(^|\s|\n)(i|me) ', rf'\1@{username} ', body, re.I|re.A)
body = re.sub("(^|\s|\n)i'm ", rf'\1@{username} is ', body, re.I|re.A)
body = re.sub('(^|\s|\n)(i|me) ', rf'\1@{username} ', body, flags=re.I|re.A)
body = re.sub("(^|\s|\n)i'm ", rf'\1@{username} is ', body, flags=re.I|re.A)
return body