stanfordnlp/CoreNLP · error · SsurgeonParseException
Lemmatizing is not supported
Error message
Lemmatizing ${language} is not supported What it means
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.
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
Example fix
// before new Lemmatize(Language.UniversalGerman); // after new Lemmatize(Language.UniversalEnglish);
Defensive patterns
Strategy: validation
Validate before calling
if (language != Language.UniversalEnglish && language != Language.English && language != Language.Unknown) {
throw new IllegalArgumentException("Ssurgeon lemmatize supports only English; got " + language);
} Type guard
boolean isLemmatizable(Language l) {
return l == Language.UniversalEnglish || l == Language.English || l == Language.Unknown;
} Try / catch
try {
op = new Lemmatize(language);
} catch (SsurgeonParseException e) {
log.warn("Lemmatize unsupported for this language; skipping operation", e);
op = null;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot combine MWT out of only
- Cannot make a KillAllIncomingEdges out of " +…
- Cannot make a Lemmatize with no nodeName
- Cannot make a MergeNodes out of fewer than 2 nodes (got " +…
- Cannot make an EditNode with no nodeName
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/1c6f6cc4424a0a6e.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Lemmatize.java:39
public static final String LABEL = "lemmatize";
final String nodeName;
final Morphology morphology;
final Language language;
public Lemmatize(String nodeName, Language language) {
if (nodeName == null) {
throw new SsurgeonParseException("Cannot make a Lemmatize with no nodeName");
}
this.nodeName = nodeName;
if (language == Language.UniversalEnglish || language == Language.English) {
this.language = Language.English;
} else if (language == Language.Unknown) {
// log something here?
this.language = Language.English;
} else {
throw new SsurgeonParseException("Lemmatizing " + language + " is not supported");
}
this.morphology = new Morphology();
}
@Override
public String toEditString() {
StringBuilder buf = new StringBuilder();
buf.append(LABEL); buf.append("\t");
buf.append(Ssurgeon.NODENAME_ARG);buf.append(" ");
buf.append(nodeName);
return buf.toString();
}
public boolean evaluate(SemanticGraph sg, SemgrexMatcher sm) {
IndexedWord word = sm.getNode(nodeName);
if (word == null)
return false;View on GitHub (pinned to 1b7edd19c4)