stanfordnlp/CoreNLP · error · IllegalArgumentException

Dependency parsing is not implemented for Spanish

Error message

Dependency parsing is not implemented for Spanish

What it means

SpanishDocument.runDepparse is an explicit stub: dependency parsing is not implemented for the Spanish simple-API pipeline, so the method throws IllegalArgumentException. Any dependency-parse request on a Spanish document reaches this unsupported-operation guard.

Solutions

  1. Skip dependency parsing for Spanish documents
  2. Use a pipeline/tool with Spanish dependency parsing support (e.g. full CoreNLP Spanish models via StanfordCoreNLP, or udpipe/SpaCy)
  3. Guard calls behind a language/capability check
  4. Extend SpanishDocument and override runDepparse with a working annotator pipeline if needed

Example fix

// before
Document d = new SpanishDocument(text);
d.depparse(); // throws
// after
if (!(d instanceof SpanishDocument)) {
  d.depparse();
}
Defensive patterns

Strategy: fallback

Validate before calling

if (doc instanceof SpanishDocument) { /* skip depparse */ }

Type guard

boolean supportsDepparse(Document d) { return !(d instanceof SpanishDocument); }

Try / catch

try {
  doc.depparse();
} catch (IllegalArgumentException e) {
  // use alternative parser or skip
}

Prevention

When it happens

Trigger: Calling depparse(), runDepparse(props), or APIs that internally request the depparse annotator on a SpanishDocument.

Common situations: Language-agnostic analysis code that assumes all Document types support dependency parsing; migrating English pipelines to Spanish; requesting grammatical structure on Spanish text through the simple API.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/simple/SpanishDocument.java:89

   * No lemma annotator for Spanish -- 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 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)