From 12fbe686d5361d9f68cf42bd71f2898276911cd7 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 3 Nov 2022 18:33:56 -0500 Subject: [PATCH] don't use regex in the slur filters for now it doesn't work --- files/helpers/const.py | 40 ++++++++++++++++++++-------------------- files/helpers/regex.py | 7 ++----- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 43cffed20..8bfaf397f 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -103,34 +103,34 @@ SLURS = { } PROFANITIES = { - 'motherfucker': ['motherlover'], + 'motherfucker': 'motherlover', 'fuck': ['frick', 'fudge', 'freak', 'f-word', 'f-bomb', 'cuss'], 'asshole': ['butthole', 'ahole'], 'arsehole': ['butthole', 'ahole'], - '(ass)\W': ['butt', 'backside', 'rear end', 'bum', 'tochus'], + 'ass ': ['butt ', 'backside ', 'rear end ', 'bum ', 'tochus '], + 'arse ': ['butt ', 'backside ', 'rear end ', 'bum ', 'tochus '], 'shit': ['poop', 'poop', 'crap', 'puckey'], - 'lmao': ['lmbo'], + 'lmao': 'lmbo', 'damn': ['dang', 'darn'], 'bastard': ['fatherless child'], - 'piss': ['pee'], + 'piss': 'pee', 'bitch': ['b-word', 'mean lady'], - 'dick': ['weiner'], - 'cock': ['weiner'], - 'penis': ['peepee'], - 'pussy': ['girl weiner'], - 'vagina': ['girl peepee'], - 'cunt': ['rude lady'], + 'dick': 'weiner', + 'cock': 'weiner', + 'penis': 'peepee', + 'pussy': 'girl weiner', + 'vagina': 'girl peepee', + 'cunt': 'rude lady', 'hell': ['heck', 'h-e-double-hockey-sticks'], - 'sexual intercourse': ['sexual congress'], - '(sex)\W': ['intercourse'], - '(arse)\W': ['butt', 'backside', 'rear end', 'bum', 'tochus'], - 'god': ['gosh'], - 'wanker': ['rude masturbator'], - 'twat': ['girl weiner'], - 'cum': ['c*m'], - 'orgasm': ['sexual climax'], - 'toilet': ['potty'], - 'rape': ['r*pe'], + 'sex ': 'intercourse ', + 'sexual intercourse': 'sexual congress', + 'god': 'gosh', + 'wanker': 'rude masturbator', + 'twat': 'girl weiner', + 'cum': 'c*m', + 'orgasm': 'sexual climax', + 'toilet': 'potty', + 'rape': 'r*pe', } if SITE_NAME == 'rDrama': diff --git a/files/helpers/regex.py b/files/helpers/regex.py index ebb9b7b0a..2bc556660 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -116,13 +116,10 @@ pronouns_regex = re.compile("([a-z]{1,5})/[a-z]{1,5}(/[a-z]{1,5})?", flags=re.A| knowledgebase_page_regex = re.compile("[a-zA-Z0-9_\-]+", flags=re.A) def sub_matcher(match:re.Match, upper=False, replace_with:Union[dict[str, str], dict[str, List[str]]]=SLURS): - group_num = 0 if len(match.groups()) == 0 else 1 + group_num = 0 match_str = match.group(group_num) - if match_str is None: return "" - if group_num == 1: - match_str = match_str.replace('\\W', '') if match_str.startswith('<'): - return match.group(group_num) + return match_str else: repl = replace_with[match_str.lower()] if not isinstance(repl, str):