Add Tamil NER routing and WPF test harness for POC validation.

Introduce dual-script ONNX NER routing (English/Tamil/mixed), Tamil console samples and integration tests, model download scripts, and a resizable WPF MVVM harness with click-to-load prompts, batch validation, and runtime-adjustable detection panels.
This commit is contained in:
Bilal Nazer Ali
2026-07-07 17:12:38 +05:30
parent a707c6c9cf
commit cf8f5a7232
71 changed files with 4494 additions and 356 deletions

View File

@@ -0,0 +1,26 @@
namespace PiiRedaction.Infrastructure.Onnx;
public sealed class NerLabelConfig
{
private readonly Func<string, bool> _isPersonLabel;
private NerLabelConfig(Func<string, bool> isPersonLabel) => _isPersonLabel = isPersonLabel;
public static NerLabelConfig English { get; } = new(IsEnglishPersonLabel);
public static NerLabelConfig Tamil { get; } = new(IsTamilPersonLabel);
public bool IsPersonLabel(string label) => _isPersonLabel(label);
public bool IsBeginLabel(string label) => label.StartsWith("B-", StringComparison.Ordinal);
public bool IsInsideLabel(string label) => label.StartsWith("I-", StringComparison.Ordinal);
private static bool IsEnglishPersonLabel(string label) =>
label is "B-PER" or "I-PER" or "B-PERSON" or "I-PERSON"
|| (label.EndsWith("-PER", StringComparison.Ordinal) &&
(label.StartsWith("B-", StringComparison.Ordinal) || label.StartsWith("I-", StringComparison.Ordinal)));
private static bool IsTamilPersonLabel(string label) =>
label.Contains("person", StringComparison.OrdinalIgnoreCase);
}