public abstract class RecursiveTreeTransformer
A tool to recursively alter a tree in various ways. For example,
turns all the non-leaf labels of a tree into their basic categories
given a set of treebank parameters which describe how to turn the
There are three easy places to override and implement the needed
behavior. transformTerminalLabel changes the labels of the
terminals, transformNonterminalLabel changes the labels of the
non-terminals, and transformLabel changes all labels. If the tree
needs to be changed in different ways, transformTerminal or
transformNonterminal can be used instead.
Does whatever one needs to do to a particular tree.
This routine is passed 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.