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