stanfordnlp/CoreNLP · error · RuntimeException
Cannot enable POSSequence features without POS sequence map.
Error message
Cannot enable POSSequence features without POS sequence map. Use option -frenchMWMap.
What it means
This RuntimeException from FrenchTreebankParserParams.MWTAnnotatingFunction.apply means POS-sequence feature annotation was requested, but the multi-word-expression counter (mwCounter) was never loaded. The counter is only populated when the -frenchMWMap option supplies a POS sequence map, so annotation of French multi-word terminals cannot proceed without it. The library throws eagerly rather than silently producing unannotated features.
Solutions
- Add the -frenchMWMap option pointing at a valid POS sequence map file when invoking the parser/trainer.
- Verify the annotation feature that requires POSSequence is actually intended; disable it if the map is unavailable.
- Load the mwCounter programmatically (setFrenchMWMap path) before running the annotating function.
Example fix
// before java -mx4g edu.stanford.nlp.parser.lexparser.LexicalizedParser -french frenchFactored.ser.gz input.txt // after java -mx4g edu.stanford.nlp.parser.lexparser.LexicalizedParser -french -frenchMWMap mwMap.txt frenchFactored.ser.gz input.txt
Defensive patterns
Strategy: validation
Validate before calling
// check options before training/annotation
if (op.trainOptions.useMWTFeatures && mwCounter == null) {
throw new IllegalArgumentException("Provide -frenchMWMap option");
} Prevention
- Always pair French MWT/POSSequence features with the -frenchMWMap file option
- Keep a validated default French training script that includes the map option
When it happens
Trigger: Registering/using the MWTreebankAnnotator / POSSequence annotation function via a Tregex-matched transformation while trainOptions were built without -frenchMWMap (mwCounter stays null).
Common situations: Training or parsing French trees with the -frenchMWMap-dependent annotation pipeline enabled but the map file option omitted from the command line or Options setup.
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
- Not POS sequence for tree:
- Error initializing coref system
- Not a valid ellipses style:
- Invalid value for useUnknownWordSignatures:
- %s: Term lacks morpho analysis: %s
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/b9daca7b5d2d835d.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java:482
}
private class AddPOSSequenceFunction implements SerializableFunction<TregexMatcher,String> {
private final String annotationMark;
private final boolean doBasicCat;
private final double cutoff;
public AddPOSSequenceFunction(String annotationMark, int cutoff, boolean basicCategory) {
this.annotationMark = annotationMark;
doBasicCat = basicCategory;
this.cutoff = cutoff;
}
public String apply(TregexMatcher m) {
if(mwCounter == null)
throw new RuntimeException("Cannot enable POSSequence features without POS sequence map. Use option -frenchMWMap.");
Tree t = m.getMatch();
StringBuilder sb = new StringBuilder();
for(Tree kid : t.children()) {
if( ! kid.isPreTerminal())
throw new RuntimeException("Not POS sequence for tree: " + t.toString());
String tag = doBasicCat ? tlp.basicCategory(kid.value()) : kid.value();
sb.append(tag).append(" ");
}
if(mwCounter.getCount(t.value(), sb.toString().trim()) > cutoff)
return annotationMark + sb.toString().replaceAll("\\s+", "").toLowerCase();
else
return "";
}
@Override
public String toString() {View on GitHub (pinned to 1b7edd19c4)