Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.nlp.trees
Class LabeledScoredTreeNode

    java.lang.Object
      java.util.AbstractCollection<Tree>
          edu.stanford.nlp.trees.Tree
              edu.stanford.nlp.trees.LabeledScoredTreeNode

All Implemented Interfaces:
  Label, Labeled, Scored, Serializable, Iterable<Tree>, Collection<Tree>

    public class LabeledScoredTreeNode

extends Tree

A `LabeledScoredTreeNode` represents a tree composed of a root label, a score, and an array of daughter parse trees. A parse tree derived from a rule provides information about the category of the root as well as a composite of the daughter categories.

Author:
  Christopher Manning
See Also:
  Serialized Form

Field Summary

Fields inherited from class edu.stanford.nlp.trees.Tree
`DISPLAY_SCORES, EMPTY_TREE_ARRAY`

Constructor Summary
`LabeledScoredTreeNode()` Create an empty parse tree.
`LabeledScoredTreeNode(Label label, List<Tree> daughterTreesList)` Create parse tree with given root and array of daughter trees.

Method Summary
`Tree[]` | `children()` Returns an array of children for the current node, or null if it is a leaf.
`static TreeFactory` | `factory()` Return a `TreeFactory` that produces trees of the `LabeledScoredTree{Node|Leaf}` type.
`static TreeFactory` | `factory(LabelFactory lf)` Return a `TreeFactory` that produces trees of the `LabeledScoredTree{Node|Leaf}` type, with the `Label` made with the supplied `LabelFactory`.
`Label` | `label()` Returns the label associated with the current node, or null if there is no label
`String` | `nodeString()` Returns the label of a tree node as a String.
`double` | `score()` Returns the score associated with the current node, or Nan if there is no score
`void` | `setChildren(Tree[] children)` Sets the children of this `Tree`.
`void` | `setLabel(Label label)` Sets the label associated with the current node, if there is one.
`void` | `setScore(double score)` Sets the score associated with the current node, if there is one
`StringBuilder` | `toStringBuilder(StringBuilder sb)` Appends the printed form of a parse tree (as a bracketed String) to a `StringBuffer`.
`TreeFactory` | `treeFactory()` Return a `TreeFactory` that produces trees of the same type as the current `Tree`.

Methods inherited from class edu.stanford.nlp.trees.Tree
`addChild, addChild, ancestor, cCommands, constituents, constituents, deepCopy, deepCopy, deeperCopy, deeperCopy, deeperCopy, dependencies, dependencies, dependencies, dependencies, depth, depth, dominates, dominationPath, equals, firstChild, flatten, flatten, getChild, getChildrenAsList, getLeaves, getLeaves, getNodeNumber, getSpan, hashCode, headPreTerminal, headTerminal, headTerminal, indentedListPrint, indentedListPrint, indexLeaves, indexOf, insertDtr, isLeaf, isPhrasal, isPrePreTerminal, isPreTerminal, isUnaryRewrite, iterator, joinNode, labeledYield, labeledYield, labelFactory, labels, lastChild, leftCharEdge, localTree, localTrees, mapDependencies, mapDependencies, nodeNumber, numChildren, parent, parent, pathNodeToNode, pennPrint, pennPrint, pennPrint, pennString, percolateHeads, postOrderNodeList, preOrderNodeList, preTerminalYield, preTerminalYield, printLocalTree, printLocalTree, prune, prune, removeChild, rightCharEdge, setChild, setChildren, setFromString, setLabels, setSpans, setValue, siblings, size, skipRoot, spliceOut, spliceOut, subTreeList, subTrees, subTrees, taggedDependencies, taggedDependencies, taggedDependencies, taggedDependencies, taggedYield, taggedYield, toString, toStructureDebugString, transform, transform, upperMostUnary, value, valueOf, valueOf, yield, yield, yield`

Methods inherited from class java.util.AbstractCollection
`add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LabeledScoredTreeNode

    public LabeledScoredTreeNode()

  Create an empty parse tree.

### LabeledScoredTreeNode

    public LabeledScoredTreeNode(Label label,
                                 List<Tree> daughterTreesList)

  Create parse tree with given root and array of daughter trees.

  Parameters:
    `label` - root label of tree to construct.
    `daughterTreesList` - List of daughter trees to construct.

Method Detail

### children

    public Tree[] children()

  Returns an array of children for the current node, or null if it is a leaf.

  Specified by:
    `children` in class `Tree`
  Returns:
    The children of the node
  See Also:
    `Tree.getChildrenAsList()`

### setChildren

    public void setChildren(Tree[] children)

  Sets the children of this `Tree`. If given `null`, this method prints a warning and sets the Tree's children to the canonical zero-length Tree[] array. Constructing a LabeledScoredTreeLeaf is preferable in this case.

  Overrides:
    `setChildren` in class `Tree`
  Parameters:
    `children` - An array of child trees
  See Also:
    `Tree.setChildren(List)`

### label

    public Label label()

  Returns the label associated with the current node, or null if there is no label

  Specified by:
    `label` in interface `Labeled`
  Overrides:
    `label` in class `Tree`
  Returns:
    The label of the node

### setLabel

    public void setLabel(Label label)

  Sets the label associated with the current node, if there is one.

  Specified by:
    `setLabel` in interface `Labeled`
  Overrides:
    `setLabel` in class `Tree`
  Parameters:
    `label` - The label

### score

    public double score()

  Returns the score associated with the current node, or Nan if there is no score

  Specified by:
    `score` in interface `Scored`
  Overrides:
    `score` in class `Tree`
  Returns:
    The score

### setScore

    public void setScore(double score)

  Sets the score associated with the current node, if there is one

  Overrides:
    `setScore` in class `Tree`
  Parameters:
    `score` - The score

### toStringBuilder

    public StringBuilder toStringBuilder(StringBuilder sb)

  Appends the printed form of a parse tree (as a bracketed String) to a `StringBuffer`.

  Overrides:
    `toStringBuilder` in class `Tree`
  Parameters:
    `sb` - The `StringBuilder` to which the tree will be appended
  Returns:
    StringBuffer returns the `StringBuffer` @param sb

### treeFactory

    public TreeFactory treeFactory()

  Return a `TreeFactory` that produces trees of the same type as the current `Tree`. That is, this implementation, will produce trees of type `LabeledScoredTree(Node|Leaf)`. The `Label` of `this` is examined, and providing it is not `null`, a `LabelFactory` which will produce that kind of `Label` is supplied to the `TreeFactory`. If the `Label` is `null`, a `StringLabelFactory` will be used. The factories returned on different calls a different: a new one is allocated each time.

  Specified by:
    `treeFactory` in class `Tree`
  Returns:
    a factory to produce labeled, scored trees

### factory

    public static TreeFactory factory()

  Return a `TreeFactory` that produces trees of the `LabeledScoredTree{Node|Leaf}` type. The factory returned is always the same one (a singleton).

  Returns:
    a factory to produce labeled, scored trees

### factory

    public static TreeFactory factory(LabelFactory lf)

  Return a `TreeFactory` that produces trees of the `LabeledScoredTree{Node|Leaf}` type, with the `Label` made with the supplied `LabelFactory`. The factory returned is a different one each time

  Parameters:
    `lf` - The LabelFactory to use
  Returns:
    a factory to produce labeled, scored trees

### nodeString

    public String nodeString()

  Description copied from class: `Tree`
  Returns the label of a tree node as a String. This is done by calling `toString()` on the Label, but if the label is `null` or has a `null`, value, then this method returns an empty String.

  Overrides:
    `nodeString` in class `Tree`
  Returns:
    The label of a tree node as a String

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Stanford NLP Group