Table of Contents

Class PiiExtraction

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

A class for performing PII extraction on input content using a Language Model (LM). This class identifies and extracts all occurrences of specified PII entity types (built‐in or custom) from the provided content, returning each entity verbatim along with its type and optional positional information.

public sealed class PiiExtraction
Inheritance
PiiExtraction
Inherited Members

Remarks

Use this class to extract PII such as persons, organization identifiers, locations, dates, etc., by leveraging an underlying LMKit LM model. You can customize which PII types to extract by setting the PiiEntityDefinitions property.

Constructors

PiiExtraction(LM)

Initializes a new instance of PiiExtraction with default entity definitions (all built‐in PiiExtraction.PiiEntityType values except Custom).

PiiExtraction(LM, List<PiiEntityDefinition>)

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

Properties

Confidence

Gets the confidence score of the last extraction operation.

Guidance

Gets or sets semantic guidance for the extraction process.

MaxContextLength

Gets or sets the maximum context length (in tokens) used during PII extraction.

Model

The underlying LM instance used for performing extraction.

OcrEngine

Gets or sets the OCR engine used to perform optical character recognition on image attachments during PII extraction.

PiiEntityDefinitions

Gets or sets the list of entity types (built‐in and/or custom) that this extractor will capture. Must contain at least one PiiExtraction.PiiEntityDefinition; otherwise, an ArgumentNullException is thrown.

PreferredInferenceModality

Gets or sets the preferred modality for inference. This determines whether text, image, or both modalities are used when processing input. Defaults to Multimodal.

Methods

Extract(Attachment, CancellationToken)

Synchronously recognizes PII in the given image attachment.

Extract(string, CancellationToken)

Synchronously recognizes PII in the given content.

ExtractAsync(Attachment, CancellationToken)

Asynchronously recognizes PII in the given image attachment.

ExtractAsync(string, CancellationToken)

Asynchronously recognizes PII in the given content.