/** Average confidence score for the incorrect entities */
 public double getAverageCorrectConfidence() {
   double sum = 0.0;
   for (int i = 0; i < confidences.size(); i++) {
     EntityConfidence ec = (EntityConfidence) confidences.get(i);
     if (ec.correct()) {
       sum += ec.confidence();
     }
   }
   return sum / (double) this.numCorrect;
 }
 /** number of entities correctly extracted */
 private int getNumCorrectEntities() {
   int sum = 0;
   for (int i = 0; i < confidences.size(); i++) {
     EntityConfidence ec = (EntityConfidence) confidences.get(i);
     if (ec.correct()) {
       sum++;
     }
   }
   return sum;
 }
 /** IR Average precision measure. Analogous to ranking _correct_ documents by confidence score. */
 public double getAveragePrecision() {
   int nc = 0;
   int ni = 0;
   double totalPrecision = 0.0;
   for (int i = confidences.size() - 1; i >= 0; i--) {
     EntityConfidence c = (EntityConfidence) confidences.get(i);
     if (c.correct()) {
       nc++;
       totalPrecision += (double) nc / (nc + ni);
     } else ni++;
   }
   return totalPrecision / nc;
 }