Skip to main content

Worka PII: Deterministic Redaction for AI Pipelines

A Rust-first PII detection and anonymization library with stable offsets, capability-aware NLP, and audit-friendly outputs designed for CPU-only runtimes.

Why Worka PII?

๐Ÿงญ Deterministic Output

Stable byte offsets and reproducible spans make redaction and audits reliable across runs and environments.

๐Ÿงฉ Modular Pipeline

Regex, validators, dictionaries, and optional NER are composed into a capability-aware pipeline with controlled degradation.

๐Ÿ›ก๏ธ Policy-Driven Redaction

Per-entity operators (redact, mask, replace, hash) with explicit configuration and audit logging.

โš™๏ธ CPU-Only Friendly

Designed to run fast without GPUs, with optional Candle-based NER for higher recall when available.

Quick Start

Detect and anonymize PII in a few lines. See the docs for full configuration.

use pii::anonymize::{AnonymizeConfig, Anonymizer, Operator};
use pii::nlp::SimpleNlpEngine;
use pii::presets::default_recognizers;
use pii::{Analyzer, PolicyConfig};
use pii::types::Language;
use std::collections::HashMap;

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

let text = "Email jane@example.com or call +1 415-555-1212.";
let result = analyzer.analyze(text, &Language::from("en")).unwrap();

let mut config = AnonymizeConfig::default();
let mut per_entity = HashMap::new();
per_entity.insert("Email".to_string(), Operator::Replace { with: "<EMAIL>".into() });
per_entity.insert("Phone".to_string(), Operator::Mask { ch: '*', from_end: 4 });
config.per_entity = per_entity;

let redacted = Anonymizer::anonymize(text, &result.entities, &config).unwrap();
println!("{}", redacted.text);

Fits Into Worka

๐Ÿง 
LLM Safety Layer

Scrub prompts and responses before they reach models.

๐Ÿงพ
Audit-Ready Events

Stable spans and operators allow reproducible auditing.

๐Ÿ”’
Policy Control

Per-entity policies for redaction, masking, or hashing.

Use Cases

๐Ÿ’ฌ
Prompt Sanitization

Remove PII before LLM calls.

๐Ÿงน
Log Redaction

Sanitize logs and traces at the edge.

๐Ÿ“ค
Secure Exports

Ship data with anonymization rules.

๐Ÿง‘โ€๐Ÿ’ผ
Support Workflows

Hide sensitive fields in tickets.

Ready to ship safer AI apps?

Worka PII is open source and designed for production systems that need deterministic redaction, auditability, and performance.