stanfordnlp/CoreNLP · error · SsurgeonParseException
Cannot make a Lemmatize with no nodeName
Error message
Cannot make a Lemmatize with no nodeName
What it means
Lemmatize re-lemmatizes the word of a matched node, so it requires the name of a node in the semgrex match. Constructing it with a null nodeName throws SsurgeonParseException. English variants are normalized to Language.English; Unknown falls back per the constructor logic.
Solutions
- Pass the name of a node from the semgrex pattern as nodeName.
- Ensure the -node argument is present in the lemmatize instruction in the rule file.
- Add a null/empty check before constructing Lemmatize and report the rule name for easier debugging.
Example fix
// before
new Lemmatize(null, Language.UniversalEnglish);
// after
new Lemmatize("word", Language.UniversalEnglish); // "word" is a node in the pattern Defensive patterns
Strategy: validation
Validate before calling
// Java
if (nodeName == null || nodeName.isBlank()) {
throw new IllegalArgumentException("lemmatize requires a -node argument naming a matched node");
} Type guard
// Java
static boolean hasNodeName(String nodeName) {
return nodeName != null && !nodeName.isBlank();
} Try / catch
// Java
try {
Lemmatize op = new Lemmatize(nodeName, language);
} catch (SsurgeonParseException e) {
log.severe("Invalid lemmatize rule: " + e.getMessage());
} Prevention
- Ensure every lemmatize instruction in .ssurgeon files carries a -node argument.
- Confirm the node name matches a node captured by the semgrex pattern.
When it happens
Trigger: new Lemmatize(null, language) — e.g. an Ssurgeon lemmatize instruction missing its -node argument, or code passing a variable that was never assigned a matched node name.
Common situations: Hand-written .ssurgeon rules with the node argument dropped; automated rule generation where match-group names come back null.
Related errors
- Cannot make an EditNode with no nodeName
- Cannot combine MWT out of only
- Cannot make an EditNode with no updated attributes, removed…
- Cannot manually change a document ID. If you need an…
- Cannot manually change the sentence index. If you need an…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/050719020c1d4507.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Lemmatize.java:29
/**
* Add the output of the English lemmatizer to the word in question.
* Currently this only supports English! You can add a known lemma
* for a different language by using EditNode and setting the lemma
* attribute
*
* @author John Bauer
*/
public class Lemmatize extends SsurgeonEdit {
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();View on GitHub (pinned to 1b7edd19c4)