|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.trees.TreeNormalizer
edu.stanford.nlp.trees.BobChrisTreeNormalizer
public class BobChrisTreeNormalizer
Normalizes trees in the way used in Manning and Carpenter 1997.
NB: This implementation is still incomplete!
The normalizations performed are: (i) terminals are interned, (ii)
nonterminals are stripped of alternants, functional tags and
cross-reference codes, and then interned, (iii) empty
elements (ones with nonterminal label "-NONE-") are deleted from the
tree, (iv) the null label at the root node is replaced with the label
"ROOT".
17 Apr 2001: This was fixed to work with different kinds of labels,
by making proper use of the Label interface, after it was moved into
the trees module.
| Nested Class Summary | |
|---|---|
static class |
BobChrisTreeNormalizer.AOverAFilter
|
static class |
BobChrisTreeNormalizer.EmptyFilter
|
| Field Summary | |
|---|---|
protected Filter<Tree> |
aOverAFilter
|
protected Filter<Tree> |
emptyFilter
|
protected TreebankLanguagePack |
tlp
|
| Constructor Summary | |
|---|---|
BobChrisTreeNormalizer()
|
|
BobChrisTreeNormalizer(TreebankLanguagePack tlp)
|
|
| Method Summary | |
|---|---|
protected java.lang.String |
cleanUpLabel(java.lang.String label)
Remove things like hyphened functional tags and equals from the end of a node label. |
java.lang.String |
normalizeNonterminal(java.lang.String category)
Normalizes a nonterminal contents. |
java.lang.String |
normalizeTerminal(java.lang.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final TreebankLanguagePack tlp
protected Filter<Tree> emptyFilter
protected Filter<Tree> aOverAFilter
| Constructor Detail |
|---|
public BobChrisTreeNormalizer()
public BobChrisTreeNormalizer(TreebankLanguagePack tlp)
| Method Detail |
|---|
public java.lang.String normalizeTerminal(java.lang.String leaf)
normalizeTerminal in class TreeNormalizerleaf - The String that decorates the leaf
public java.lang.String normalizeNonterminal(java.lang.String category)
normalizeNonterminal in class TreeNormalizercategory - The String that decorates this nonterminal node
protected java.lang.String cleanUpLabel(java.lang.String label)
null.
label - The label from the treebank
public Tree normalizeWholeTree(Tree tree,
TreeFactory tf)
normalizeWholeTree in class TreeNormalizertree - The tree to be normalizedtf - the TreeFactory to create new nodes (if needed)
public Tree transformTree(Tree tree)
TreeTransformerTree, 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 TreeTransformertree - A tree. Classes implementing this interface can assume
that the tree passed in is not null.
Tree
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||