edu.stanford.nlp.trees.TreeFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stanford-corenlp Show documentation
Show all versions of stanford-corenlp Show documentation
Stanford CoreNLP provides a set of natural language analysis tools which can take raw English language text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, mark up the structure of sentences in terms of phrases and word dependencies, and indicate which noun phrases refer to the same entities. It provides the foundational building blocks for higher level text understanding applications.
package edu.stanford.nlp.trees;
import edu.stanford.nlp.ling.Label;
import java.util.List;
/**
* A TreeFactory
acts as a factory for creating objects of
* class Tree
, or some descendant 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.
*
* @author Christopher Manning
* @version 2000/12/20
*/
public interface TreeFactory {
/**
* Create a new tree leaf node, where the label is formed from
* the String
passed in.
*
* @param word The word that will go into the tree label.
* @return The new leaf
*/
public Tree newLeaf(String word);
/**
* Create a new tree non-leaf node, where the label is formed from
* the String
passed in.
*
* @param parent The string that will go into the parent tree label.
* @param children The list of daughters of this tree. The children
* may be a (possibly empty) List
of children or
* null
* @return The new interior tree node
*/
public Tree newTreeNode(String parent, List children);
/**
* Create a new tree leaf node, with the given label.
*
* @param label The label for the leaf node
* @return The new leaf
*/
public Tree newLeaf(Label label);
/**
* Create a new tree non-leaf node, with the given label.
*
* @param label The label for the parent tree node.
* @param children The list of daughters of this tree. The children
* may be a (possibly empty) List
of children or
* null
* @return The new interior tree node
*/
public Tree newTreeNode(Label label, List children);
}