1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! # Sensitive-rs
//!
//! `sensitive-rs` is a Rust library for finding, validating, filtering, and replacing sensitive words.
//! It provides efficient algorithms to handle sensitive words, suitable for various application scenarios.
//!
//! ## Features
//!
//! - **Multi-algorithm support**: Aho-Corasick, Wu-Manber and Regex
//! - **Variant detection**: Handle pinyin and shape variants
//! - **High performance**: Optimized for Chinese text processing
//!
//! ## Quick Start
//!
//! ```rust
//! use sensitive_rs::Filter;
//!
//! let mut filter = Filter::new();
//! filter.add_word("赌博");
//! filter.add_word("色情");
//!
//! // Standard matching
//! assert_eq!(filter.find_in("含有赌博内容"), (true, "赌博".to_string()));
//!
//! // Variant detection
//! assert_eq!(filter.find_in("含有 dubo 内容"), (true, "赌博".to_string()));
//! ```
// On `no_std` some engine/cache/variant surface is exercised only via the `std`
// paths (or tests), so it reads as dead code there. Keep the `std` build fully linted.
extern crate alloc;
pub use MatchAlgorithm;
pub use MultiPatternEngine;
pub use Filter;
pub use Match;
pub use VariantDetector;
/// Re-export for backward compatibility
pub use WuManber;
pub use WasmFilter;