redact_ner/lib.rs
1// Copyright (c) 2026 Censgate LLC.
2// Licensed under the Business Source License 1.1 (BUSL-1.1).
3// See the LICENSE file in the project root for license details,
4// including the Additional Use Grant, Change Date, and Change License.
5
6//! NER-based PII Recognition using ONNX Runtime
7//!
8//! This crate provides Named Entity Recognition (NER) capabilities for PII detection
9//! using quantized ONNX models for efficient inference.
10//!
11//! # Features
12//!
13//! - ONNX Runtime integration for model inference
14//! - Support for quantized int8 models
15//! - Token-based NER with entity span detection
16//! - Compatible with various NER model architectures (BERT, RoBERTa, etc.)
17//!
18//! # Example
19//!
20//! ```no_run
21//! use redact_ner::NerRecognizer;
22//! use redact_core::recognizers::Recognizer;
23//!
24//! // Load model
25//! let recognizer = NerRecognizer::from_file("model.onnx").unwrap();
26//!
27//! // Analyze text
28//! let text = "John Doe works at Acme Corp in New York";
29//! let results = recognizer.analyze(text, "en").unwrap();
30//!
31//! for result in results {
32//! println!("{:?}: {}", result.entity_type, result.text.unwrap());
33//! }
34//! ```
35
36mod recognizer;
37mod tokenizer_wrapper;
38
39pub use recognizer::{NerConfig, NerRecognizer};
40
41#[cfg(test)]
42mod tests {
43 // All tests are in the submodules (recognizer and tokenizer_wrapper)
44}