{"record":{"id":"7444ca01308f0740","repo":"stanfordnlp/CoreNLP","slug":"not-pos-sequence-for-tree","errorCode":null,"errorMessage":"Not POS sequence for tree: ","messagePattern":"Not POS sequence for tree: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java","lineNumber":488,"sourceCode":"    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() {\n      return \"AddPOSSequenceFunction[\" + annotationMark + ',' + cutoff + ',' + doBasicCat + ']';\n    }\n\n    private static final long serialVersionUID = 1L;\n  }\n","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java#L470-L506","documentation":"Thrown by the same apply method when a Tregex-matched tree contains a child that is not a pre-terminal (POS) node. The POSSequence feature expects the matched node's children to be exactly a sequence of POS-tagged terminals; anything deeper violates the assumed tree shape and aborts annotation.","triggerScenarios":"The Tregex pattern used by the MWT annotation function matches a constituent whose children include non-preterminal subtrees (e.g. nested phrases inside an MWT span) during treebank annotation.","commonSituations":"Running the French multi-word annotation over a treebank whose trees do not match the flat MWT structure the pattern assumes (different treebank style or partially annotated trees).","solutions":["Ensure the input trees are flattened/normalized so MWT matches contain only preterminal children.","Tighten or adjust the Tregex pattern so it only matches flat POS-sequence spans.","Preprocess the treebank with the standard French treebank normalization transforms before annotation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { tree = annotator.apply(matcher); } catch (RuntimeException e) { log.warn(\"Skipping non-flat MWT tree: \" + e.getMessage()); }","preventionTips":["Normalize trees with the standard French treebank transforms before MWT annotation","Validate that MWT spans are flat POS sequences before running the annotator"],"tags":["parser","french","tree-structure","runtime-exception"],"backgroundTag":"invalid-argument-value","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"}