stanfordnlp/CoreNLP · error · UnsupportedOperationException
transform on actions not yet implemented
Error message
transform on actions not yet implemented
What it means
SequencePattern.transform() applies a NodePatternTransformer to the pattern's expression tree, but if the pattern carries an action (SequenceMatchAction) the transformation would lose or mis-handle it, so it throws UnsupportedOperationException ('transform on actions not yet implemented'). It is a declared feature gap, not a misuse error.
Solutions
- Strip or split off the action before transforming; transform only the pattern part and re-attach the action afterward
- Rebuild the pattern from a transformed pattern string that omits the action
- Implement the missing transform support by extending the transformer to carry actions
- Avoid transform() and recompile an equivalent pattern string instead
Example fix
// before
SequencePattern<CoreMap> t = patternWithAction.transform(transformer); // throws
// after
SequencePattern<CoreMap> t = new SequencePattern<>(patternStr,
patternWithAction.getPatternExpr().transform(transformer),
patternWithAction.getAction()); // keep action manually Defensive patterns
Strategy: try-catch
Validate before calling
if (pattern.getAction() != null) {
throw new IllegalArgumentException("Cannot transform a pattern that has an action attached");
} Type guard
boolean isTransformable(SequencePattern<?> p) {
return p.getAction() == null;
} Try / catch
try {
SequencePattern<T2> t = pattern.transform(transformer);
} catch (UnsupportedOperationException e) {
// pattern has an action; handle pattern without transform
} Prevention
- Check getAction() != null before calling transform()
- Split actions off rule strings before programmatic transformation
- Track upstream CoreNLP releases for transform-with-action support
When it happens
Trigger: Calling pattern.transform(transformer) on a SequencePattern that was compiled with an action (e.g. a pattern string with ' :: ' action syntax, so pattern.getAction() != null).
Common situations: Programmatic pattern rewriting of TokensRegex patterns that include side-effect actions like tagging or annotation, common when normalizing or porting rule files.
Related errors
- BackRefPatternExpr.transform not implemented yet!!! Please…
- Unsupported findType
- Cannot evaluate type
- LogPrior.getSigmaSquaredM is undefined for any prior but…
- If you want to ask for the probability, you must train a…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/b81621063d466d18.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/ling/tokensregex/SequencePattern.java:142
nodeSequencePattern = new GroupPatternExpr(nodeSequencePattern, true);
nodeSequencePattern = nodeSequencePattern.optimize();
this.totalGroups = nodeSequencePattern.assignGroupIds(0);
Frag f = nodeSequencePattern.build();
f.connect(MATCH_STATE);
this.root = f.start;
varGroupBindings = new VarGroupBindings(totalGroups+1);
nodeSequencePattern.updateBindings(varGroupBindings);
}
@Override
public String toString() {
return this.pattern();
}
public <T2> SequencePattern<T2> transform(NodePatternTransformer<T,T2> transformer) {
if (action != null) {
throw new UnsupportedOperationException("transform on actions not yet implemented");
}
SequencePattern.PatternExpr transformedPattern = this.patternExpr.transform(transformer);
// TODO: Make string unique by indicating this pattern was transformed
return new SequencePattern<>(this.patternStr, transformedPattern, null);
}
public String pattern() {
return patternStr;
}
protected PatternExpr getPatternExpr() {
return patternExpr;
}
public double getPriority() {
return priority;
}
View on GitHub (pinned to 1b7edd19c4)