Table of Contents

Class PiiPatternDetector

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

Finds sensitive identifiers by their format and checksum, without a language model: bank account numbers (IBAN), payment cards, French social security numbers (NIR), French company numbers (SIREN, SIRET), EU VAT numbers, e-mail addresses, phone numbers and IP addresses.

public static class PiiPatternDetector
Inheritance
PiiPatternDetector
Inherited Members

Examples

using LMKit.Data;
using LMKit.TextAnalysis;

var attachment = new Attachment("statement.pdf");
foreach (var entity in PiiPatternDetector.Detect(attachment))
{
    Console.WriteLine($"{entity.EntityDefinition.Label}: {entity.Value} ({entity.Occurrences.Count} occurrence(s))");
}

Remarks

Detection reads the text layer of a document (or the OCR text of a scanned page when an OcrEngine is supplied) and locates every occurrence of every hit on its page, with its bounding box, exactly as PiiExtraction reports its findings. A checksum-validated hit is certain: every entity is reported with a confidence of 1.

The detectors are instant and deterministic. Combine them with the language model through PatternDetection, which merges both result sets.

Methods

Detect(Attachment, string, OcrEngine, PiiPatternKinds, CancellationToken)

Detects identifiers in a document and reports them as entities with their occurrences: page index and bounding box on the page.

Detect(string, PiiPatternKinds, CancellationToken)

Detects identifiers in text and reports them as entities with their occurrences.

DetectAsync(Attachment, string, OcrEngine, PiiPatternKinds, CancellationToken)

Asynchronously detects identifiers in a document and reports them as entities with their occurrences: page index and bounding box on the page.

FindMatches(string, PiiPatternKinds)

Finds every hit of the selected detectors in text.

Share