Date: 06 Mar 2023

Module : better-profanity


Installation : pip install better-profanity


About:

A module that you can use to rid your text of bad words.


Sample:

from better_profanity import profanity


custom_badwords = ['happy', 'jolly', 'merry']

profanity.add_censor_words(custom_badwords)


text = "This is sHit."

censored_text = profanity.censor(text)

print(censored_text) ## print censored string


text = "Have a merry day! :)"

print(profanity.contains_profanity(text)) ## verifies if string contains
bad words

censored_text = profanity.censor(text)

print(censored_text)


Output:

This is ****.

True

Have a **** day! :)


Reference:

https://pypi.org/project/better-profanity/
_______________________________________________
Chennaipy mailing list
Chennaipy@python.org
https://mail.python.org/mailman/listinfo/chennaipy

Reply via email to