revert what I did with the slur regex
parent
dd8f58ed65
commit
4058e2adce
|
@ -119,3 +119,5 @@ elif "load_chat" in argv:
|
||||||
from files.routes.chat import *
|
from files.routes.chat import *
|
||||||
else:
|
else:
|
||||||
from files.routes import *
|
from files.routes import *
|
||||||
|
|
||||||
|
stdout.flush()
|
|
@ -51,6 +51,7 @@ if SITE_NAME == 'rDrama':
|
||||||
"newfag": "newstrag",
|
"newfag": "newstrag",
|
||||||
"oldfag": "oldstrag",
|
"oldfag": "oldstrag",
|
||||||
"faggot": "cute twink",
|
"faggot": "cute twink",
|
||||||
|
"fag": "cute twink",
|
||||||
"pedophile": "libertarian",
|
"pedophile": "libertarian",
|
||||||
"kill yourself": "keep yourself safe",
|
"kill yourself": "keep yourself safe",
|
||||||
"nigger": "BIPOC",
|
"nigger": "BIPOC",
|
||||||
|
@ -94,20 +95,16 @@ if SITE_NAME == 'rDrama':
|
||||||
"fake and gay": "fake and straight",
|
"fake and gay": "fake and straight",
|
||||||
|
|
||||||
" rapist": " male feminist",
|
" rapist": " male feminist",
|
||||||
">rapist": ">male feminist",
|
|
||||||
|
|
||||||
" kys": " keep yourself safe",
|
" kys ": " keep yourself safe ",
|
||||||
">kys": ">keep yourself safe",
|
" pedo ": " libertarian ",
|
||||||
|
" pedos ": " libertarians ",
|
||||||
" fag": " cute twink",
|
|
||||||
">fag": ">cute twink",
|
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
SLURS = {
|
SLURS = {
|
||||||
"faggot": "cute twink",
|
"faggot": "cute twink",
|
||||||
"nigger": "🏀",
|
"fag": "cute twink",
|
||||||
" fag": " cute twink",
|
"nigger": "🏀"
|
||||||
">fag": ">cute twink",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
|
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
|
||||||
|
|
|
@ -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_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)
|
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 = re.compile(f"<[^>]*>|{single_words}", flags=re.I|re.A)
|
||||||
slur_regex_upper = re.compile(single_words.upper(), flags=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_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
||||||
torture_regex2 = re.compile("(^|\s)i'm ", 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)
|
torture_regex_exclude = re.compile('^\s*>', flags=re.A)
|
||||||
|
@ -105,8 +105,11 @@ 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)
|
pronouns_regex = re.compile("([a-z]{2,5}|i)/[a-z]{2,5}", flags=re.A)
|
||||||
|
|
||||||
def sub_matcher(match, upper=False):
|
def sub_matcher(match, upper=False):
|
||||||
repl = SLURS[match.group(0).lower()]
|
if match.group(0).startswith('<'):
|
||||||
return repl if not upper else repl.upper()
|
return match.group(0)
|
||||||
|
else:
|
||||||
|
repl = SLURS[match.group(0).lower()]
|
||||||
|
return repl if not upper else repl.upper()
|
||||||
|
|
||||||
def sub_matcher_upper(match):
|
def sub_matcher_upper(match):
|
||||||
return sub_matcher(match, upper=True)
|
return sub_matcher(match, upper=True)
|
||||||
|
|
Loading…
Reference in New Issue