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 3.4.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 3.4.1
File Size Uploaded Provenance
glin_profanity-3.4.1.tar.gz 80.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 184.7 kB

Release files / glin_profanity-3.4.1.tar.gz

Download URL glin_profanity-3.4.1.tar.gz
Size 80.4 kB
Tags Source
SHA-256 checksum
How to use checksums
da219e6f2d8027977b6903f1239ee7daf5749422b831f0bcba9b3523ef47c9e9
BLAKE2b-256 checksum
How to use checksums
58b91544f220d32bb385b664e0ff67e0d61b7aec454d7d0acbccb30ded0835db
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-3.4.1-py3-none-any.whl

Download URL glin_profanity-3.4.1-py3-none-any.whl
Size 104.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec8bfff5ef93c5ccd05e3a26afaa18a6815fad94db28e04283e9d1b57ea25756
BLAKE2b-256 checksum
How to use checksums
e9a7f7da60c326017675f06ec5acdc4cf28542d834a267301b227ccf73e27677
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 3.4.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