stanfordnlp/CoreNLP · error · RuntimeException
%s: Term lacks morpho analysis: %s
Error message
%s: Term lacks morpho analysis: %s
What it means
When the Arabic treebank params apply tag-level morphosyntactic features, it requires each pre-terminal's leaf label to be a CoreLabel carrying a non-null originalText() that encodes the morphological analysis (tag Spec). If the label is not a CoreLabel or originalText() is null, the tree lacks the morpho analysis the tagSpec expects, so a RuntimeException with the class name and tree is thrown.
Solutions
- Load trees with the Arabic-specific tree reader factory that produces CoreLabels with originalText set to the morphological analysis
- Verify the input treebank lines contain the morpho analyses (the tab-separated analyses field)
- Disable the morphological-feature option if your trees have no morpho analysis
Example fix
// before TreeReaderFactory trf = new LabeledScoredTreeReaderFactory(); // after (use the Arabic params' default reader) TreeReaderFactory trf = params.treeReaderFactory(); // ArabicTreebankParserParams -> ArabicTreeReaderFactory with morpho analyses
Defensive patterns
Strategy: validation
Validate before calling
// before transformTree, check each pre-terminal leaf
for (Tree t : tree.preTerminals()) {
if (!(t.firstChild().label() instanceof CoreLabel)
|| ((CoreLabel) t.firstChild().label()).originalText() == null) {
throw new IllegalArgumentException("Tree lacks morpho analysis at: " + t);
}
} Type guard
function hasMorphoAnalysis(t) {
return t.isPreTerminal() && t.firstChild().label() instanceof CoreLabel
&& ((CoreLabel) t.firstChild().label()).originalText() != null;
} Try / catch
try {
Tree transformed = params.transformTree(t);
} catch (RuntimeException e) {
if (e.getMessage().contains("Term lacks morpho analysis")) {
log.severe("Input trees missing Arabic morpho analyses; reload with Arabic tree reader");
}
throw e;
} Prevention
- Load Arabic trees with ArabicTreebankParserParams' own tree reader factory
- Confirm treebank input lines include the morphological analysis column
- Disable morphological features when using trees from external tools
When it happens
Trigger: Parsing/transforming Arabic trees with morphological tagging enabled (uncaught tagSpec) while the input trees were read with default LabeledScoredTreeReaderFactory so leaves are not CoreLabels, or the reader did not set originalText from the gold morpho analysis column.
Common situations: Training/evaluating the Arabic parser where tree files were loaded without the Arabic custom tree reader that parses the morphological analyses; using tree output from another tool that strips the 'morpho' annotation.
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
- %s: missing tag for %s
- this.getClass().getName() + ": Case is presently unsupported
- Arabic does not support feature type: " + feat.toString()
- : Inconsistent u2b/b2u arrays.
- Word (%s) mapped to null
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/cddcbfbfa17661a5.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/parser/lexparser/ArabicTreebankParserParams.java:250
@Override
public Tree transformTree(Tree t, Tree root) {
String baseCat = t.value();
StringBuilder newCategory = new StringBuilder();
//Add manual state splits
for (Pair<TregexPattern,Function<TregexMatcher,String>> e : activeAnnotations) {
TregexMatcher m = e.first().matcher(root);
if (m.matchesAt(t))
newCategory.append(e.second().apply(m));
}
// WSGDEBUG
//Add morphosyntactic features if this is a POS tag
if(t.isPreTerminal() && tagSpec != null) {
if( !(t.firstChild().label() instanceof CoreLabel) || ((CoreLabel) t.firstChild().label()).originalText() == null )
throw new RuntimeException(String.format("%s: Term lacks morpho analysis: %s",this.getClass().getName(),t.toString()));
String morphoStr = ((CoreLabel) t.firstChild().label()).originalText();
MorphoFeatures feats = tagSpec.strToFeatures(morphoStr);
baseCat = feats.getTag(baseCat);
}
//Update the label(s)
String newCat = baseCat + newCategory;
t.setValue(newCat);
if (t.isPreTerminal() && t.label() instanceof HasTag)
((HasTag) t.label()).setTag(newCat);
return t;
}
/**
* These are the annotations included when the user selects the -arabicFactored option.
*/View on GitHub (pinned to 1b7edd19c4)