{"record":{"id":"b9daca7b5d2d835d","repo":"stanfordnlp/CoreNLP","slug":"cannot-enable-possequence-features-without-pos-seq","errorCode":null,"errorMessage":"Cannot enable POSSequence features without POS sequence map. Use option -frenchMWMap.","messagePattern":"Cannot enable POSSequence features without POS sequence map\\. Use option -frenchMWMap\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java","lineNumber":482,"sourceCode":"\n  }\n\n  private class AddPOSSequenceFunction implements SerializableFunction<TregexMatcher,String> {\n\n    private final String annotationMark;\n    private final boolean doBasicCat;\n    private final double cutoff;\n\n    public AddPOSSequenceFunction(String annotationMark, int cutoff, boolean basicCategory) {\n      this.annotationMark = annotationMark;\n      doBasicCat = basicCategory;\n      this.cutoff = cutoff;\n    }\n\n\n    public String apply(TregexMatcher m) {\n      if(mwCounter == null)\n        throw new RuntimeException(\"Cannot enable POSSequence features without POS sequence map. Use option -frenchMWMap.\");\n\n      Tree t = m.getMatch();\n      StringBuilder sb = new StringBuilder();\n      for(Tree kid : t.children()) {\n        if( ! kid.isPreTerminal())\n          throw new RuntimeException(\"Not POS sequence for tree: \" + t.toString());\n        String tag = doBasicCat ? tlp.basicCategory(kid.value()) : kid.value();\n        sb.append(tag).append(\" \");\n      }\n\n      if(mwCounter.getCount(t.value(), sb.toString().trim()) > cutoff)\n        return annotationMark + sb.toString().replaceAll(\"\\\\s+\", \"\").toLowerCase();\n      else\n        return \"\";\n    }\n\n    @Override\n    public String toString() {","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java#L464-L500","documentation":"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.","triggerScenarios":"Registering/using the MWTreebankAnnotator / POSSequence annotation function via a Tregex-matched transformation while trainOptions were built without -frenchMWMap (mwCounter stays null).","commonSituations":"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.","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."],"exampleFix":"// before\njava -mx4g edu.stanford.nlp.parser.lexparser.LexicalizedParser -french frenchFactored.ser.gz input.txt\n// after\njava -mx4g edu.stanford.nlp.parser.lexparser.LexicalizedParser -french -frenchMWMap mwMap.txt frenchFactored.ser.gz input.txt","handlingStrategy":"validation","validationCode":"// check options before training/annotation\nif (op.trainOptions.useMWTFeatures && mwCounter == null) {\n    throw new IllegalArgumentException(\"Provide -frenchMWMap option\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair French MWT/POSSequence features with the -frenchMWMap file option","Keep a validated default French training script that includes the map option"],"tags":["parser","french","configuration","runtime-exception"],"backgroundTag":"missing-required-argument","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}