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 LabeledScoredTreeLeaf

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

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

Direct Known Subclasses:
  EmptyTreeLeaf

    public class LabeledScoredTreeLeaf

extends Tree

A `LabeledScoredTreeLeaf` represents the leaf of a tree in a parse tree with labels and scores.

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
`LabeledScoredTreeLeaf()` Create an empty leaf parse tree with an empty word.
`LabeledScoredTreeLeaf(Label label)` Create a leaf parse tree with given word.
`LabeledScoredTreeLeaf(Label label, double score)` Create a leaf parse tree with given word and score.

Method Summary
`void` | `addChild(int i, Tree t)` Leaves have no children.
`void` | `addChild(Tree t)` Leaves have no children.
`Tree[]` | `children()` Leaves have no children.
`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`.
`void` | `insertDtr(Tree dtr, int position)` Leaves have no children.
`boolean` | `isLeaf()` Indicates that `this` is a leaf.
`Label` | `label()` Returns the label associated with the current node.
`double` | `score()` Returns the node's score.
`Tree` | `setChild(int i, Tree t)` Leaves have no children.
`void` | `setChildren(Tree[] children)` Leaves have no children.
`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.
`String` | `toString()` Convert tree leaf to its label's string.
`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
`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, isPhrasal, isPrePreTerminal, isPreTerminal, isUnaryRewrite, iterator, joinNode, labeledYield, labeledYield, labelFactory, labels, lastChild, leftCharEdge, localTree, localTrees, mapDependencies, mapDependencies, nodeNumber, nodeString, numChildren, parent, parent, pathNodeToNode, pennPrint, pennPrint, pennPrint, pennString, percolateHeads, postOrderNodeList, preOrderNodeList, preTerminalYield, preTerminalYield, printLocalTree, printLocalTree, prune, prune, removeChild, rightCharEdge, setChildren, setFromString, setLabels, setSpans, setValue, siblings, size, skipRoot, spliceOut, spliceOut, subTreeList, subTrees, subTrees, taggedDependencies, taggedDependencies, taggedDependencies, taggedDependencies, taggedYield, taggedYield, 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

### LabeledScoredTreeLeaf

    public LabeledScoredTreeLeaf()

  Create an empty leaf parse tree with an empty word.

### LabeledScoredTreeLeaf

    public LabeledScoredTreeLeaf(Label label)

  Create a leaf parse tree with given word.

  Parameters:
    `label` - the `Label` representing the word for this new tree leaf.

### LabeledScoredTreeLeaf

    public LabeledScoredTreeLeaf(Label label,
                                 double score)

  Create a leaf parse tree with given word and score.

  Parameters:
    `label` - The `Label` representing the word for
    `score` - The score for the node this new tree leaf.

Method Detail

### isLeaf

    public boolean isLeaf()

  Indicates that `this` is a leaf. CHRIS: is adding this actually a speed-up or a slowdown? Check!

  Overrides:
    `isLeaf` in class `Tree`
  Returns:
    Whether this is a leaf node

### children

    public Tree[] children()

  Leaves have no children.

  Specified by:
    `children` in class `Tree`
  Returns:
    `a unique zero-length Tree[]`
  See Also:
    `Tree.getChildrenAsList()`

### setChildren

    public void setChildren(Tree[] children)

  Leaves have no children. Returns an `UnsupportedOperationException`

  Overrides:
    `setChildren` in class `Tree`
  Parameters:
    `children` - The children for the node
  See Also:
    `Tree.setChildren(List)`

### toString

    public String toString()

  Convert tree leaf to its label's string.

  Specified by:
    `toString` in interface `Label`
  Overrides:
    `toString` in class `Tree`
  Returns:
    Node's label in String form

### 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`

### label

    public Label label()

  Returns the label associated with the current node.

  Specified by:
    `label` in interface `Labeled`
  Overrides:
    `label` in class `Tree`
  Returns:
    The label associated with the current node, or `null` if there is no label

### 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 of the node

### score

    public double score()

  Returns the node's score.

  Specified by:
    `score` in interface `Scored`
  Overrides:
    `score` in class `Tree`
  Returns:
    The score associated with the current node, or NaN if there is no 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` - Score of node

### insertDtr

    public void insertDtr(Tree dtr,
                          int position)

  Leaves have no children. Returns an `UnsupportedOperationException`

  Overrides:
    `insertDtr` in class `Tree`

### addChild

    public void addChild(int i,
                         Tree t)

  Leaves have no children. Returns an `UnsupportedOperationException`

  Overrides:
    `addChild` in class `Tree`
  Parameters:
    `i` - the index position at which to add the new daughter
    `t` - the new daughter

### addChild

    public void addChild(Tree t)

  Leaves have no children. Returns an `UnsupportedOperationException`

  Overrides:
    `addChild` in class `Tree`
  Parameters:
    `t` - the new daughter

### setChild

    public Tree setChild(int i,
                         Tree t)

  Leaves have no children. Returns an `UnsupportedOperationException`

  Overrides:
    `setChild` in class `Tree`
  Parameters:
    `i` - The index position at which to replace the child
    `t` - The new child
  Returns:
    The tree that was previously the ith d

### 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

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