public class LabeledScoredTreeNode extends Tree
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.EMPTY_TREE_ARRAY
Constructor and Description |
---|
LabeledScoredTreeNode()
Create an empty parse tree.
|
LabeledScoredTreeNode(Label label)
Create a leaf parse tree with given word.
|
LabeledScoredTreeNode(Label label,
double score)
Create a leaf parse tree with given word and score.
|
LabeledScoredTreeNode(Label label,
java.util.List<Tree> daughterTreesList)
Create parse tree with given root and array of daughter trees.
|
Modifier and Type | Method and Description |
---|---|
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
|
java.lang.String |
nodeString()
Returns the value of the node's label 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
|
TreeFactory |
treeFactory()
Return a
TreeFactory that produces trees of the
same type as the current Tree . |
addChild, addChild, ancestor, cCommands, constituents, constituents, constituents, constituents, constituents, deepCopy, deepCopy, deepCopy, dependencies, dependencies, dependencies, depth, depth, dominates, dominationPath, equals, firstChild, flatten, flatten, getChild, getChildrenAsList, getLeaves, getLeaves, getNodeNumber, getSpan, hashCode, headPreTerminal, headTerminal, headTerminal, indentedListPrint, indentedListPrint, indentedXMLPrint, indentedXMLPrint, indexLeaves, indexLeaves, indexLeaves, indexSpans, indexSpans, indexSpans, insertDtr, isBinarized, isBinary, isLeaf, isPhrasal, isPrePreTerminal, isPreTerminal, isUnaryRewrite, iterator, joinNode, labeledYield, labeledYield, labelFactory, labels, lastChild, leftCharEdge, localTree, localTrees, mapDependencies, mapDependencies, nodeNumber, numChildren, objectIndexOf, parent, parent, pathNodeToNode, pennPrint, pennPrint, pennPrint, pennPrint, pennPrint, pennString, percolateHeadAnnotations, percolateHeadIndices, percolateHeads, postOrderNodeList, preOrderNodeList, preTerminalYield, preTerminalYield, printLocalTree, printLocalTree, prune, prune, removeChild, rightCharEdge, setChild, setChildren, setFromString, setLabels, setSpans, setValue, siblings, size, skipRoot, spanString, spliceOut, spliceOut, subTreeList, subTrees, subTrees, taggedLabeledYield, taggedYield, taggedYield, toString, toStringBuilder, toStringBuilder, transform, transform, treeSkeletonConstituentCopy, treeSkeletonConstituentCopy, treeSkeletonCopy, treeSkeletonCopy, updateBrackets, upperMostUnary, value, valueOf, valueOf, yield, yield, yield, yieldHasWord, yieldHasWord, yieldWords, yieldWords
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
public LabeledScoredTreeNode()
public LabeledScoredTreeNode(Label label)
label
- the Label
representing the word for
this new tree leaf.public LabeledScoredTreeNode(Label label, double score)
label
- The Label
representing the word forscore
- The score for the node
this new tree leaf.public Tree[] children()
children
in class Tree
Tree.getChildrenAsList()
public void setChildren(Tree[] children)
Tree
. If given
null
, this method sets the Tree's children to
the canonical zero-length Tree[] array.setChildren
in class Tree
children
- An array of child treesTree.setChildren(List)
public Label label()
public void setLabel(Label label)
public double score()
public void setScore(double score)
public TreeFactory treeFactory()
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.treeFactory
in class Tree
public static TreeFactory factory()
TreeFactory
that produces trees of the
LabeledScoredTree{Node|Leaf}
type.
The factory returned is always the same one (a singleton).public static TreeFactory factory(LabelFactory lf)
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 timelf
- The LabelFactory to usepublic java.lang.String nodeString()
Tree
toString()
on the value, if it exists. Otherwise,
an empty string is returned.nodeString
in class Tree