Python module for profanity filtering using dictionaries. It supports English and Russian languages out-of-the-box.
- Python 3.5 or higher
Use the following command to install the package using pip:
pip install dictionary-profanity-filter
Here are several examples of the module usage:
- Creating ProfanityFilter instance:
from dictionary_profanity_filter import ProfanityFilter
profanity_filter = ProfanityFilter()
- Adding custom words to censor:
profanity_filter.add_words(['censorship', 'blocking'])
profanity_filter.censor('I hate censorship and blocking!')
# Output: 'I hate ********** and ********!'
- Detect bad words in the text:
profanity_filter.is_clean('Porn is a restricted word')
# Output: False
- Removing word from custom dictionary:
profanity_filter.remove_word('blocking')
profanity_filter.censor('I hate censorship and blocking!')
# Output: 'I hate ********** and blocking!'
- Write documentation
- Write tests