stanfordnlp/CoreNLP · error · RuntimeException

ResultsPrinter.align: gold standard sentences don't match…

Error message

ResultsPrinter.align: gold standard sentences don't match extractor output sentences!

What it means

Thrown by ResultsPrinter.align when, after sorting both lists, the gold-standard sentences and extractor-output sentences differ in text (or count) at some position; evaluation cannot align predictions to gold, usually meaning the extractor read different input than the gold annotation file.

Solutions

  1. Verify gold and predicted inputs cover the same documents and sentences
  2. Check DocID/TextAnnotation consistency in both datasets
  3. Regenerate extractor output on the exact gold test set
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/edu/stanford/nlp/ie/machinereading/ResultsPrinter.java:80 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/f8b79e118d7f7be9. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/ie/machinereading/ResultsPrinter.java:80

        String d2 = sent2.get(CoreAnnotations.DocIDAnnotation.class);
        if (d1 != null && d2 != null && !d1.equals(d2))
          return d1.compareTo(d2);

        String t1 = sent1.get(CoreAnnotations.TextAnnotation.class);
        String t2 = sent2.get(CoreAnnotations.TextAnnotation.class);
        return t1.compareTo(t2);
      }
    }
    Collections.sort(list1,new CompareSentences());
    Collections.sort(list2,new CompareSentences());

    for (int i = 0; i < list1.size(); i++) {
      if (!list1.get(i).get(CoreAnnotations.TextAnnotation.class).equals(list2.get(i).get(CoreAnnotations.TextAnnotation.class)))
        alignable = false;
    }

    if (!alignable) {
      throw new RuntimeException("ResultsPrinter.align: gold standard sentences don't match extractor output sentences!");
    }
  }

}

View on GitHub (pinned to 1b7edd19c4)