stanfordnlp/CoreNLP · warning

: Bare tagged word

Error message

%s: Bare tagged word %s

What it means

ArabicTreeNormalizer.normalizeWholeTree logs a warning when a tree node is a bare preterminal (a tagged word with no phrasal projection). For CC, CONJ, or PUNC.* labels it auto-wraps the node in a synthetic FRAG node; for any other bare tag it only warns, leaving the tree unchanged.

Solutions

  1. Ensure Arabic treebank trees have a full phrase structure with a TOP-level phrasal node above every tagged word
  2. Pre-wrap bare tagged words in an appropriate phrase node (or FRAG) before normalization
  3. Check the segmentation/parsing pipeline step that produced the single-word tree; a tokenizer bug often drops the PP/S wrapper
  4. If FRAG wrapping is acceptable, relabel the bare node as CC/CONJ/PUNC so the normalizer wraps it automatically, or extend the normalizer condition

Example fix

// before
Tree t = tf.newTreeNode("PREP", Collections.singletonList(tf.newLeaf("in")));
new ArabicTreeNormalizer().normalizeWholeTree(t, tf);
// after
Tree t = tf.newTreeNode("PP", Collections.singletonList(tf.newTreeNode("PREP", Collections.singletonList(tf.newLeaf("in")))));
Defensive patterns

Strategy: validation

Validate before calling

static boolean isBareTag(Tree t) {
  return t.isPreTerminal() || (t.children().length == 1 && t.children()[0].isPreTerminal());
}
if (isBareTag(tree)) tree = tf.newTreeNode("FRAG", Collections.singletonList(tree));

Type guard

static boolean hasPhraseProjection(Tree t) {
  return t != null && !t.isPreTerminal() && t.children().length > 0 && !t.children()[0].isPreTerminal();
}

Prevention

When it happens

Trigger: Calling normalizeWholeTree (or normalize via a tree reader) on a parsed tree whose root or subtree consists of a single tagged word with no internal phrase node — e.g. a tokenized single word 'in/PREP' instead of '(PP (PREP in))'.

Common situations: Feeding PTB-style single-token outputs of a segmenter into the Arabic parser; treebank files with degenerate one-word trees; manual preprocessing scripts that stripped phrase-level nodes; corrupted treebank entries where internal nodes were lost.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/6090a5a7b9a5f0cf. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/trees/international/arabic/ArabicTreeNormalizer.java:220

    }

    //Mark *only* subjects in verb-initial clauses
    if(retainNPSbj) {
      TregexMatcher m = npSbjPattern.matcher(tree);
      while (m.find()) {
        Tree match = m.getMatch();
        match.label().setValue("NP");
      }
    }

    if (tree.isPreTerminal()) {
      // The whole tree is a bare tag: bad!
      String val = tree.label().value();
      if (val.equals("CC") || val.startsWith("PUNC") || val.equals("CONJ")) {
        log.warn(String.format("%s: Bare tagged word being wrapped in FRAG %s", this.getClass().getName(),tree.pennString()));
        tree = tf.newTreeNode("FRAG", Collections.singletonList(tree));
      } else {
        log.warn(String.format("%s: Bare tagged word %s", this.getClass().getName(), tree.pennString()));
      }
    }

    //Add start symbol so that the root has only one sub-state. Escape any enclosing brackets.
    //If the "tree" consists entirely of enclosing brackets e.g. ((())) then this method
    //will return null. In this case, readers e.g. PennTreeReader will try to read the next tree.
    while (tree != null && (tree.value() == null || tree.value().isEmpty()) && tree.numChildren() <= 1) {
      tree = tree.firstChild();
    }

    if (tree != null && !tree.value().equals(rootLabel)) {
      tree = tf.newTreeNode(rootLabel, Collections.singletonList(tree));
    }

    return tree;
  }

View on GitHub (pinned to 1b7edd19c4)