edu.stanford.nlp.trees
Interface TreeFactory

All Known Implementing Classes:
SimpleTreeFactory

public interface TreeFactory

A TreeFactory acts as a factory for creating objects of class Tree, or some descendent class. Methods implementing this interface may assume that the List of children passed to them is a list that actually contains trees, but this can't be enforced in Java without polymorphic types. The methods with a String argument do not guarantee that the tree label() will be a String -- the TreeFactory may convert it into some other type.


Method Summary
 Tree newLeaf(Label label)
          Create a new tree leaf node, with the given label.
 Tree newLeaf(String word)
          Create a new tree leaf node, where the label is formed from the String passed in.
 Tree newTreeNode(Label label, List children)
          Create a new tree nonleaf node, with the given label.
 Tree newTreeNode(String parent, List children)
          Create a new tree nonleaf node, where the label is formed from the String passed in.
 

Method Detail

newLeaf

public Tree newLeaf(String word)
Create a new tree leaf node, where the label is formed from the String passed in.

Parameters:
word - The word that will go into the tree label.
Returns:
The new leaf

newTreeNode

public Tree newTreeNode(String parent,
                        List children)
Create a new tree nonleaf node, where the label is formed from the String passed in.

Parameters:
parent - The string that will go into the parent tree label.
children - The list of daughters of this tree. The children may be a (possibly empty) List of children or null
Returns:
The new interior tree node

newLeaf

public Tree newLeaf(Label label)
Create a new tree leaf node, with the given label.

Parameters:
label - The label for the leaf node
Returns:
The new leaf

newTreeNode

public Tree newTreeNode(Label label,
                        List children)
Create a new tree nonleaf node, with the given label.

Parameters:
label - The label for the parent tree node.
children - The list of daughters of this tree. The children may be a (possibly empty) List of children or null
Returns:
The new interior tree node


Stanford NLP Group