Table of Contents

Method ExtractAsync

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

ExtractAsync(Attachment, CancellationToken)

Asynchronously recognizes PII in the given attachment. For multi-page documents (e.g. PDF), all pages are analyzed.

public Task<List<PiiExtraction.PiiExtractedEntity>> ExtractAsync(Attachment content, CancellationToken cancellationToken = default)

Parameters

content Attachment
cancellationToken CancellationToken

Returns

Task<List<PiiExtraction.PiiExtractedEntity>>

ExtractAsync(Attachment, string, CancellationToken)

Asynchronously recognizes PII in the specified page range of the given attachment.

public Task<List<PiiExtraction.PiiExtractedEntity>> ExtractAsync(Attachment content, string pageRange, CancellationToken cancellationToken = default)

Parameters

content Attachment

The attachment to analyze. Can be an image or a multi-page document.

pageRange string

A page range string using 1-based page numbers (e.g., "1-5, 7, 9-12"). If null, empty, or "*", all pages are analyzed.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<List<PiiExtraction.PiiExtractedEntity>>

A list of detected PiiExtraction.PiiExtractedEntity instances.

Exceptions

ArgumentNullException

Thrown when the attachment is null.

InvalidModelException

Thrown when the underlying language model does not support the required inference modality.

ExtractAsync(string, CancellationToken)

Asynchronously recognizes PII in the given content.

public Task<List<PiiExtraction.PiiExtractedEntity>> ExtractAsync(string content, CancellationToken cancellationToken = default)

Parameters

content string
cancellationToken CancellationToken

Returns

Task<List<PiiExtraction.PiiExtractedEntity>>
Share