edu.stanford.nlp.trees
Interface TreeTransformer
- public interface TreeTransformer
This is a simple interface for a function that alters a
local Tree
.
transformTree
public Tree transformTree(Tree t,
TreeFactory tf)
- Does whatever one needs to do to a particular tree.
This routine is parsed a whole
Tree
, and could itself
work recursively, but the canonical usage is to invoke this method
via the Tree.transform
method, which will apply the
transformer in a bottom-up manner to each local Tree
,
and hence the implementation of TreeTransformer
should
merely examine and change a local (one-level) Tree
.
- Parameters:
t
- A tree. Classes implementing this interface can assume
that the tree passed in is not null
.tf
- The TreeFactory
which may be used for creating
new nodes for the returned Tree
. If the particular
implementation never actually creates new nodes, then it is
acceptable to pass null
as this second argument
- Returns:
- the transformed
Tree
Stanford NLP Group