[Chennaipy] Chennaipy - Monday Module - 06 Mar 2023
selvi dct
selvi.dct at gmail.com
Mon Mar 6 12:38:29 EST 2023
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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/chennaipy/attachments/20230306/cae3887d/attachment.html>
More information about the Chennaipy
mailing list