Function: createPrivacyFilter()
createPrivacyFilter<
Label>(config,runtime?):Promise<PrivacyFilter<Label>>
Defined in: extensions/nlp/tasks/privacyFilter.ts:129
Creates a privacy filter runner that detects personally identifiable information (PII) spans in text.
It loads the tokenizer and model, validates the forward signature against
the configured label space, pre-computes the BIOES grammar tables, and
registers clean disposal hooks to clear all native memory.
Works with any privacy-filter-style model exporting
forward(input_ids, attention_mask) -> logits over a BIOES label space.
Inputs longer than the model's exported window are processed in sliding
windows with 50% overlap and never truncated; predictions near a window's
edges are discarded in favor of the neighboring window's more centered
context.
Type Parameters
Label
Label extends string
The model's BIOES label space.
Parameters
config
PrivacyFilterModel<Label>
Privacy filter task configuration containing the model and tokenizer paths plus the label space options. See PrivacyFilterModel.
runtime?
any
Optional worklet runtime thread on which to run the model execution.
Returns
Promise<PrivacyFilter<Label>>
A promise resolving to the instantiated PrivacyFilter runner.
Throws
With code INVALID_ARGUMENT if labelNames is
empty or does not start with 'O', LOAD_FAILED if the model or tokenizer
fails to load, or SCHEMA_MISMATCH if the loaded model schema does not match
the privacy filter specification.