Skip to main content
Version: 0.10.0

Function: usePrivacyFilter()

usePrivacyFilter<Label>(config, options?): object

Defined in: hooks/usePrivacyFilter.ts:27

React hook to load and run a privacy filter (PII detection) model.

This hook manages downloading (if remote URLs are provided) and loading the model assets and tokenizer files, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.

For imperative usage, see createPrivacyFilter.

Type Parameters

Label

Label extends string

The model's BIOES label space, narrowing the detected entity types when a concrete models registry entry is passed.

Parameters

config

PrivacyFilterModel<Label>

The privacy filter model configuration. See PrivacyFilterModel.

options?

ResourceOptions

Load and caching options. See ResourceOptions.

Returns

object

The same object as PrivacyFilter (without dispose), combined with loading state and download progress.

detectPii

detectPii: any = model.detectPii

detectPiiWorklet

detectPiiWorklet: any = model.detectPiiWorklet

downloadProgress

downloadProgress: any

error

error: any

isReady

isReady: boolean = !!model

resource

resource: any

See

PrivacyFilter