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 details)

Uploaded Python 3

File details

Details for the file bdw-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: bdw-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for bdw-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56a6611d0877618ce535cb42f0aa2f25e32f0cce10783712c07d29e8d5047495
MD5 58f8344288c84debc317a08511ea9959
BLAKE2b-256 294ddef3da732f01c3ae51698449b993e0bf6c8222ae7c8a75bf9d1223d697a0

See more details on using hashes here.

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