{"record":{"id":"6090a5a7b9a5f0cf","repo":"stanfordnlp/CoreNLP","slug":"s-bare-tagged-word-s","errorCode":null,"errorMessage":"%s: Bare tagged word %s","messagePattern":"(.+?): Bare tagged word (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/trees/international/arabic/ArabicTreeNormalizer.java","lineNumber":220,"sourceCode":"    }\n\n    //Mark *only* subjects in verb-initial clauses\n    if(retainNPSbj) {\n      TregexMatcher m = npSbjPattern.matcher(tree);\n      while (m.find()) {\n        Tree match = m.getMatch();\n        match.label().setValue(\"NP\");\n      }\n    }\n\n    if (tree.isPreTerminal()) {\n      // The whole tree is a bare tag: bad!\n      String val = tree.label().value();\n      if (val.equals(\"CC\") || val.startsWith(\"PUNC\") || val.equals(\"CONJ\")) {\n        log.warn(String.format(\"%s: Bare tagged word being wrapped in FRAG %s\", this.getClass().getName(),tree.pennString()));\n        tree = tf.newTreeNode(\"FRAG\", Collections.singletonList(tree));\n      } else {\n        log.warn(String.format(\"%s: Bare tagged word %s\", this.getClass().getName(), tree.pennString()));\n      }\n    }\n\n    //Add start symbol so that the root has only one sub-state. Escape any enclosing brackets.\n    //If the \"tree\" consists entirely of enclosing brackets e.g. ((())) then this method\n    //will return null. In this case, readers e.g. PennTreeReader will try to read the next tree.\n    while (tree != null && (tree.value() == null || tree.value().isEmpty()) && tree.numChildren() <= 1) {\n      tree = tree.firstChild();\n    }\n\n    if (tree != null && !tree.value().equals(rootLabel)) {\n      tree = tf.newTreeNode(rootLabel, Collections.singletonList(tree));\n    }\n\n    return tree;\n  }\n\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/international/arabic/ArabicTreeNormalizer.java#L202-L238","documentation":"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.","triggerScenarios":"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))'.","commonSituations":"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.","solutions":["Ensure Arabic treebank trees have a full phrase structure with a TOP-level phrasal node above every tagged word","Pre-wrap bare tagged words in an appropriate phrase node (or FRAG) before normalization","Check the segmentation/parsing pipeline step that produced the single-word tree; a tokenizer bug often drops the PP/S wrapper","If FRAG wrapping is acceptable, relabel the bare node as CC/CONJ/PUNC so the normalizer wraps it automatically, or extend the normalizer condition"],"exampleFix":"// before\nTree t = tf.newTreeNode(\"PREP\", Collections.singletonList(tf.newLeaf(\"in\")));\nnew ArabicTreeNormalizer().normalizeWholeTree(t, tf);\n// after\nTree t = tf.newTreeNode(\"PP\", Collections.singletonList(tf.newTreeNode(\"PREP\", Collections.singletonList(tf.newLeaf(\"in\")))));","handlingStrategy":"validation","validationCode":"static boolean isBareTag(Tree t) {\n  return t.isPreTerminal() || (t.children().length == 1 && t.children()[0].isPreTerminal());\n}\nif (isBareTag(tree)) tree = tf.newTreeNode(\"FRAG\", Collections.singletonList(tree));","typeGuard":"static boolean hasPhraseProjection(Tree t) {\n  return t != null && !t.isPreTerminal() && t.children().length > 0 && !t.children()[0].isPreTerminal();\n}","tryCatchPattern":null,"preventionTips":["Validate treebank trees are full parse trees (no bare preterminal roots) before running the normalizer","Run a pre-pass that wraps single-token trees in FRAG or the right phrase category","Log and inspect any trees your upstream segmenter/parser emits with only two levels"],"tags":["nlp","parsing","treebank","arabic"],"backgroundTag":"schema-validation-failed","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}