GLIN PROFANITY - Python
ML-Powered Profanity Detection for the Modern Web
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
License
MIT License - see LICENSE
Built by GLINCKER
Metadata
Release files for glin-profanity 3.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| glin_profanity-3.4.0.tar.gz | 61.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glin_profanity-3.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 138.0 kB
Release files / glin_profanity-3.4.0.tar.gz
| Download URL | glin_profanity-3.4.0.tar.gz |
|---|---|
| Size | 61.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7304b82b3c816b6526cc048ae50d8daf39caac5b55c953ee4c360f6f95c5bc4d
|
|
BLAKE2b-256 checksum How to use checksums |
43ecdf1f26ff85af5e5071489cfdc199509998f3b1113873548f5b4ccd0cdb25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.11.15 HTTPX/0.28.1
|
Release files / glin_profanity-3.4.0-py3-none-any.whl
| Download URL | glin_profanity-3.4.0-py3-none-any.whl |
|---|---|
| Size | 76.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4712a211270f4747b9a2888bce71c5fee9e0b818e38877581bf87dc691ff68aa
|
|
BLAKE2b-256 checksum How to use checksums |
19064060c23a4790433a18ef1346c227ed61de0ea82f231436cd1c4d6711700c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.11.15 HTTPX/0.28.1
|