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:
69
tests/TestSupport.Shared/RealRoutingNerModelFixture.cs
Normal file
69
tests/TestSupport.Shared/RealRoutingNerModelFixture.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using PiiRedaction.Core.Configuration;
|
||||
using PiiRedaction.Infrastructure.Onnx;
|
||||
|
||||
namespace PiiRedaction.Tests.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// Loads English and Tamil ONNX runners and exposes a <see cref="RoutingOnnxNerModelRunner"/>.
|
||||
/// Skips when either model is missing or cannot be loaded.
|
||||
/// </summary>
|
||||
public abstract class RealRoutingNerModelFixture
|
||||
{
|
||||
protected RoutingOnnxNerModelRunner Runner { get; private set; } = null!;
|
||||
|
||||
protected EnglishOnnxNerRunner EnglishRunner { get; private set; } = null!;
|
||||
|
||||
protected TamilOnnxNerRunner TamilRunner { get; private set; } = null!;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OneTimeSetUpRoutingModels()
|
||||
{
|
||||
var englishPath = RealNerModelPaths.ResolveRepoModelPath();
|
||||
if (!File.Exists(englishPath))
|
||||
{
|
||||
Assert.Ignore(RealNerModelPaths.ModelMissingMessage);
|
||||
}
|
||||
|
||||
var tamilPath = RealTamilNerModelPaths.ResolveRepoModelPath();
|
||||
if (!File.Exists(tamilPath))
|
||||
{
|
||||
Assert.Ignore(RealTamilNerModelPaths.ModelMissingMessage);
|
||||
}
|
||||
|
||||
var options = Options.Create(new PiiRedactionOptions
|
||||
{
|
||||
EnglishOnnxModelPath = englishPath,
|
||||
OnnxModelPath = englishPath,
|
||||
TamilOnnxModelPath = tamilPath,
|
||||
EnableTamilNer = true
|
||||
});
|
||||
|
||||
EnglishRunner = new EnglishOnnxNerRunner(options, NullLogger<EnglishOnnxNerRunner>.Instance);
|
||||
TamilRunner = new TamilOnnxNerRunner(options, NullLogger<TamilOnnxNerRunner>.Instance);
|
||||
|
||||
if (!EnglishRunner.IsModelAvailable)
|
||||
{
|
||||
EnglishRunner.Dispose();
|
||||
TamilRunner.Dispose();
|
||||
Assert.Ignore(RealNerModelPaths.ModelMissingMessage);
|
||||
}
|
||||
|
||||
if (!TamilRunner.IsModelAvailable)
|
||||
{
|
||||
EnglishRunner.Dispose();
|
||||
TamilRunner.Dispose();
|
||||
Assert.Ignore(RealTamilNerModelPaths.ModelMissingMessage);
|
||||
}
|
||||
|
||||
Runner = new RoutingOnnxNerModelRunner(EnglishRunner, TamilRunner, options);
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void OneTimeTearDownRoutingModels()
|
||||
{
|
||||
EnglishRunner?.Dispose();
|
||||
TamilRunner?.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user