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.1.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.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for profanex-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ef6177ce2b5a37a045ac5bc632957b11214ff9ff40e8024409c87ae2e4685710
MD5 be437fa100b18741d3fdba110797de47
BLAKE2b-256 08abe47a8f8e9628693c415dadcea77006f235212038ef332563f92bd2ac9ae5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for profanex-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61612e77e2cdee8154cd620337633ac028533f8f57d237991b2c04e4206d2617
MD5 f192e1e418886eee35e9a23dd625b1d2
BLAKE2b-256 9c5b515b30f67242c516fab87f2e6a65b57901e21532219d7d6b46a8db1acbb7

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