stanfordnlp/CoreNLP · error · RuntimeException

Not yet implemented!

Error message

Not yet implemented!

What it means

evaluateRawText() is a placeholder: evaluating raw (unsegmented) input against a gold reference requires a monotonic character-alignment algorithm that was never implemented, so the method unconditionally throws RuntimeException("Not yet implemented!"). It is invoked from main when testFile is set without answerFile-style aligned gold data.

Solutions

  1. Evaluate against a gold file whose sentences align one-to-one with the input (use the standard evaluate path, not raw-text evaluation)
  2. Pre-segment or align the raw test file so it matches the gold reference segmentation, then use the supported evaluation mode
  3. Implement the missing monotonic alignment algorithm and rebuild if raw-text evaluation is truly needed

Example fix

// before
java ArabicSegmenter -testFile raw.txt -answerFile gold.txt  // hits evaluateRawText
// after
java ArabicSegmenter -testFile gold-aligned.txt -answerFile gold.txt  // aligned evaluation path
Defensive patterns

Strategy: validation

Validate before calling

// only use the supported aligned-evaluation mode
boolean rawEval = (testFile != null && goldNotAligned);
if (rawEval) throw new IllegalStateException("Raw-text evaluation unsupported in ArabicSegmenter");

Try / catch

try { ArabicSegmenter.main(args); } catch (RuntimeException e) { if (e.getMessage().startsWith("Not yet implemented")) { /* use aligned evaluation instead */ } }

Prevention

When it happens

Trigger: Running the ArabicSegmenter main with evaluation flags pointing at a raw test file where evaluation against a differently-segmented gold reference would be needed (gold answers with different characters-per-sentence).

Common situations: Running command-line evaluation of the segmenter on raw untokenized Arabic text; the TODO in the source shows this path was never completed.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/international/arabic/process/ArabicSegmenter.java:455

      tedEvalParseTree.close();
      tedEvalParseSeg.close();
    }
  }

  private static String tedEvalSanitize(String str) {
    return str.replaceAll("\\(", "#lp#").replaceAll("\\)", "#rp#");
  }

  /**
   * Evaluate P/R/F1 when the input is raw text.
   */
  private static void evaluateRawText(PrintWriter pwOut) {
    // TODO(spenceg): Evaluate raw input w.r.t. a reference that might have different numbers
    // of characters per sentence. Need to implement a monotonic sequence alignment algorithm
    // to align the two character strings.
    //    String gold = flags.answerFile;
    //    String rawFile = flags.testFile;
    throw new RuntimeException("Not yet implemented!");
  }

  public void serializeSegmenter(String filename) {
    classifier.serializeClassifier(filename);
  }

  public void loadSegmenter(String filename, Properties p) {
    try {
      classifier = CRFClassifier.getClassifier(filename, p);
    } catch (ClassCastException | IOException | ClassNotFoundException e) {
      throw new RuntimeIOException("Failed to load segmenter " + filename, e);
    }
  }

  @Override
  public void loadSegmenter(String filename) {
    loadSegmenter(filename, new Properties());
  }

View on GitHub (pinned to 1b7edd19c4)