public int compare()

in opennlp-tools/src/main/java/opennlp/tools/cmdline/FineGrainedReportListener.java [508:560]


    public int compare(String o1, String o2) {
      if (o1.equals(o2)) {
        return 0;
      }
      String c1 = o1;
      String c2 = o2;

      if (o1.contains("-")) {
        c1 = o1.split("-")[0];
      }
      if (o2.contains("-")) {
        c2 = o2.split("-")[0];
      }

      if (c1.equals(c2)) { // same category - sort by confusion matrix

        ConfusionMatrixLine t1 = confusionMatrix.get(o1);
        ConfusionMatrixLine t2 = confusionMatrix.get(o2);
        if (t1 == null || t2 == null) {
          if (t1 == null) {
            return 1;
          } else {
            return -1;
          }
        }
        double r1 = t1.getAccuracy();
        double r2 = t2.getAccuracy();
        if (r1 == r2) {
          return o1.compareTo(o2);
        }
        if (r2 > r1) {
          return 1;
        }
        return -1;
      } else { // different category - sort by category
        Double t1 = categoryAccuracy.get(c1);
        Double t2 = categoryAccuracy.get(c2);
        if (t1 == null || t2 == null) {
          if (t1 == null) {
            return 1;
          } else {
            return -1;
          }
        }
        if (t1.equals(t2)) {
          return o1.compareTo(o2);
        }
        if (t2 > t1) {
          return 1;
        }
        return -1;
      }
    }