stanfordnlp/CoreNLP · error · SsurgeonParseException
SplitWord expected -node with the name of the matched node…
Error message
SplitWord expected -node with the name of the matched node to split
What it means
The SplitWord constructor requires the name of a semgrex-matched node to split, passed as the 'node' parameter (from the -node flag). If it is null, SsurgeonParseException is thrown at construction time — no graph edit is attempted.
Solutions
- Add the -node flag with the name of the matched node, e.g. -node splitme, matching a named node in the semgrex pattern
- Check the ssurgeon XML/args parsing path actually forwards the node value into the SplitWord constructor
- In custom code, pass the same node name used in the semgrex pattern
Example fix
// before
SplitWord sw = new SplitWord(null, pieces, 0, reln, null, true);
// after
SplitWord sw = new SplitWord("target", pieces, 0, reln, null, true); // 'target' is a named semgrex node Defensive patterns
Strategy: validation
Validate before calling
if (node == null || node.isEmpty()) throw new IllegalArgumentException("SplitWord requires -node with a matched node name"); Try / catch
try { SplitWord sw = new SplitWord(node, pieces, headIndex, reln, names, exact); } catch (SsurgeonParseException e) { log.error("Bad SplitWord spec: " + e.getMessage()); } Prevention
- Always pass the -node flag naming a node from the semgrex pattern
- Validate ssurgeon XML rules against the expected SplitWord attributes before running
- Construct SplitWord objects via a builder/helper that enforces required fields
When it happens
Trigger: Building a SplitWord ssurgeon operation (programmatically or via Ssurgeon.fromXML) without supplying the -node argument, or supplying it with a null/empty value.
Common situations: Hand-editing an ssurgeon XML rule and dropping the -node attribute; constructing SplitWord directly in Java with null as the first argument; a parser that fails to read the -node flag from the command line.
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 -exact or -regex with regex to determine…
- SplitWord expected a -headIndex, 0-indexed for the word…
- SplitWord expected a -reln to represent the dependency to…
- 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/5f3a672bbdbc5e88.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/SplitWord.java:50
* splitWord -node split -regex ^(foo)bar$ -regex ^foo(bar)$ -reln dep -headIndex 1 -name 0=asdf
* editNode -node asdf -pos ADJ
* </pre>
*
* @author John Bauer
*/
public class SplitWord extends SsurgeonEdit {
public static final String LABEL = "splitWord";
final String node;
final List<Pattern> nodeRegex;
final List<String> exactPieces;
final int headIndex;
final GrammaticalRelation relation;
final Map<Integer, String> nodeNames;
public SplitWord(String node, List<String> nodePieces, Integer headIndex, GrammaticalRelation relation, String nodeNames, boolean exactSplit) {
if (node == null) {
throw new SsurgeonParseException("SplitWord expected -node with the name of the matched node to split");
}
this.node = node;
if (nodePieces == null || nodePieces.size() == 0) {
throw new SsurgeonParseException("SplitWord expected -exact or -regex with regex to determine which pieces to split the word into");
}
if (nodePieces.size() == 1) {
throw new SsurgeonParseException("SplitWord expected at least two -exact or -regex");
}
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;View on GitHub (pinned to 1b7edd19c4)