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
contentAttachmentcancellationTokenCancellationToken
Returns
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
contentAttachmentThe attachment to analyze. Can be an image or a multi-page document.
pageRangestringA page range string using 1-based page numbers (e.g.,
"1-5, 7, 9-12"). Ifnull, empty, or"*", all pages are analyzed.cancellationTokenCancellationTokenToken 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
contentstringcancellationTokenCancellationToken