Skip to main content

API Surface

Worka PII exposes a small set of primary types.

Analyzer

Analyzer orchestrates the detection pipeline.

let analyzer = Analyzer::new(
Box::new(SimpleNlpEngine::default()),
default_recognizers(),
Vec::new(),
PolicyConfig::default(),
);

analyze(text, language) returns detections with stable offsets and scores.

NlpEngine

NlpEngine provides tokens, optional lemma/POS, and optional NER spans. The default SimpleNlpEngine is designed for CPU-only use and supports deterministic tokenization.

Recognizers

Recognizer traits are implemented by built-in regex, validator, dictionary, and NER recognizers. Custom recognizers can be added as boxed trait objects.

Anonymizer

Anonymizer::anonymize applies a policy to detected spans and returns redacted text plus audit items.

PolicyConfig

PolicyConfig defines thresholds and overlap rules for the detection pipeline.