{"record":{"id":"1c6f6cc4424a0a6e","repo":"stanfordnlp/CoreNLP","slug":"lemmatizing-language-is-not-supported","errorCode":null,"errorMessage":"Lemmatizing ${language} is not supported","messagePattern":"Lemmatizing (.+?) is not supported","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Lemmatize.java","lineNumber":39,"sourceCode":"  public static final String LABEL = \"lemmatize\";\n\n  final String nodeName;\n  final Morphology morphology;\n  final Language language;\n\n  public Lemmatize(String nodeName, Language language) {\n    if (nodeName == null) {\n      throw new SsurgeonParseException(\"Cannot make a Lemmatize with no nodeName\");\n    }\n    this.nodeName = nodeName;\n\n    if (language == Language.UniversalEnglish || language == Language.English) {\n      this.language = Language.English;\n    } else if (language == Language.Unknown) {\n      // log something here?\n      this.language = Language.English;\n    } else {\n      throw new SsurgeonParseException(\"Lemmatizing \" + language + \" is not supported\");\n    }\n\n    this.morphology = new Morphology();\n  }\n\n  @Override\n  public String toEditString() {\n    StringBuilder buf = new StringBuilder();\n    buf.append(LABEL);  buf.append(\"\\t\");\n    buf.append(Ssurgeon.NODENAME_ARG);buf.append(\" \");\n    buf.append(nodeName);\n    return buf.toString();\n  }\n\n  public boolean evaluate(SemanticGraph sg, SemgrexMatcher sm) {\n    IndexedWord word = sm.getNode(nodeName);\n    if (word == null)\n      return false;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Lemmatize.java#L21-L57","documentation":"Ssurgeon's Lemmatize operation only supports English lemmatization. When the Ssurgeon resource file specifies a lemmatize operation with a Language other than English/UniversalEnglish/Unknown, the Lemmatize constructor rejects it. The underlying Morphology tool it wraps is English-only, so other languages cannot be served.","triggerScenarios":"Creating a Lemmatize Ssurgeon operation (e.g. via an Ssurgeon request 'lemmatize' or a resource file line) with language set to any Language enum value other than UniversalEnglish, English, or Unknown, e.g. Language.UniversalGerman or Language.Chinese.","commonSituations":"Copying an Ssurgeon script written for English trees and running it against a treebank annotated in another universal language; programmatic construction passing a language read from a config or CoNLL-U header rather than hardcoding English.","solutions":["Remove the lemmatize operation from the Ssurgeon script or restrict it to English corpora","Change the language argument to Language.UniversalEnglish or Language.English if the input is actually English","Replace the lemmatize step with an operation that does not need Morphology (e.g. a regex over existing features)","Lemmatize the text with a language-appropriate external tool before running Ssurgeon and match on the resulting lemma feature"],"exampleFix":"// before\nnew Lemmatize(Language.UniversalGerman);\n// after\nnew Lemmatize(Language.UniversalEnglish);","handlingStrategy":"validation","validationCode":"if (language != Language.UniversalEnglish && language != Language.English && language != Language.Unknown) {\n  throw new IllegalArgumentException(\"Ssurgeon lemmatize supports only English; got \" + language);\n}","typeGuard":"boolean isLemmatizable(Language l) {\n  return l == Language.UniversalEnglish || l == Language.English || l == Language.Unknown;\n}","tryCatchPattern":"try {\n  op = new Lemmatize(language);\n} catch (SsurgeonParseException e) {\n  log.warn(\"Lemmatize unsupported for this language; skipping operation\", e);\n  op = null;\n}","preventionTips":["Only use lemmatize in Ssurgeon scripts intended for English treebanks","Map non-English corpus language to a non-lemmatize pipeline before Ssurgeon","Centralize language selection in one config constant instead of per-rule values"],"tags":["java","ssurgeon","unsupported-language"],"backgroundTag":"unsupported-operation","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"}