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.1

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.1
File Size Uploaded Provenance
glin_profanity-4.0.1.tar.gz 85.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 196.4 kB

Release files / glin_profanity-4.0.1.tar.gz

Download URL glin_profanity-4.0.1.tar.gz
Size 85.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a5a050eaa1a443c1155d8d8590e0545bd471cb342036ec0fafdc8f16bb806422
BLAKE2b-256 checksum
How to use checksums
f43296d0f283a6a3453357b44050d472b61382da14153077d12e2de4fe58e822
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.1-py3-none-any.whl

Download URL glin_profanity-4.0.1-py3-none-any.whl
Size 110.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cda6cac21cc01289da7a540a2630c9c4aae5c83ba4196e8d3989c9e9ef14ddf
BLAKE2b-256 checksum
How to use checksums
1e15dedcf6b8ca5bb42eea671f6a2f94fc723f952c588e5b27ceb09632031fae
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.1

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