Skip to main content

Curated profanity lists with provenance, categorisation, and simple matching helpers.

Project description

expletives

Curated profanity lists with provenance, classification, and simple matching helpers, merged from 41 public wordlists across 15 languages.

pip install expletives

Usage

>>> import expletives
>>> expletives.is_expletive("fuck")
True
>>> expletives.is_expletive("asian")          # curated false-positive
False
>>> expletives.contains_expletive("hello world")
False
>>> expletives.find_expletives("this shit is fucked")
[Match(word='shit', start=5, end=9), Match(word='fucked', start=13, end=19)]
>>> expletives.censor("oh shit, fuck!")
'oh ****, ****!'
>>> expletives.censor("oh shit", mask="[BEEP]")
'oh [BEEP]'

Rich metadata for every entry:

>>> expletives.catalog["fuck"]["sources"][:3]
['2600-googleblacklist', 'bannedwordlist', 'biglou-bad-words']
>>> expletives.catalog["fuck"]["classification"]
'term'
>>> expletives.explain_okayish("asian")
'nationality / ethnicity / geographic descriptor'

Filter by source or language:

>>> expletives.load(sources=["seven-dirty-words"])
{'cocksucker', 'cunt', 'fuck', 'motherfucker', 'piss', 'shit', 'tits'}
>>> len(expletives.load(language="ja"))
180

Module attributes

name type description
badwords set[str] merged words, wildcards excluded
patterns set[str] wildcard entries (*fuck*, …)
okayish list[str] curated false-positive allow-list
catalog dict[str, dict] full entry metadata (see SOURCES.md)
sources dict[str, dict] per-source metadata
classifications tuple[str, ...] valid classification ids

Functions

function returns
is_expletive(word, allow_okayish=True) bool
contains_expletive(text) bool
find_expletives(text) list[Match]
censor(text, mask="*") str
load(sources=None, language=None, ...) set[str]
describe(word) / classify(word) str | None
explain_okayish(word) str | None

Sources & licensing

See SOURCES.md for every bundled wordlist, its origin, and sources we evaluated but didn't include.

Apache 2.0. The bundled source files retain their upstream licenses as noted in each file's header.

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

expletives-0.1.0.tar.gz (248.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

expletives-0.1.0-py3-none-any.whl (271.7 kB view details)

Uploaded Python 3

File details

Details for the file expletives-0.1.0.tar.gz.

File metadata

  • Download URL: expletives-0.1.0.tar.gz
  • Upload date:
  • Size: 248.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for expletives-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8bc07d6a885f6e349a3b01a674bfcd297c0af157a4c0f5f82aa56929c971401
MD5 5ba230172a7fed06496d74ebec61dfa0
BLAKE2b-256 06232032e01e088eb24ff0b9a0c7718188e396a7c5787b84a73c9debb156b118

See more details on using hashes here.

File details

Details for the file expletives-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: expletives-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 271.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for expletives-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36badf40e1d9896b28c647f4f831483bdb8b1b090a35068c49067793ae3db87e
MD5 a28c1f310d52ccca66b9c0c101d87024
BLAKE2b-256 ee3b9747e438f258c042d9d83fd3ef752828f145c40784ff7e26ad70879cf463

See more details on using hashes here.

Supported by

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