stanfordnlp/CoreNLP · error · IllegalArgumentException
Coreference is not implemented for German
Error message
Coreference is not implemented for German
What it means
GermanDocument.coref() throws IllegalArgumentException because coreference resolution is not implemented for German in Stanford CoreNLP's simple API. Any attempt to compute coref chains on a German document fails immediately with this message. It is an intentional unsupported-operation stub.
Solutions
- Exclude the 'coref' annotator from German pipelines
- Run coreference only on supported languages (English)
- Integrate a third-party German coreference system
- Guard with instanceof/language checks before calling coref()
Example fix
// before
pipeline = new StanfordCoreNLP(propsWithCoref, "de");
Map<Integer, CorefChain> c = new Document(text).coref();
// after
if (!"en".equals(lang)) {
Map<Integer, CorefChain> c = Collections.emptyMap(); // coref unsupported
} else {
Map<Integer, CorefChain> c = new Document(text).coref();
} Defensive patterns
Strategy: validation
Validate before calling
if (doc instanceof GermanDocument) {
throw new UnsupportedOperationException("coref not supported for German");
} Type guard
boolean supportsCoref(Document d) {
return !(d instanceof GermanDocument);
} Try / catch
try {
Map<Integer, CorefChain> chains = doc.coref(props);
} catch (IllegalArgumentException e) {
chains = Collections.emptyMap();
} Prevention
- Filter annotators by language support before pipeline creation
- Unit-test pipelines per language to catch unsupported annotators early
- Log and skip unsupported annotators instead of failing the batch
When it happens
Trigger: Calling Document.coref(Properties) or Sentence.coref() on a German document, or including the 'coref' annotator in a German StanfordCoreNLP pipeline.
Common situations: Reusing an English coref pipeline config for German; assuming annotator support is uniform across the -language flag values.
Related errors
- Coreference is not implemented for French
- allSentences != allWords
- Cannot have these two ordering constraints
- Cannot have these two ordering constraints
- Coreference is not implemented for Arabic
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/5683fe388acfa9bf.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/simple/GermanDocument.java:89
* No lemma annotator for German -- set the lemma to be the word.
*
* @see Document#runLemma(Properties)
*/
@Override
protected Document runLemma(Properties props) {
return mockLemma(props);
}
@Override
protected Document runSentiment(Properties props) {
throw new IllegalArgumentException("Sentiment analysis is not implemented for German");
}
@Override
public Map<Integer, CorefChain> coref(Properties props) {
throw new IllegalArgumentException("Coreference is not implemented for German");
}
}
View on GitHub (pinned to 1b7edd19c4)