sensitive_rs/
lib.rs

1//! # Sensitive-rs
2//!
3//! `sensitive-rs` is a Rust library for finding, validating, filtering, and replacing sensitive words.
4//! It provides efficient algorithms to handle sensitive words, suitable for various application scenarios.
5//!
6//! ## Features
7//!
8//! - **Multi-algorithm support**: Aho-Corasick, Wu-Manber and Regex
9//! - **Variant detection**: Handle pinyin and shape variants
10//! - **High performance**: Optimized for Chinese text processing
11//!
12//! ## Quick Start
13//!
14//! ```rust
15//! use sensitive_rs::Filter;
16//!
17//! let mut filter = Filter::new();
18//! filter.add_word("赌博");
19//! filter.add_word("色情");
20//!
21//! // Standard matching
22//! assert_eq!(filter.find_in("含有赌博内容"), (true, "赌博".to_string()));
23//!
24//! // Variant detection
25//! assert_eq!(filter.find_in("含有 dubo 内容"), (true, "赌博".to_string()));
26//! ```
27
28mod engine;
29mod filter;
30mod variant;
31
32pub use engine::MultiPatternEngine;
33pub use filter::Filter;
34pub use variant::VariantDetector;
35
36/// Re-export for backward compatibility
37pub use engine::wumanber::WuManber;