edu.stanford.nlp.trees.international.pennchinese
Class CharacterLevelTagExtender
java.lang.Object
edu.stanford.nlp.trees.TreeNormalizer
edu.stanford.nlp.trees.BobChrisTreeNormalizer
edu.stanford.nlp.trees.international.pennchinese.CharacterLevelTagExtender
- All Implemented Interfaces:
- TreeTransformer, Serializable
public class CharacterLevelTagExtender
- extends BobChrisTreeNormalizer
- implements TreeTransformer
- Author:
- Galen Andrew (galand@cs.stanford.edu) Date: May 13, 2004
A transformer to extend tags down to the level of individual characters.
Each word preterminal is split into new preterminals for each character
with tags corresponding to the original preterminal tag plus a suffix
depending on the position of the character in the word: _S for single-char
words, _B for first char of multi-char words, _M for middle chars and _E
for final chars.
This is used in combining Chinese parsing and word segmentation using the
method of Luo '03.
Note: it implements TreeTransformer because we might want to do away
with TreeNormalizers in favor of TreeTransformers
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CharacterLevelTagExtender
public CharacterLevelTagExtender()
CharacterLevelTagExtender
public CharacterLevelTagExtender(TreebankLanguagePack tlp)
normalizeWholeTree
public Tree normalizeWholeTree(Tree tree,
TreeFactory tf)
- Description copied from class:
BobChrisTreeNormalizer
- Normalize a whole tree -- one can assume that this is the
root. This implementation deletes empty elements (ones with
nonterminal tag label '-NONE-') from the tree, and splices out
unary A over A nodes. It does work for a null tree.
- Overrides:
normalizeWholeTree
in class BobChrisTreeNormalizer
- Parameters:
tree
- The tree to be normalizedtf
- the TreeFactory to create new nodes (if needed)
- Returns:
- Tree the normalized tree
transformTree
public Tree transformTree(Tree tree)
- Description copied from interface:
TreeTransformer
- 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
.
- Specified by:
transformTree
in interface TreeTransformer
- Parameters:
tree
- A tree. Classes implementing this interface can assume
that the tree passed in is not null
.
- Returns:
- the transformed
Tree
untransformTree
public Tree untransformTree(Tree tree)
main
public static void main(String[] args)
throws IOException
- for testing -- CURRENTLY BROKEN!!!
- Parameters:
args
- input dir and output filename
- Throws:
IOException
Stanford NLP Group