{"record":{"id":"400fad17eaaa2b55","repo":"stanfordnlp/CoreNLP","slug":"sentiment-analysis-is-not-implemented-for-german","errorCode":null,"errorMessage":"Sentiment analysis is not implemented for German","messagePattern":"Sentiment analysis is not implemented for German","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/simple/GermanDocument.java","lineNumber":83,"sourceCode":"  protected GermanDocument(Properties props, String text) {\n    super(props, text);\n  }\n\n\n  /**\n   * No lemma annotator for German -- 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 German\");\n  }\n\n\n  @Override\n  public Map<Integer, CorefChain> coref(Properties props) {\n    throw new IllegalArgumentException(\"Coreference is not implemented for German\");\n  }\n\n}\n","sourceCodeStart":65,"sourceCodeEnd":93,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/simple/GermanDocument.java#L65-L93","documentation":"GermanDocument overrides runSentiment to throw because no sentiment analysis annotator is wired up for German in the simple API. Calling sentiment on a German Document/Sentence throws IllegalArgumentException. It signals an explicitly unimplemented feature for this language, not a configuration error.","triggerScenarios":"Calling Document.runSentiment indirectly via Document.sentiment(), Sentence.sentiment(), or applying the 'sentiment' annotator to German text through StanfordCoreNLP with -language de.","commonSituations":"Adding the sentiment annotator to a German pipeline; calling sentiment() in a loop over multilingual documents without checking the language; upgrading the simple API and expecting German sentiment support.","solutions":["Remove the 'sentiment' annotator for German documents","Run sentiment only on English documents","Use a German-specific sentiment library/model and merge results","Check the document language before calling sentiment() and branch to a fallback"],"exampleFix":"// before\nDocument doc = new Document(germanText);\nString s = doc.sentiment();\n// after\nif (doc.getClass().getSimpleName().startsWith(\"German\")) {\n  throw new UnsupportedOperationException(\"German sentiment unavailable\");\n}\nString s = doc.sentiment();","handlingStrategy":"validation","validationCode":"if (doc instanceof GermanDocument) {\n  throw new UnsupportedOperationException(\"sentiment not supported for German\");\n}","typeGuard":"boolean supportsSentiment(Document d) {\n  return !(d instanceof GermanDocument);\n}","tryCatchPattern":"try {\n  String s = sentence.sentiment();\n} catch (IllegalArgumentException e) {\n  s = null; // unsupported for this language\n}","preventionTips":["Only add the sentiment annotator for English pipelines","Branch sentiment calls on document language","Consider external German sentiment models"],"tags":["corenlp","sentiment","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-15T23:17:13.987Z"}