|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<Tree>
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 |
---|
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 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 StringBuilder toStringBuilder(StringBuilder sb)
StringBuffer
.
toStringBuilder
in class Tree
sb
-
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 void insertDtr(Tree dtr, int position)
UnsupportedOperationException
insertDtr
in class Tree
public void addChild(int i, Tree t)
UnsupportedOperationException
addChild
in class Tree
i
- the index position at which to add the new daughtert
- the new daughterpublic void addChild(Tree t)
UnsupportedOperationException
addChild
in class Tree
t
- the new daughterpublic Tree setChild(int i, Tree t)
UnsupportedOperationException
setChild
in class Tree
i
- The index position at which to replace the childt
- The new child
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 time
lf
- The LabelFactory to use
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |