public class CollapseUnaryTransformer
This transformer collapses chains of unary nodes so that the top
node is the only node left. The Sentiment model does not handle
unary nodes, so this simplifies them to make a binary tree consist
entirely of binary nodes and preterminals. A new tree with new
nodes and labels is returned; the original tree is unchanged.
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.