public class BobChrisTreeNormalizer extends TreeNormalizer implements TreeTransformer
Modifier and Type | Class and Description |
---|---|
static class |
BobChrisTreeNormalizer.AOverAFilter |
static class |
BobChrisTreeNormalizer.EmptyFilter |
Modifier and Type | Field and Description |
---|---|
protected java.util.function.Predicate<Tree> |
aOverAFilter |
protected java.util.function.Predicate<Tree> |
emptyFilter |
protected TreebankLanguagePack |
tlp |
Constructor and Description |
---|
BobChrisTreeNormalizer() |
BobChrisTreeNormalizer(TreebankLanguagePack tlp) |
Modifier and Type | Method and Description |
---|---|
protected String |
cleanUpLabel(String label)
Remove things like hyphened functional tags and equals from the
end of a node label.
|
String |
normalizeNonterminal(String category)
Normalizes a nonterminal contents.
|
String |
normalizeTerminal(String leaf)
Normalizes a leaf contents.
|
Tree |
normalizeWholeTree(Tree tree,
TreeFactory tf)
Normalize a whole tree -- one can assume that this is the
root.
|
Tree |
transformTree(Tree tree)
Does whatever one needs to do to a particular tree.
|
protected final TreebankLanguagePack tlp
protected java.util.function.Predicate<Tree> emptyFilter
protected java.util.function.Predicate<Tree> aOverAFilter
public BobChrisTreeNormalizer()
public BobChrisTreeNormalizer(TreebankLanguagePack tlp)
public String normalizeTerminal(String leaf)
normalizeTerminal
in class TreeNormalizer
leaf
- The String that decorates the leafpublic String normalizeNonterminal(String category)
normalizeNonterminal
in class TreeNormalizer
category
- The String that decorates this nonterminal nodeprotected String cleanUpLabel(String label)
null
.label
- The label from the treebankpublic Tree normalizeWholeTree(Tree tree, TreeFactory tf)
normalizeWholeTree
in class TreeNormalizer
tree
- The tree to be normalizedtf
- the TreeFactory to create new nodes (if needed)public Tree transformTree(Tree tree)
TreeTransformer
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
.transformTree
in interface TreeTransformer
tree
- A tree. Classes implementing this interface can assume
that the tree passed in is not null
.Tree