From 0ca30a51f157a7af23bb078441268a5c9db5df66 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@etu.univ-amu.fr>
Date: Fri, 7 Dec 2018 11:28:35 +0100
Subject: [PATCH] Added output of the number of introduced and corrected errors
 on the dev to train_error_corpus

---
 .../src/macaon_train_error_detector.cpp            | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/error_correction/src/macaon_train_error_detector.cpp b/error_correction/src/macaon_train_error_detector.cpp
index da5f3f5..1751e92 100644
--- a/error_correction/src/macaon_train_error_detector.cpp
+++ b/error_correction/src/macaon_train_error_detector.cpp
@@ -265,21 +265,25 @@ std::map<std::string, std::pair<float, std::pair<float, float> > > getScoreOnDev
     }
   }
 
-  fprintf(stderr, "Class 0 nbExemples : %d\n", pred0Hyp0+pred1Hyp0);
+  int nbErrorsIntroduced = pred1Hyp0;
+  int nbErrorsCorrected = pred1Hyp1;
+
+  fprintf(stderr, "\nClass 0 nbExemples : %d\n", pred0Hyp0+pred1Hyp0);
   fprintf(stderr, "Class 0 precision : %.2f%%\n", 100.0*pred0Hyp0 / (pred0Hyp0+pred0Hyp1));
   fprintf(stderr, "Class 0 recall : %.2f%%\n\n", 100.0*pred0Hyp0 / (pred0Hyp0+pred1Hyp0));
 
   fprintf(stderr, "Class 1 nbExemples : %d\n", pred0Hyp1+pred1Hyp1);
   fprintf(stderr, "Class 1 precision : %.2f%%\n", 100.0*pred1Hyp1 / (pred1Hyp1+pred1Hyp0));
-  fprintf(stderr, "Class 1 recall : %.2f%%\n", 100.0*pred1Hyp1 / (pred1Hyp1+pred0Hyp1));
+  fprintf(stderr, "Class 1 recall : %.2f%%\n\n", 100.0*pred1Hyp1 / (pred1Hyp1+pred0Hyp1));
+
+  fprintf(stderr, "Nb errors introduced : %d\n", nbErrorsIntroduced);
+  fprintf(stderr, "Nb errors corrected : %d\n", nbErrorsCorrected);
+  fprintf(stderr, "Difference : %d\n", nbErrorsCorrected-nbErrorsIntroduced);
 
   std::map<std::string, std::pair<float,std::pair<float,float> > > scores;
 
   for (auto & it : counts)
-  {
-  //  scores[it.first].first = 100.0 * it.second.second / it.second.first;
       scores[it.first].first = 100.0*pred1Hyp1 / (pred1Hyp1+pred1Hyp0);
-  }
 
   return scores;
 }
-- 
GitLab