{"record":{"id":"c5c1c57476f39391","repo":"stanfordnlp/CoreNLP","slug":"s-term-lacks-morpho-analysis-s-c5c1c5","errorCode":null,"errorMessage":"%s: Term lacks morpho analysis: %s","messagePattern":"(.+?): Term lacks morpho analysis: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java","lineNumber":590,"sourceCode":"    return (readPennFormat) ? new FrenchTreeReaderFactory() : new FrenchXMLTreeReaderFactory(false);\n  }\n\n  public List<HasWord> defaultTestSentence() {\n    String[] sent = {\"Ceci\", \"est\", \"seulement\", \"un\", \"test\", \".\"};\n    return SentenceUtils.toWordList(sent);\n  }\n\n  @Override\n  public Tree transformTree(Tree t, Tree root) {\n    // Perform tregex-powered annotations\n    t = super.transformTree(t, root);\n\n    String cat = t.value();\n\n    //Add morphosyntactic features if this is a POS tag\n    if(t.isPreTerminal() && tagSpec != null) {\n      if( !(t.firstChild().label() instanceof CoreLabel) || ((CoreLabel) t.firstChild().label()).originalText() == null )\n        throw new RuntimeException(String.format(\"%s: Term lacks morpho analysis: %s\",this.getClass().getName(),t.toString()));\n\n      String morphoStr = ((CoreLabel) t.firstChild().label()).originalText();\n      Pair<String,String> lemmaMorph = MorphoFeatureSpecification.splitMorphString(\"\", morphoStr);\n      MorphoFeatures feats = tagSpec.strToFeatures(lemmaMorph.second());\n      cat = feats.getTag(cat);\n    }\n\n    //Update the label(s)\n    t.setValue(cat);\n    if (t.isPreTerminal() && t.label() instanceof HasTag)\n      ((HasTag) t.label()).setTag(cat);\n\n    return t;\n  }\n\n\n  private void loadMWMap(String filename) {\n    mwCounter = new TwoDimensionalCounter<>();","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/parser/lexparser/FrenchTreebankParserParams.java#L572-L608","documentation":"transformTree adds morphosyntactic features to POS tags, but only if the terminal's label is a CoreLabel carrying a non-null originalText holding the morpho analysis string (lemma+morph separated by the morph separator). If the tag spec is active yet the leaf lacks that analysis, the parser cannot derive features and throws with the offending tree.","triggerScenarios":"Parsing/training with -tagPairedMorphoFeatures (or equivalent tagSpec) while the input trees' terminals were not annotated with morpho strings via a MorphoTreeTransformer / -morphoFile preprocessing step.","commonSituations":"Feeding raw French treebank trees to a morphologically annotated model, or forgetting the morpho annotation pass so originalText is null on the leaves.","solutions":["Run the morpho annotation pass (MorphoTreeTransformer with -morphoFile) on the trees before transformTree.","Ensure leaves are CoreLabels that preserve originalText (label annotations must not be stripped).","Disable the morpho feature option (tagSpec) if no morphological analysis is available."],"exampleFix":"// before\nLexicalizedParser.parseTrees(op.tlpParams, trees) // trees lack morpho annotation\n// after\nMorphoTreeTransformer mt = new MorphoTreeTransformer(morphSpec);\nList<Tree> annotated = trees.stream().map(mt::transformTree).collect(Collectors.toList());","handlingStrategy":"validation","validationCode":"for (Tree t : trees) {\n    for (Tree leaf : t.getLeaves()) {\n        if (!(leaf.label() instanceof CoreLabel) || ((CoreLabel) leaf.label()).originalText() == null)\n            throw new IllegalStateException(\"Leaf lacks morpho analysis: \" + leaf);\n    }\n}","typeGuard":null,"tryCatchPattern":"try { tree = params.transformTree(tree); } catch (RuntimeException e) { log.error(e.getMessage()); throw e; }","preventionTips":["Run the MorphoTreeTransformer (-morphoFile) before training/parsing with morpho features","Use CoreLabel factories so originalText survives preprocessing"],"tags":["parser","morphology","french","missing-annotation"],"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"}