stanfordnlp/CoreNLP · error · IllegalArgumentException
Coreference is not implemented for Spanish
Error message
Coreference is not implemented for Spanish
What it means
SpanishDocument.coref is an explicit stub: coreference resolution is not implemented for the Spanish simple-API pipeline, so it throws IllegalArgumentException. This signals the unsupported feature at call time instead of silently returning empty results.
Solutions
- Skip coreference resolution for Spanish documents
- Use a tool with Spanish coreference support (e.g. cross-lingual coref libraries) outside the simple API
- Guard the call with a language capability check
- Handle the IllegalArgumentException explicitly to degrade gracefully
Example fix
// before
Document d = new SpanishDocument(text);
Map<Integer, CorefChain> chains = d.coref(); // throws
// after
if (!(d instanceof SpanishDocument)) {
Map<Integer, CorefChain> chains = d.coref();
} Defensive patterns
Strategy: fallback
Validate before calling
if (doc instanceof SpanishDocument) { /* skip coref */ } Type guard
boolean supportsCoref(Document d) { return !(d instanceof SpanishDocument); } Try / catch
try {
Map<Integer, CorefChain> chains = doc.coref();
} catch (IllegalArgumentException e) {
chains = Collections.emptyMap();
} Prevention
- Treat coref as language-dependent and guard calls
- Avoid building features that require coref for Spanish text
- Return empty/absent coref results gracefully in shared pipeline code
When it happens
Trigger: Calling coref(props) or document.coref() on a SpanishDocument instance.
Common situations: Pipeline code that runs coreference on every document regardless of language; porting English coref workflows to Spanish; downstream components (e.g. entity linking) that depend on CorefChain output.
Related errors
- Sentiment analysis is not implemented for Spanish
- Dependency parsing is not implemented for Spanish
- this.getClass().getName() + ": Case is presently…
- French does not support feature type:
- We don't support disambiguating pronoun
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/b13cfbb430afd06d.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/simple/SpanishDocument.java:95
return mockLemma(props);
}
@Override
protected Document runSentiment(Properties props) {
throw new IllegalArgumentException("Sentiment analysis is not implemented for Spanish");
}
@Override
protected Document runDepparse(Properties props) {
throw new IllegalArgumentException("Dependency parsing is not implemented for Spanish");
}
@Override
public Map<Integer, CorefChain> coref(Properties props) {
throw new IllegalArgumentException("Coreference is not implemented for Spanish");
}
}
View on GitHub (pinned to 1b7edd19c4)