Ejemplo n.º 1
0
 private IEvalCase[] Load(string fileName)
 {
     using (WebClient client = new WebClient())
     {
         var timer = new Timer();
         var res = CaseLoader.LoadCase(new StreamReader(new MemoryStream(client.DownloadData(PetrovichEvalMaster+fileName)),Encoding.UTF8));
         Debug.WriteLine($"Загружен файл {fileName} за {timer}");
         return res;
     }
 }
Ejemplo n.º 2
0
 public void Evaluate(EvaluateParameters parameters)
 {
     var timer = new Timer();
     var errors = new List<IEvalCase>();
     var caseData = parameters.CaseAccessor(_caseSource);
     int totalGood = 0;
     foreach (var @case in caseData)
     {
         string inflectResult;
         var isActive = EvaluateCase(parameters, @case, out inflectResult);
         @case.Result = inflectResult;
         if (isActive)
             totalGood++;
         else
         {
             errors.Add(@case);
         }
     }
     var rate = (double) totalGood/ caseData.Length;
     Debug.WriteLine("");
     Debug.WriteLine($"Проверен '{parameters.Description}' за {timer} (на 1000 {timer.Duration.TotalSeconds * 1000/ (caseData.Length):R} сек.) точность '{rate}'");
     File.WriteAllLines(parameters.Description+".errors.txt", errors.Select(x=>x.ToString()));
 }