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
Community
Join the GLINR Discord and drop by the #glin-profanity forum for questions and discussion.
License
MIT License - see LICENSE
Metadata
Release files for glin-profanity 4.1.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 | Provenance | |
|---|---|---|---|---|
| glin_profanity-4.1.0.tar.gz | 85.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glin_profanity-4.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 196.4 kB
Release files / glin_profanity-4.1.0.tar.gz
| Download URL | glin_profanity-4.1.0.tar.gz |
|---|---|
| Size | 85.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d87c61f51692776f262d36224dcfe194230a6c95edb8c9b262c3f23ecaaec14d
|
|
BLAKE2b-256 checksum How to use checksums |
114e473f7e42ee61aecde44864937c91dc7cef4c488a08b84a38a8023b348ae6
|
| 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.1.0-py3-none-any.whl
| Download URL | glin_profanity-4.1.0-py3-none-any.whl |
|---|---|
| Size | 110.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efdf834c0c29e9473033d497f4cbff5f414d8fe30aa04b1b9322639739889d0d
|
|
BLAKE2b-256 checksum How to use checksums |
9c7771defd58b50d88e612d6511d418ca876c5d24fc718a692ac224271885cf4
|
| 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.1.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.