Skip to content

ProgrammingLanguageLeader/dictionary-profanity-filter

Repository files navigation

Dictionary Profanity Filter

Build Status PyPI version

Python module for profanity filtering using dictionaries. It supports English and Russian languages out-of-the-box.

Requirements

  • Python 3.5 or higher

How to install

Use the following command to install the package using pip:

pip install dictionary-profanity-filter

How to use

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!'

TODO

  • Write documentation
  • Write tests

About

Python module for profanity detection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published