public ConfidenceEvaluator(InstanceWithConfidence[] instances, boolean sorted) {
   this.confidences = new Vector();
   for (int i = 0; i < instances.length; i++) {
     Sequence input = (Sequence) instances[i].getInstance().getData();
     confidences.add(
         new EntityConfidence(
             instances[i].getConfidence(), instances[i].correct(), input, 0, input.size() - 1));
   }
   if (!sorted) Collections.sort(confidences, new ConfidenceComparator());
   this.nBins = DEFAULT_NUM_BINS;
   this.numCorrect = getNumCorrectEntities();
 }
 public EntityConfidence(double conf, boolean corr, Sequence input, int start, int end) {
   this.confidence = conf;
   this.correct = corr;
   StringBuffer buff = new StringBuffer();
   if (input != null) {
     for (int j = start; j <= end; j++) {
       FeatureVector fv = (FeatureVector) input.get(j);
       for (int k = 0; k < fv.numLocations(); k++) {
         String featureName = fv.getAlphabet().lookupObject(fv.indexAtLocation(k)).toString();
         if (featureName.startsWith("W=") && featureName.indexOf("@") == -1) {
           buff.append(featureName.substring(featureName.indexOf('=') + 1) + " ");
         }
       }
     }
   }
   this.entity = buff.toString();
 }