Sensitive-rs
English | 简体中文
A high-performance Rust crate for multi-pattern string matching, validation, filtering, and replacement.
Features
- Find all sensitive words:
find_all
- Validate text contains sensitive words:
validate
- Remove sensitive words:
filter
- Replace sensitive words with a character:
replace
- Multi-algorithm engine: Aho-Corasick, Wu-Manber, Regex
- Noise removal via configurable regex
- Variant detection (拼音、形似字)
- Parallel search with
rayon
- LRU cache for hot queries
- Batch processing:
find_all_batch
- Layered matching:
find_all_layered
- Streaming processing:
find_all_streaming
Installation
Add to your Cargo.toml
:
[]
= "0.5.0"
Quick Start
use Filter;
Advanced Usage
Batch processing:
let texts = vec!;
let results = filter.find_all_batch;
Layered matching:
let layered = filter.find_all_layered;
Streaming large files:
use File;
use BufReader;
let reader = new;
let stream_results = filter.find_all_streaming ?;
Documentation
For detailed documentation, please refer to Documentation.
License
Licensed under either of
- Apache License, Version 2.0, LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0
- MIT license LICENSE-MIT or http://opensource.org/licenses/MIT
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 or MIT license, shall be dual licensed as above, without any additional terms or conditions.