|
|||||||||
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.LabeledScoredTreeNode
public class LabeledScoredTreeNode
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.
Field Summary |
---|
Fields inherited from class edu.stanford.nlp.trees.Tree |
---|
ZEROCHILDREN |
Constructor Summary | |
---|---|
LabeledScoredTreeNode()
Create an empty parse tree. |
|
LabeledScoredTreeNode(Label label,
List 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 . |
static Tree |
flatTree(Sentence s)
|
Label |
label()
Returns the label associated with the current node, or null if there is no label |
String |
nodeString()
|
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 |
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 LabeledScoredTreeNode()
public LabeledScoredTreeNode(Label label, List daughterTreesList)
label
- root label of tree to construct.daughterTreesList
- List of daughter trees to construct.Method Detail |
---|
public Tree[] children()
children
in class Tree
Tree.getChildrenAsList()
public void setChildren(Tree[] children)
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.
setChildren
in class Tree
children
- An array of child treesTree.setChildren(List)
public Label label()
label
in interface Labeled
label
in class Tree
public void setLabel(Label label)
setLabel
in interface Labeled
setLabel
in class Tree
label
- The labelpublic double score()
score
in interface Scored
score
in class Tree
public void setScore(double score)
setScore
in class Tree
score
- The scorepublic StringBuffer toStringBuffer(StringBuffer sb)
StringBuffer
.
toStringBuffer
in class Tree
sb
- The StringBuffer to append to
StringBuffer
public static Tree flatTree(Sentence s)
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
public String nodeString()
nodeString
in class Tree
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |