|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
edu.stanford.nlp.trees.Tree
edu.stanford.nlp.trees.LabeledScoredTreeLeaf
public class LabeledScoredTreeLeaf
A LabeledScoredTreeLeaf
represents the leaf of a tree
in a parse tree with labels and scores.
Field Summary |
---|
Fields inherited from class edu.stanford.nlp.trees.Tree |
---|
ZEROCHILDREN |
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 | |
---|---|
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 . |
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. |
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. |
StringBuffer |
toStringBuffer(StringBuffer 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 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 |
---|
public LabeledScoredTreeLeaf()
public LabeledScoredTreeLeaf(Label label)
label
- the Label
representing the word for
this new tree leaf.public LabeledScoredTreeLeaf(Label label, double score)
label
- The Label
representing the word forscore
- The score for the node
this new tree leaf.Method Detail |
---|
public boolean isLeaf()
this
is a leaf.
CHRIS: is adding this actually a speed-up or a slowdown? Check!
isLeaf
in class Tree
public Tree[] children()
children
in class Tree
a unique zero-length Tree[]
Tree.getChildrenAsList()
public void setChildren(Tree[] children)
UnsupportedOperationException
setChildren
in class Tree
children
- The children for the nodeTree.setChildren(List)
public String toString()
toString
in interface Label
toString
in class Tree
public StringBuffer toStringBuffer(StringBuffer sb)
StringBuffer
.
toStringBuffer
in class Tree
sb
- An input StringBuffer which is appended to
StringBuffer
public Label label()
label
in interface Labeled
label
in class Tree
null
if there is no labelpublic void setLabel(Label label)
setLabel
in interface Labeled
setLabel
in class Tree
label
- The label of the nodepublic double score()
score
in interface Scored
score
in class Tree
public void setScore(double score)
setScore
in class Tree
score
- Score of nodepublic 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 time
lf
- The LabelFactory to use
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |