Skip to main content

Python profanity filter

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dictionary-profanity-filter-1.0.4.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

dictionary_profanity_filter-1.0.4-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page