How glincker/glin-profanity works
Glin Profanity is an offline-capable content-safety library offered in JavaScript/TypeScript and Python, with MCP and OpenClaw integrations. The main workflow accepts text, normalizes and matches it against multilingual profanity dictionaries, then returns a decision and can redact matches; optional ML, contextual analysis, and specialized scanners broaden coverage to toxicity, PII, secrets, and prompt injection. The graph combines sampled imports and calls with README-documented capabilities; unsampled integration internals are shown only where documented.
Main entry points: Filter.ts Profanity Filter · pii.ts PII Scanner · filter.py Python Filter · server.ts MCP Tools
Components 22
JavaScript Core
- Public API
packages/js/src/index.ts - Check API
packages/js/src/core - Profanity Filter
packages/js/src/filters/Filter.ts - Text Normalization
packages/js/src/filters/normalizeText.ts - Unicode Folding
packages/js/src/utils/unicode.ts - Word Matcher
packages/js/src/filters/wordMatcher.ts - Language Dictionary
packages/js/src/data/dictionary.ts - Context Analysis
packages/js/src/nlp/contextAnalyzer.ts
Python Core
- Python API
packages/py/glin_profanity/__init__.py - Python Filter
packages/py/glin_profanity/filters/filter.py - Language Dictionary
packages/py/glin_profanity/data/dictionary.py - Hybrid ML Filter
packages/py/glin_profanity/ml/hybrid.py
Safety Scanners
- Scanner Framework
packages/js/src/scanners/base.ts - PII Scanner
packages/js/src/scanners/pii.ts - PII Patterns
packages/js/src/scanners/patterns/pii-patterns.ts - Redaction Vault
packages/js/src/scanners/vault.ts - Injection Scanner
packages/js/src/scanners/prompt-injection.ts
App Integrations
- MCP Tools
packages/mcp/src/server.ts - MCP HTTP
packages/mcp/src/http.ts - OpenClaw Plugin
packages/openclaw/src/index.ts - VS Code Extension
packages/vscode-extension/src/extension.ts
Other components
- Application
Connections 21
- Application → Public API: uses API
packages/js/src/index.ts - Application → Python API: uses API
packages/py/glin_profanity/__init__.py - Public API → Check API: exports
packages/js/src/index.ts - Check API → Profanity Filter: pools filter
packages/js/src/core/filterPool.ts - Profanity Filter → Text Normalization: normalizes text
packages/js/src/filters/Filter.ts - Profanity Filter → Unicode Folding: folds Unicode
packages/js/src/filters/Filter.ts - Profanity Filter → Word Matcher: matches words
packages/js/src/filters/Filter.ts - Profanity Filter → Language Dictionary: loads words
packages/js/src/filters/Filter.ts - Profanity Filter → Context Analysis: checks context
packages/js/src/filters/Filter.ts - Python API → Python Filter: exports filter
packages/py/glin_profanity/__init__.py - Python Filter → Language Dictionary: loads words
packages/py/glin_profanity/filters/filter.py - Hybrid ML Filter → Python Filter: combines rules
packages/py/glin_profanity/ml/hybrid.py - PII Scanner → Scanner Framework: implements scanner
packages/js/src/scanners/pii.ts - PII Scanner → PII Patterns: uses patterns
packages/js/src/scanners/pii.ts - PII Scanner → Redaction Vault: redacts via
packages/js/src/scanners/pii.ts - Injection Scanner → Scanner Framework: implements scanner
- MCP Tools → Profanity Filter: checks text
packages/mcp/src/server.ts - MCP HTTP → MCP Tools: serves transport
packages/mcp/src/http.ts - Application → MCP Tools: uses tools
README.md - Application → OpenClaw Plugin: installs plugin
README.md - Application → VS Code Extension: uses extension