{"record":{"id":"564001dad79a1420","repo":"stanfordnlp/CoreNLP","slug":"sentiment-analysis-is-not-implemented-for-arabic","errorCode":null,"errorMessage":"Sentiment analysis is not implemented for Arabic","messagePattern":"Sentiment analysis is not implemented for Arabic","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/simple/ArabicDocument.java","lineNumber":83,"sourceCode":"  protected ArabicDocument(Properties props, String text) {\n    super(props, text);\n  }\n\n\n  /**\n   * No lemma annotator for Arabic -- 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 Arabic\");\n  }\n\n\n  @Override\n  protected Document runDepparse(Properties props) {\n    throw new IllegalArgumentException(\"Dependency parsing is not implemented for Arabic\");\n  }\n\n  @Override\n  protected Document runNER(Properties props) {\n    throw new IllegalArgumentException(\"NER is not implemented for Arabic\");\n  }\n\n\n  @Override\n  public Map<Integer, CorefChain> coref(Properties props) {\n    throw new IllegalArgumentException(\"Coreference is not implemented for Arabic\");\n  }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/simple/ArabicDocument.java#L65-L101","documentation":"ArabicDocument (stanford.nlp.simple) does not ship sentiment analysis support for Arabic. Calling runSentiment() — triggered by Document.sentiment(...) on an Arabic document — throws IllegalArgumentException by design, since no Arabic sentiment model is wired into the simple pipeline.","triggerScenarios":"Creating a Document with the Arabic backend/language and calling sentiment() or any pipeline step that internally calls runSentiment(props).","commonSituations":"Running multilingual pipelines where the same code path sentiment-analyzes documents of all languages; assuming Arabic support parity with English in Stanford CoreNLP simple API.","solutions":["Do not call sentiment() on ArabicDocument; skip sentiment for Arabic documents (check the document type first).","Use an English (or other supported-language) document for sentiment analysis.","Integrate an external Arabic sentiment tool and call it directly instead of the CoreNLP simple API."],"exampleFix":"// before\ndoc.sentiment();\n// after\nif (!(doc instanceof ArabicDocument)) {\n  doc.sentiment();\n}","handlingStrategy":"type-guard","validationCode":"if (doc instanceof edu.stanford.nlp.simple.ArabicDocument) skipSentiment = true;","typeGuard":"boolean supportsSentiment(Document doc) { return !(doc instanceof edu.stanford.nlp.simple.ArabicDocument); }","tryCatchPattern":"try {\n  doc.sentiment();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not implemented\")) {\n    log.warn(\"Sentiment unavailable for this language, skipping\");\n  } else throw e;\n}","preventionTips":["Gate language-dependent annotators behind instanceof checks on the Document subclass.","Consult the language's Document class javadoc for unsupported operations before designing the pipeline.","Handle multilingual corpora with per-language pipeline configurations."],"tags":["nlp","unsupported-language","sentiment","arabic"],"backgroundTag":"unsupported-operation","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"}