in src/cs/PhoneticMatchingPerfTests/FuzzyMatcherPerfTester.cs [71:122]
private void AccuracyTest(CancellationToken ct, Stopwatch sw, bool isLoop)
{
// Were we already canceled?
ct.ThrowIfCancellationRequested();
long failedCount = 0;
do
{
foreach (var test in this.testSet)
{
foreach (var query in test.Queries)
{
foreach (var transcription in query.Transcriptions)
{
if (ct.IsCancellationRequested)
{
Console.WriteLine("Timeout! Cancelling test task...");
if (!isLoop)
{
this.WriteSuccessRate(failedCount);
}
ct.ThrowIfCancellationRequested();
}
else
{
var result = this.matcher.Find(transcription.Utterance);
if (!isLoop && !result.Contains(test.Element))
{
++failedCount;
}
int currentCounts = result.Count;
long incTotalTests = this.totalTests + 1;
this.avgResultsCount = ((this.avgResultsCount * this.totalTests) / incTotalTests) + (((double)currentCounts) / incTotalTests);
this.totalTests = incTotalTests;
if (this.totalTests % 1000 == 0)
{
this.WriteStats(sw);
}
}
}
}
}
}
while (isLoop);
this.WriteSuccessRate(failedCount);
}