
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
No-Profanity is a simple library that uses regexes to detect and block profanity in strings. It's designed to detect even the most creative modifications of profanity.
The library contains 1 class. This class contains 5 functions.
from no_profanity import ProfanityFilter
# ProfanityFilter(censor_symbol: str = "*")
filter = ProfanityFilter()
# add_custom_words(words: list) -> None
filter.add_custom_words(["happy", "hello"])
# add_custom_wordlist(filepath: str) -> None
filter.add_custom_wordlist("./wordlist.txt")
# set_censor_symbol(censor_symbol: str) -> None
filter.set_censor_symbol("-")
# is_profanity(txt: str) -> bool
filter.is_profanity("my name is Lime") # False
filter.is_profanity("shut the fuck up") # True
# censor_text(txt: str, censor_symbol: str = None) -> str
filter.censor_text("what the fuck is this") # Output: what the ---- is this
# Without set_censor_symbol(): what the **** is this
# full_detection(txt: str) -> list[dict]
# [
# {
# string_match,
# start,
# end,
# found_word
# }, ...
# ]
filter.full_detection("you fuck1ng bitch") # [{'string_match': 'fuck1ng', 'start': 4, 'end': 11, 'found_word': 'fucking'}, {'string_match': 'bitch', 'start': 12, 'end': 17, 'found_word': 'bitch'}]
The library can detect modified profanity. Examples:
filter.is_profanity("fuckfuck") # True
filter.is_profanity("niggafuck") # True
filter.is_profanity("b i t c h") # True
filter.is_profanity("sexx") # True
filter.is_profanity("n1@@a") # True
filter.is_profanity("f u cckbitch es") # True
filter.is_profanity("@fuck@") # True
The filter can be bypassed by putting an extra letter(s) that isn't part of profanity. This will be fixed in the future! :D
filter.is_profanity("afuck") # False
This library has originally been made for my Discord bot AutoProtection, but now it's released for everyone to use! If you have more questions, please contact me on my Discord server.
Thank you for reading this! I hope you'll like my first library. I'm always opened to new ideas for improvements! ^^
FAQs
A library using regex manipulation to detect and block profanity in strings.
We found that no-profanity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.