Skip to content

Commit

Permalink
implement removel of whitelsited items from text
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeknnDestroy committed Jan 8, 2024
1 parent 5eb8485 commit fcb242e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions safetext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ def _find_profanities(self, text: str) -> List[Dict]:
"""
profanity_infos = []
lower_text = text.lower()

# Remove whitelisted words and phrases from the text
for white_item in self._whitelist:
lower_text = lower_text.replace(white_item.lower(), '')

words = re.findall(r'\b\w+\b', lower_text)

for profanity in self._profanity_words:
Expand Down

0 comments on commit fcb242e

Please sign in to comment.