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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
glin_profanity-3.4.0.tar.gz
(61.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glin_profanity-3.4.0.tar.gz.
File metadata
- Download URL: glin_profanity-3.4.0.tar.gz
- Upload date:
- Size: 61.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
Hatch/1.16.5 cpython/3.11.15 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7304b82b3c816b6526cc048ae50d8daf39caac5b55c953ee4c360f6f95c5bc4d
|
|
| MD5 |
86104bc69d2c18913ecd417dd38ef51b
|
|
| BLAKE2b-256 |
43ecdf1f26ff85af5e5071489cfdc199509998f3b1113873548f5b4ccd0cdb25
|
File details
Details for the file glin_profanity-3.4.0-py3-none-any.whl.
File metadata
- Download URL: glin_profanity-3.4.0-py3-none-any.whl
- Upload date:
- Size: 76.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
Hatch/1.16.5 cpython/3.11.15 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4712a211270f4747b9a2888bce71c5fee9e0b818e38877581bf87dc691ff68aa
|
|
| MD5 |
25a62d6bc50a705d3fa948e6f0cc1e51
|
|
| BLAKE2b-256 |
19064060c23a4790433a18ef1346c227ed61de0ea82f231436cd1c4d6711700c
|