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

  1. Add the -node flag with the name of the matched node, e.g. -node splitme, matching a named node in the semgrex pattern
  2. Check the ssurgeon XML/args parsing path actually forwards the node value into the SplitWord constructor
  3. 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

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


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)