stanfordnlp/CoreNLP · error · UnsupportedOperationException
BackRefPatternExpr.transform not implemented yet!!! Please…
Error message
BackRefPatternExpr.transform not implemented yet!!! Please implement me!!!
What it means
BackRefPatternExpr.transform() is an explicitly unfinished feature: applying a NodePatternTransformer to a back-reference expression throws UnsupportedOperationException with the 'Please implement me!!!' message. Back-references depend on capture group ids that a transformer cannot currently remap, so it is deliberately unimplemented.
Solutions
- Avoid transform() on patterns containing back references; reconstruct the transformed pattern manually
- Split the pattern: transform sub-patterns without back refs and keep back-ref nodes as-is
- Implement the override: return new BackRefPatternExpr(transformed matcher, captureGroupId) once transformer supports NodesMatchChecker
- Recompile the whole pattern from a rewritten string instead of using transform()
Example fix
// before PatternExpr t = backRefExpr.transform(transformer); // throws // after PatternExpr t = new BackRefPatternExpr(matcher, backRefExpr.captureGroupId); // rebuild unchanged
Defensive patterns
Strategy: try-catch
Validate before calling
// detect back-ref nodes before transforming
boolean hasBackRef = patternContainsBackRef(pattern); // walk patternExpr tree checking for BackRefPatternExpr
if (hasBackRef) throw new IllegalArgumentException("Cannot transform patterns with back references"); Try / catch
try {
PatternExpr t = expr.transform(transformer);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("BackRefPatternExpr")) {
// keep original expr or rebuild manually
}
} Prevention
- Skip or special-case BackRefPatternExpr nodes in transformer pipelines
- Detect back references (\N) in pattern strings before transforming
- Recompile transformed patterns from strings rather than calling transform() on back-ref-containing trees
When it happens
Trigger: Calling transform() on a pattern whose expression tree contains a BackRefPatternExpr, i.e. any pattern using \N back references (e.g. TokensRegex '[ { word: /a/ } ] \1').
Common situations: Pattern rewriting/normalization pipelines that traverse all pattern expressions and hit back-reference nodes; common when transforming rule sets or converting node pattern types.
Related errors
- transform on actions not yet implemented
- 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/01e4e46be7f98b28.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/ling/tokensregex/SequencePattern.java:583
}
@Override
protected int assignGroupIds(int start) {
return start;
}
@Override
protected void updateBindings(VarGroupBindings bindings) {}
@Override
protected PatternExpr copy()
{
return new BackRefPatternExpr(matcher, captureGroupId);
}
@Override
protected PatternExpr transform(NodePatternTransformer transformer) {
// TODO: Implement me!!!
throw new UnsupportedOperationException("BackRefPatternExpr.transform not implemented yet!!! Please implement me!!!");
}
public String toString() {
StringBuilder sb = new StringBuilder();
if (captureGroupId >= 0) {
sb.append('\\').append(captureGroupId);
} else {
sb.append('\\');
}
sb.append('{').append(matcher).append('}');
return sb.toString();
}
}
public static class ValuePatternExpr extends PatternExpr {
private final PatternExpr expr;
private final Object value;View on GitHub (pinned to 1b7edd19c4)