stanfordnlp/CoreNLP · error · SsurgeonParseException
SplitWord expected a -reln to represent the dependency to…
Error message
SplitWord expected a -reln to represent the dependency to use for the new words
What it means
The new words produced by a SplitWord operation must be connected by a grammatical relation; this is supplied via the -reln flag as a GrammaticalRelation. If relation is null after the headIndex check, the constructor throws SsurgeonParseException.
Solutions
- Add a valid -reln flag, e.g. -reln dep or -reln compound, matching a Universal Dependencies relation name
- Ensure GrammaticalRelation.valueOf for your relation name returns non-null before constructing SplitWord
- Pass an explicit GrammaticalRelation instance as the fourth constructor argument
Example fix
// before
new SplitWord("w", pieces, 0, null, null, true);
// after
new SplitWord("w", pieces, 0, UniversalEnglishGrammaticalRelations.DEPENDENT, null, true); Defensive patterns
Strategy: validation
Validate before calling
GrammaticalRelation reln = GrammaticalRelation.valueOf(lang, relnName);
if (reln == null) throw new IllegalArgumentException("-reln did not resolve to a GrammaticalRelation: " + relnName); Try / catch
try { SplitWord sw = new SplitWord(node, pieces, headIndex, reln, names, exact); } catch (SsurgeonParseException e) { log.error("Missing -reln: " + e.getMessage()); } Prevention
- Always pass -reln with a valid UD relation name
- Resolve the relation name via GrammaticalRelation.valueOf before constructing
- Use IDE constants (e.g. UniversalEnglishGrammaticalRelations) instead of raw strings in Java code
When it happens
Trigger: Constructing SplitWord without -reln (or with a null GrammaticalRelation as the fourth constructor argument), such as when the relation name could not be resolved by GrammaticalRelation.valueOf.
Common situations: Omitting -reln in the ssurgeon rule; passing an invalid relation string so the parser yields null; building the operation in Java and forgetting the relation argument.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- SplitWord expected -node with the name of the matched node…
- SplitWord expected -exact or -regex with regex to determine…
- SplitWord expected a -headIndex, 0-indexed for the word…
- Unknown position in AddDep operation
- No governor given for an AddDep
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/29318ff5802ececa.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/SplitWord.java:77
}
if (exactSplit) {
this.exactPieces = new ArrayList<>(nodePieces);
this.nodeRegex = null;
} else {
this.nodeRegex = new ArrayList<>();
for (int i = 0; i < nodePieces.size(); ++i) {
this.nodeRegex.add(Pattern.compile(nodePieces.get(i)));
}
this.exactPieces = null;
}
if (headIndex == null) {
throw new SsurgeonParseException("SplitWord expected a -headIndex, 0-indexed for the word piece to use when chopping up the word");
}
this.headIndex = headIndex;
if (relation == null) {
throw new SsurgeonParseException("SplitWord expected a -reln to represent the dependency to use for the new words");
}
this.relation = relation;
if (nodeNames != null) {
String[] namePieces = nodeNames.split(",");
this.nodeNames = new HashMap<>();
for (String namePiece : namePieces) {
String[] pieces = namePiece.split("=", 2);
if (pieces.length < 2) {
throw new SsurgeonParseException("SplitWord got a -name parameter which did not have a number for one of the names. Should look like 0=foo,1=bar");
}
int idx = Integer.valueOf(pieces[0]);
if (idx >= nodePieces.size()) {
throw new SsurgeonParseException("SplitWord got an index in -name which was larger than the largest possible split piece, " + idx + " (this is 0-indexed)");
}
this.nodeNames.put(idx, pieces[1]);
}
} else {View on GitHub (pinned to 1b7edd19c4)