43 lines
996 B
C#
43 lines
996 B
C#
namespace ReportGenerator.Models;
|
|
|
|
internal readonly struct ImageStats
|
|
{
|
|
public string ImageName { get; } = string.Empty;
|
|
|
|
public ICollection<string> Reference { get; } = Array.Empty<string>();
|
|
public ICollection<ProcessorStat> Stats { get; } = Array.Empty<ProcessorStat>();
|
|
|
|
public ImageStats(
|
|
string imageName,
|
|
ICollection<string> taggedWords,
|
|
IEnumerable<ScannedResultInfo> scanResult
|
|
)
|
|
{
|
|
Reference = taggedWords;
|
|
ImageName = imageName;
|
|
Stats = scanResult
|
|
.Select(t => new ProcessorStat(t.ProcessorName, taggedWords, t.GetWords()))
|
|
.ToArray();
|
|
}
|
|
|
|
|
|
public IEnumerable<IEnumerable<string>> ToTable()
|
|
{
|
|
// Title
|
|
yield return Reference
|
|
.Prepend("Processor")
|
|
.Append("WER")
|
|
.Append("CER (avg)")
|
|
.Append("CER (sum)");
|
|
|
|
// Spacer
|
|
yield return Enumerable.Range(0, Reference.Count + 4).Select(_ => "---");
|
|
|
|
// Content
|
|
foreach (var stat in Stats)
|
|
{
|
|
yield return stat.ToRow();
|
|
}
|
|
}
|
|
}
|