
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
no-profanity
Advanced tools
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.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.