Skip to main content

Glin Profanity - ML-Powered Profanity Detection

GLIN PROFANITY - Python

ML-Powered Profanity Detection for the Modern Web

PyPI MIT Downloads Demo


Installation

pip install glin-profanity

Quick Start

from glin_profanity import Filter

# Basic usage
filter = Filter()

# Quick check
if filter.is_profane("This is a damn example"):
    print("Profanity detected!")

# Detailed results
result = filter.check_profanity("This is a damn example")
print(result["profane_words"])       # ['damn']
print(result["contains_profanity"])  # True

Configuration

from glin_profanity import Filter, SeverityLevel

filter = Filter({
    "languages": ["english", "spanish"],
    "case_sensitive": False,
    "word_boundaries": True,
    "replace_with": "***",
    "severity_levels": True,
    "custom_words": ["badword"],
    "ignore_words": ["exception"],
    "allow_obfuscated_match": True,
    "fuzzy_tolerance_level": 0.8,
})

result = filter.check_profanity("bad content here")

Features

Feature Description
Multi-language 24 languages supported
Context-aware Reduces false positives
Configurable Custom word lists, severity levels
High performance Optimized for speed
TypeScript parity Same API as JS package

API Reference

Filter Class

class Filter:
    def __init__(self, config: Optional[FilterConfig] = None)
    def is_profane(self, text: str) -> bool
    def check_profanity(self, text: str) -> CheckProfanityResult
    def matches(self, word: str) -> bool
    def check_profanity_with_min_severity(self, text: str, min_severity: SeverityLevel) -> dict

Return Type

{
    "contains_profanity": bool,
    "profane_words": List[str],
    "processed_text": Optional[str],      # If replace_with is set
    "severity_map": Optional[Dict],       # If severity_levels is True
    "matches": Optional[List[Match]],
    "context_score": Optional[float],
    "reason": Optional[str]
}

SeverityLevel

SeverityLevel.EXACT  # Exact word match
SeverityLevel.FUZZY  # Fuzzy/approximate match

Supported Languages

24 languages: Arabic, Chinese, Czech, Danish, Dutch, English, Esperanto, Finnish, French, German, Hindi, Hungarian, Italian, Japanese, Korean, Norwegian, Persian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish

Documentation

Resource Link
Getting Started docs/getting-started.md
API Reference docs/api-reference.md
Advanced Features docs/advanced-features.md
Main README README.md

Development

# Clone and setup
git clone https://github.com/GLINCKER/glin-profanity
cd glin-profanity/packages/py
pip install -e ".[dev]"

# Testing
pytest
pytest --cov=glin_profanity

# Code quality
black glin_profanity tests
isort glin_profanity tests
mypy glin_profanity
ruff check glin_profanity tests

Community

Join the GLINR Discord and drop by the #glin-profanity forum for questions and discussion.

Join the GLINR Discord

License

MIT License - see LICENSE


Built by GLINCKER

Metadata

Release files for glin-profanity 4.0.0

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

Source distribution (sdist)

Source distribution for glin-profanity 4.0.0
File Size Uploaded Provenance
glin_profanity-4.0.0.tar.gz 80.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for glin-profanity 4.0.0
File Interpreter ABI Platform
glin_profanity-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 184.7 kB

Release files / glin_profanity-4.0.0.tar.gz

Download URL glin_profanity-4.0.0.tar.gz
Size 80.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4600ec30d0966e9acfe5bd7728246138607eff521214835c6d109898e1af39ec
BLAKE2b-256 checksum
How to use checksums
e4d76719facddbf753466955aed079f1e1759bcab1aacc0d5fd3e8db1484d325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.11.17"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.11.17","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.16.0

Release files / glin_profanity-4.0.0-py3-none-any.whl

Download URL glin_profanity-4.0.0-py3-none-any.whl
Size 104.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c0f2558a8d0f2ced75d64d5129760d581365f4c0544b7e8249d54cee4b5adfb
BLAKE2b-256 checksum
How to use checksums
338f9e2f176fdc19e7fdc195515c687da148adfa912a0b29225c3b5108fa75f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.11.17"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.11.17","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.16.0

Security for glin-profanity 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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