Skip to main content

Package for checking text for existance of blacklisted or whitelisted words

Project description

checkword

Simple module for check if the text contains blacklisted or whitelisted words

Installation

pip install checkword

Usage

import checkword

# add some bad words to blacklist
checkword.add_bad_words(['some', 'bad', 'words', 'like', 'sheet'])

# and good words
checkword.add_good_words(['Festival', 'Event', 'Holiday'])

print(checkword.blacklisted('My some text to check for bad words'))
# True

print(checkword.whitelisted('Another text to check for good words'))
# False

Methods

add_bad_words(words)

add word or words list/tuple to blacklist

add_good_words(words)

add word or words list/tuple to whitelist

blacklisted(text, match_case=False, words=True)

check if text contains any bad words
text: text for checking
match_case: use case sensitive word matching. if True checkword.blacklisted('bAd') will be False when 'bad' is in blacklist
words: match only complete words. if True checkword.blacklisted('my bad string')=True and checkword.blacklisted('mybadstring')=False while 'bad' is in blacklist

whitelisted(text, match_case=False, words=True)

check if text contains any whitelisted words
text: text for checking
match_case: use case sensitive word matching. if True checkword.whitelisted('gOoD') will be False when 'good' is in blacklist
words: match only complete words. if True checkword.whitelisted('my good string')=True and checkword.whitelisted('mygoodstring')=False while 'good' is in blacklist

remove_bad_word(word)

remove bad word from blacklist

remove_good_word(word)

remove good word from whitelist

clear_blacklist()

remove all bad words from blacklist

clear_whitelist()

remove all good words from whitelist

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

checkword-0.0.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

checkword-0.0.3-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file checkword-0.0.3.tar.gz.

File metadata

  • Download URL: checkword-0.0.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for checkword-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d293198c86df1519252d5ba41a4034cbdc3f0b3327b0c8d46682b26f0d5a8f8b
MD5 dbac7806ec55ad9aefce934ca6bc4fba
BLAKE2b-256 8214a4b8e2352398a9e6c30f70cca66ad28030e8751f3c6ef9103d1328abd4f5

See more details on using hashes here.

File details

Details for the file checkword-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: checkword-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for checkword-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4ce8aacabdac469a20ab6ce867b3f0f97b6c402b5d13cf7da414f98a3c337164
MD5 da7b5a4cdbccce5ccede609013dd1150
BLAKE2b-256 bc0eaa1d1133ecc5a330efd55b17f8acf5020956b1c53f63491fe076fe4a2e76

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