Skip to main content

LeoProfanity

Travis PyPI version fury.io PyPI license PyPI pyversions

Python version of leo-profanity, "Shutterstock" dictionary based filter.

Installation

pip install leoprofanity

# or
git clone https://github.com/jojoee/leo-profanity-python
cd leo-profanity-python
python setup.py install

Usage

CLI

python -m leoprofanity "I have boob"

Python

from leoprofanity import LeoProfanity

# example usage
fil = LeoProfanity()
fil.check("I have BoOb, etc.") # True
fil.clean("I have BoOb, etc.") # 'I have ****, etc.'

# return all profanity words (List[str])
fil.list()

# remove word form the list
fil.remove_word("boob")

# check whether the string contains profanity word or not
fil.check("Buy classic watches online") # False
fil.check("I have BoOb.") # True

# clean or replace profanity word in a string
fil.clean("I have boob, etc.") # "I have ****"
fil.clean("I have boob,boob, ass, and etc.") # "I have ****,****, ***, and etc."
fil.clean("I have boob", "+") # "I have ++++"
fil.clean("Buy classic watches online") # "Buy classic watches online"

# add new word(s)
fil.add("b00b")
fil.add(["b@@b", "b##b"])

# remove word(s) from the list
fil.remove("boob")
fil.remove(["boob", "boobs"])

# reset word list by using en dictionary
fil.reset()

# remove all words inside an existing list
fil.clear_list()

# return word list from dictionary
fil.get_dictionary() # returns "en" word list
fil.get_dictionary("en")

# reset word list by using en dictionary
fil.load_dictionary()
fil.load_dictionary("en")

Contribution

# env
conda env list
conda create --name leoprofanity python=3.7

# test
python -m unittest tests/*.py # run unit test

# format
flake8 --max-line-length=120 --exclude=__*.py
black . --check
pytype ./leoprofanity

# publishing
pip install twine # package for publishing
python setup.py sdist bdist_wheel # build the package
tar tzf dist/leoprofanity-0.0.1.tar.gz # check published file in the published package
twine check dist/* # if the package render correctly
python -m pip install dist/leoprofanity-0.0.1-py3-none-any.whl # for testing, install local to global
python -m leoprofanity "I have boob, etc." # testing the package via cli
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose # publishing (test)
twine upload dist/* # publishing
pip install leoprofanity -U # force update module to test after publishing

Release files for leoprofanity 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leoprofanity 0.0.4
File Size Uploaded
leoprofanity-0.0.4.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for leoprofanity 0.0.4
File Interpreter ABI Platform
leoprofanity-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / leoprofanity-0.0.4.tar.gz

Download URL leoprofanity-0.0.4.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
98a34ac88d2445043705d4c0ce81d6f303abdda7e1309619b591744f48e14077
BLAKE2b-256 checksum
How to use checksums
9003cc3cc655e6d3daf21ab4476c5ab18a6fab5c27adf55e656e6168408075f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / leoprofanity-0.0.4-py3-none-any.whl

Download URL leoprofanity-0.0.4-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96267bdb4d69d302ff00305b4cc51a2b598015143bee59b5d6da48e72167ea6e
BLAKE2b-256 checksum
How to use checksums
82e4b4fd4dce56d45916f88d7e56d2eadb67235331352e59e612e0375724d62d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page