sensitive-word is a Java DFA-based library to detect, replace, or tag sensitive terms with large dictionaries, format normalization, and custom whitelists.
Overview
sensitive-word implements sensitive term detection for Java using a DFA algorithm. A large bundled dictionary is maintained, and documented benchmarks cite high query throughput.
SensitiveWordHelper exposes fluent APIs to test containment, list matches, replace text with custom strategies, and read word tags. Built-in checks extend to emails, numbers, URLs, and IPv4 patterns alongside word matching.
Format handlers cover full-width and half-width conversion, traditional and simplified Chinese, case changes, and repeated-word skipping. Users can add deny and allow lists with dynamic updates.
A separate sensitive-word-admin console is mentioned as an early MVP companion. The core ships via Maven for JDK 8+ projects.
Key features
- DFA sensitive word matching
- Replace and desensitize APIs
- Tag classification support
- Custom blacklist and whitelist
- Format normalization helpers
- Dynamic dictionary updates
Use cases
- Comment moderation filters
- Chat content screening
- Search query sanitization
- Compliance text redaction