
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
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
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.