summaryrefslogtreecommitdiff
path: root/profanity_filter.py
diff options
context:
space:
mode:
authorScott <[email protected]>2022-01-07 11:14:29 -0800
committerScott <[email protected]>2022-01-07 11:14:29 -0800
commite8671a716da868332d3ac1f66d4d2f7f8d33fc28 (patch)
treeb62a841528cfc3bc64963666143083fcdac7c975 /profanity_filter.py
parent5f75cf834725ac26b289cc5f157af0cb71cd5f0e (diff)
Make logging optionally remove global handlers added by (shitty) pip
modules. Make config optionally halt on unrecognized arguments. Make profanity filter smarter.
Diffstat (limited to 'profanity_filter.py')
-rwxr-xr-xprofanity_filter.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/profanity_filter.py b/profanity_filter.py
index 5621cef..fe54221 100755
--- a/profanity_filter.py
+++ b/profanity_filter.py
@@ -347,6 +347,7 @@ class ProfanityFilter(object):
'poop chute',
'poopchute',
'porn',
+ 'pron',
'pornhub',
'porno',
'pornographi',
@@ -471,6 +472,11 @@ class ProfanityFilter(object):
def _normalize(self, text: str) -> str:
result = text.lower()
result = result.replace("_", " ")
+ result = result.replace('0', 'o')
+ result = result.replace('1', 'l')
+ result = result.replace('4', 'a')
+ result = result.replace('5', 's')
+ result = result.replace('3', 'e')
for x in string.punctuation:
result = result.replace(x, "")
chunks = [