Skip to main content

No project description provided

Project description

Profanex

Profanex is a Python library for detecting and masking profanity in text using a combination of exact and fuzzy matching. It supports customizable banned and excluded word lists, configurable masking styles, and fast performance suitable for processing large volumes of text.

Features

  • Exact and fuzzy profanity detection with adjustable similarity threshold
  • Masking profanity with configurable styles (e.g., stars)
  • Load banned and excluded words from YAML files or directly via Python sets
  • Excludes specific words from masking (e.g., “on”, “no”)
  • Simple API with has_profanity() and clean() methods

Installation

pip install profanex

Usage

from profanex import ProfanityFilter

pf = ProfanityFilter()

text = "You are a b1tch!"
if pf.has_profanity(text):
    clean_text = pf.clean(text)
    print(clean_text)  # Output: You are a *****!

Performance

Profanex can process 10,000 average-length text entries in under 1.5 seconds on modern hardware, making it well-suited for both real-time and batch profanity filtering.

For larger workloads, Profanex supports parallel processing using Python's concurrent.futures module. When executed with ProcessPoolExecutor, Profanex can leverage all available CPU cores to efficiently clean or scan tens of thousands of texts in parallel with minimal overhead.

  • See scripts/benchmark_clean_parallel.py for an Example

Configuration

You can customize the banned and excluded word lists by providing your own YAML files or Python sets during initialization.

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

profanex-0.0.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

profanex-0.0.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file profanex-0.0.2.tar.gz.

File metadata

  • Download URL: profanex-0.0.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for profanex-0.0.2.tar.gz
Algorithm Hash digest
SHA256 de99d2eaf2cf0843c4c06612fbcdab353566d51b3f66de3f76b6d6e3e3511051
MD5 086328aca1a48fad97720ea605b4c5e6
BLAKE2b-256 5e5c8dffe58d92c34f2486a5eefd8801bb230717cdbb10622fa42f22248336e8

See more details on using hashes here.

File details

Details for the file profanex-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: profanex-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for profanex-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d23a1676eeb8c1c0238359ea7417b26be213f3345197b55d88194146fa7e3490
MD5 664255dc2de4d012a52ea384a082cf98
BLAKE2b-256 396625fe9fceec66354a083e94f4be21dfd26ebe3c3997701a8735d147d5d562

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