revert what I did with the slur regex

master
Aevann1 2022-07-17 21:17:46 +02:00
parent dd8f58ed65
commit 4058e2adce
3 changed files with 15 additions and 13 deletions

View File

@ -119,3 +119,5 @@ elif "load_chat" in argv:
from files.routes.chat import *
else:
from files.routes import *
stdout.flush()

View File

@ -51,6 +51,7 @@ if SITE_NAME == 'rDrama':
"newfag": "newstrag",
"oldfag": "oldstrag",
"faggot": "cute twink",
"fag": "cute twink",
"pedophile": "libertarian",
"kill yourself": "keep yourself safe",
"nigger": "BIPOC",
@ -94,20 +95,16 @@ if SITE_NAME == 'rDrama':
"fake and gay": "fake and straight",
" rapist": " male feminist",
">rapist": ">male feminist",
" kys": " keep yourself safe",
">kys": ">keep yourself safe",
" fag": " cute twink",
">fag": ">cute twink",
" kys ": " keep yourself safe ",
" pedo ": " libertarian ",
" pedos ": " libertarians ",
}
else:
SLURS = {
"faggot": "cute twink",
"nigger": "🏀",
" fag": " cute twink",
">fag": ">cute twink",
"fag": "cute twink",
"nigger": "🏀"
}
single_words = "|".join([slur.lower() for slur in SLURS.keys()])

View File

@ -57,8 +57,8 @@ email_regex = re.compile('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}', flags=re.A|re.
utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A)
utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
slur_regex = re.compile(single_words, flags=re.I|re.A)
slur_regex_upper = re.compile(single_words.upper(), flags=re.A)
slur_regex = re.compile(f"<[^>]*>|{single_words}", flags=re.I|re.A)
slur_regex_upper = re.compile(f"<[^>]*>|{single_words.upper()}", flags=re.A)
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
torture_regex2 = re.compile("(^|\s)i'm ", flags=re.I|re.A)
torture_regex_exclude = re.compile('^\s*>', flags=re.A)
@ -105,6 +105,9 @@ git_regex = re.compile("ref: (refs/.+)", flags=re.A)
pronouns_regex = re.compile("([a-z]{2,5}|i)/[a-z]{2,5}", flags=re.A)
def sub_matcher(match, upper=False):
if match.group(0).startswith('<'):
return match.group(0)
else:
repl = SLURS[match.group(0).lower()]
return repl if not upper else repl.upper()