Creates and configures an anonymizer instance for PII detection and replacement.
Signature
function createAnonymizer(config?: AnonymizerConfig): Anonymizer
Parameters
config (optional)
string
default:"'pseudonymize'"
Anonymization mode:
'pseudonymize' — Reversible. Returns an encrypted piiMap for later rehydration.
'anonymize' — Irreversible. No piiMap is returned; PII is permanently removed.
NERConfig
NER model configuration
Show NERConfig properties
string
required
Model mode: 'disabled' | 'quantized' | 'standard' | 'custom'
string
Custom model path (required when mode is 'custom')
string
Custom vocab path (required when mode is 'custom')
boolean
default:"true"
Auto-download model if not present
Record<PIIType, number>
Confidence thresholds per PII type (0.0-1.0)
(status: string) => void
Status message callback
DownloadProgressCallback
Download progress callback
boolean
default:"false"
Enable case-insensitive fallback for detecting lowercase names. Runs a second NER pass on title-cased text and merges new detections. Doubles NER inference time but catches names like "tom" that the case-sensitive model would otherwise miss.
number
default:"0.85"
Confidence penalty multiplier for case-fallback detections (0.0–1.0). Applied as confidence * caseFallbackPenalty. Lower values are stricter.
string
default:"'local'"
Inference backend: 'local' (ONNX on device) or 'inference-server' (remote GPU server)
string
URL of the inference server (required when backend is 'inference-server')