{"record":{"id":"b77be8ca0be951a9","repo":"stanfordnlp/CoreNLP","slug":"coreference-is-not-implemented-for-french","errorCode":null,"errorMessage":"Coreference is not implemented for French","messagePattern":"Coreference is not implemented for French","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/simple/FrenchDocument.java","lineNumber":88,"sourceCode":"  /**\n   * No lemma annotator for French -- set the lemma to be the word.\n   *\n   * @see Document#runLemma(Properties)\n   */\n  @Override\n  protected Document runLemma(Properties props) {\n    return mockLemma(props);\n  }\n\n\n  @Override\n  protected Document runSentiment(Properties props) {\n    throw new IllegalArgumentException(\"Sentiment analysis is not implemented for French\");\n  }\n\n  @Override\n  public Map<Integer, CorefChain> coref(Properties props) {\n    throw new IllegalArgumentException(\"Coreference is not implemented for French\");\n  }\n\n}\n","sourceCodeStart":70,"sourceCodeEnd":92,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/simple/FrenchDocument.java#L70-L92","documentation":"Stanford CoreNLP's FrenchDocument overrides the pipeline annotator hooks but does not implement coreference resolution for French, so Document.coref() throws IllegalArgumentException immediately. The library uses language-specific Document subclasses and only English (and a few others) ship coreference models. This is an explicit unsupported-operation guard, not a bug.","triggerScenarios":"Calling CorefChain coref(Properties) or any Document/Sentence-level API that triggers coreference (e.g. Document.coref(), Sentence.coref(), or running an annotator pipeline with the 'coref' annotator on a French document).","commonSituations":"Using StanfordCoreNLP with the coref annotator and -language fr; porting an English coref pipeline to French; assuming all languages supported by the simple API support all annotators.","solutions":["Remove the coref annotator from the pipeline / skip Document.coref() for French text","Run coreference with the English pipeline only if your data is English","Use an external French-capable coreference tool (e.g. a neural coref model supporting French) and feed its output into your app","Wrap coref() in a feature check and degrade gracefully when unsupported"],"exampleFix":"// before\nDocument doc = new Document(\"...\");\nMap<Integer, CorefChain> chains = doc.coref();\n// after\nif (doc instanceof FrenchDocument) {\n  System.err.println(\"coref not supported for French\");\n} else {\n  Map<Integer, CorefChain> chains = doc.coref();\n}","handlingStrategy":"validation","validationCode":"if (doc instanceof FrenchDocument) {\n  throw new UnsupportedOperationException(\"coref not supported for French\");\n}","typeGuard":"boolean supportsCoref(Document d) {\n  return !(d instanceof FrenchDocument);\n}","tryCatchPattern":"try {\n  Map<Integer, CorefChain> chains = doc.coref(props);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"not implemented\")) {\n    chains = Collections.emptyMap();\n  } else { throw e; }\n}","preventionTips":["Check language support per annotator before building pipelines","Keep a supported-features matrix for each -language value","Degrade gracefully: skip coref for unsupported languages"],"tags":["corenlp","coreference","unsupported-language"],"backgroundTag":"method-not-implemented","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}