public class TreeBinarizer extends java.lang.Object implements TreeTransformer
Constructor and Description |
---|
TreeBinarizer(HeadFinder hf,
TreebankLanguagePack tlp,
boolean insideFactor,
boolean markovFactor,
int markovOrder,
boolean useWrappingLabels,
boolean unaryAtTop,
double selectiveSplitThreshold,
boolean markFinalStates,
boolean simpleLabels,
boolean noRebinarization)
Build a custom binarizer for Trees.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Lets you test out the TreeBinarizer on the command line.
|
void |
setDoSelectiveSplit(boolean doSelectiveSplit)
If this is set to true, then the binarizer will choose selectively whether or not to
split states based on how many counts the states had in a previous run.
|
static TreeBinarizer |
simpleTreeBinarizer(HeadFinder hf,
TreebankLanguagePack tlp)
Builds a TreeBinarizer with all of the options set to simple values
|
Tree |
transformTree(Tree t)
Binarizes the tree according to options set up in the constructor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply
public TreeBinarizer(HeadFinder hf, TreebankLanguagePack tlp, boolean insideFactor, boolean markovFactor, int markovOrder, boolean useWrappingLabels, boolean unaryAtTop, double selectiveSplitThreshold, boolean markFinalStates, boolean simpleLabels, boolean noRebinarization)
hf
- the HeadFinder to use in binarizationtlp
- the TreebankLanguagePack to useinsideFactor
- whether to do inside markovizationmarkovFactor
- whether to markovize the binary rulesmarkovOrder
- the markov order to use; only relevant with markovFactor=trueuseWrappingLabels
- whether to use state names (labels) that allow wrapping from right to leftunaryAtTop
- Whether to actually materialize the unary that rewrites
a passive state to the active rule at the top of an original local
tree. This is used only when compaction is happeningselectiveSplitThreshold
- if selective split is used, this will be the threshold used to decide which state splits to keepmarkFinalStates
- whether or not to make the state names (labels) of the final active states distinctivenoRebinarization
- if true, a node which already has exactly two children is not alteredpublic void setDoSelectiveSplit(boolean doSelectiveSplit)
doSelectiveSplit
- Record this value and reset internal counter if falsepublic Tree transformTree(Tree t)
transformTree
in interface TreeTransformer
t
- A tree to be binarized. The non-leaf nodes must already have
CategoryWordTag labels, with heads percolated.public static TreeBinarizer simpleTreeBinarizer(HeadFinder hf, TreebankLanguagePack tlp)
public static void main(java.lang.String[] args)
args
- Command line arguments: flags as above, as above followed by
treebankPath