Skip to main content

This library is needed to check text for bad words in different languages.

Project description

bdw (Bad Word Filter)

bdw (Bad Word Filter) is a Python library designed to filter text and detect obscene words in several languages (en, pl, de, ru, ua). It allows you to determine whether the text contains obscene words depending on the selected language or in several languages at the same time.

Installation

You can install bdw using pip:

pip install git+https://github.com/FlacSy/bdw.git

Examples

Example of using bdw (Like check example):

from bdw.check import Check

# Use only Russian language
filter_ru = Check(languages=['ru'])

# Use all available languages
filter_all = Check(all=True)

# Use multiple languages
filter_multiple_languages = Check(languages=['ru', 'en', 'de'])

# Checking the text for obscene words in a specific language
text = input('Word check: ')
if filter_ru.filter_profanity(text, language='ru'):
     print("The text contains obscene words in Russian")

# Checking text for obscene words in all languages
if filter_all.filter_profanity(text):
     print("The text contains obscene words in one of the available languages")

Example of using bdw - delete:

from bdw.delete import Delete

filter = Delete(languages=['ru']) # Specify supported languages
text = input('Word check: ')
filtered_text = filter.filter_profanity(text, language='ru')
print(filtered_text)

Example of using bdw - replace:

from bdw.replace import Replace

filter = Replace()
text = input('Word check: ')
filtered_text = filter.filter_profanity(text, language='ru', replacement_text='***')
print(filtered_text)

Example of using bdw - loader:

from bdw.loader import WordsLoader

loader = WordsLoader()
loader.load_file('you_dir/file_name.txt')

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Links

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bdw-1.1.1-py3-none-any.whl (12.9 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