Table of Contents

Constructor PiiExtraction

Namespace
LMKit.TextAnalysis
Assembly
LM-Kit.NET.dll

PiiExtraction(LM, bool)

Initializes a new instance of PiiExtraction with a default set of entity definitions (all built-in PiiExtraction.PiiEntityType values except Custom and, by default, Other).

public PiiExtraction(LM model, bool includeOtherType = false)

Parameters

model LM

A valid LM model that is not an embedding-only model and has tensor weights loaded.

includeOtherType bool

When true, also includes the catch-all Other in the default definitions. Use this to discover unexpected identifiers that do not fit any predefined type and for which you have not created a specific Custom label. Defaults to false.

Examples

// Typical usage (precision-oriented): do not include the catch-all bucket
var precise = new PiiExtraction(model);

// Discovery mode (higher recall, potentially more false positives):
var discovery = new PiiExtraction(model, includeOtherType: true);

Remarks

About Other: This is a catch-all bucket intended for discovery of sensitive identifiers that are **not** covered by predefined types (e.g., Person, PhoneNumber) and for which you have **not** provided a dedicated custom label. Examples include passport numbers, local taxpayer IDs, driver’s license numbers, or membership IDs.

Because it is intentionally broad, enabling Other can increase recall at the cost of a higher false-positive rate. When you know the category name you want, prefer defining a Custom label instead of relying on Other.

Exceptions

ArgumentNullException

Thrown if model is null.

InvalidModelException

Thrown if model is an embedding model or was loaded without weights.

PiiExtraction(LM, List<PiiEntityDefinition>)

Initializes a new instance of PiiExtraction with a custom list of entity definitions.

public PiiExtraction(LM model, List<PiiExtraction.PiiEntityDefinition> definitions)

Parameters

model LM

A valid LM model that is not an embedding‐only model and has tensor weights loaded.

definitions List<PiiExtraction.PiiEntityDefinition>

The list of PiiExtraction.PiiEntityDefinition items (built‐in or custom) that this extractor will use. Must be non-null and contain at least one item.

Exceptions

ArgumentNullException

Thrown if model is null or definitions is null/empty.

InvalidModelException

Thrown if model is an embedding model or was loaded without weights.