Skip to main content

A universal Python library for detecting and/or filtering profane words.

Project description

profanityfilter

Build Status

A universal Python library for detecting and/or filtering profane words.

PyPI: https://pypi.python.org/pypi/profanityfilter
Doc: https://areebbeigh.github.io/profanityfilter/

Installation

> pip install profanityfilter

Usage

from profanityfilter import ProfanityFilter

pf = ProfanityFilter()

pf.censor("That's bullshit!")
> "That's ********!"
pf.set_censor("@")
pf.censor("That's bullshit!")
> "That's @@@@@@@@!"
pf.define_words(["icecream", "choco"])
pf.censor("I love icecream and choco!")
> "I love ******** and *****"
pf.is_clean("That's awesome!")
> True
pf.is_clean("That's bullshit!")
> False
pf.is_profane("Profane shit is not good")
> True

pf_custom = ProfanityFilter(custom_censor_list=["chocolate", "orange"])
pf_custom.censor("Fuck orange chocolates")
> "Fuck ****** **********"

pf_extended = ProfanityFilter(extra_censor_list=["chocolate", "orange"])
pf_extended.censor("Fuck orange chocolates")
> "**** ****** **********"

Console Executable

profanityfilter -h
> usage: profanityfilter-script.py [-h] [-t TEXT | -f PATH] [-o OUTPUT_FILE]
>                                  [--show]
>
> Profanity filter console utility
>
> optional arguments:
>   -h, --help            show this help message and exit
>   -t TEXT, --text TEXT  Test the given text for profanity
>   -f PATH, --file PATH  Test the given file for profanity
>   -o OUTPUT_FILE, --output OUTPUT_FILE
>                         Write the censored output to a file
>   --show                Print the censored text

Contributing

  • Fork
  • Add changes
  • Add unit tests
  • Make a pull request :)

I encourage you to fork this repo and expand it in anyway you like. Pull requests are welcomed!

Additional Info

Developer: Areeb Beigh areebbeigh@gmail.com
GitHub Repo: https://github.com/areebbeigh/profanityfilter/

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

profanityfilter-2.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

profanityfilter-2.1.0-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file profanityfilter-2.1.0.tar.gz.

File metadata

  • Download URL: profanityfilter-2.1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for profanityfilter-2.1.0.tar.gz
Algorithm Hash digest
SHA256 0ede04e92a9d7255faa52b53776518edc6586dda828aca677c74b5994dfdd9d8
MD5 0bf9e6dc1d1d403d2304696feead57b4
BLAKE2b-256 8d0308740b5e0800f9eb9f675c149a497a3f3735e7b04e414bcce64136e7e487

See more details on using hashes here.

Provenance

The following attestation bundles were made for profanityfilter-2.1.0.tar.gz:

Publisher: publish.yml on areebbeigh/profanityfilter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file profanityfilter-2.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for profanityfilter-2.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e1bc07012760fd74512a335abb93a36877831ed26abab78bfe31bebb68f8c844
MD5 3f97f95f5ff0a6fe056f4387c89ff089
BLAKE2b-256 8803eb18f72dc6e6398e75e3762677f18ab3a773a384b18efd3ed9119844e892

See more details on using hashes here.

Provenance

The following attestation bundles were made for profanityfilter-2.1.0-py2.py3-none-any.whl:

Publisher: publish.yml on areebbeigh/profanityfilter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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