edu.stanford.nlp.trees
Class DanBobChrisTreeNormalizer

java.lang.Object
  extended byedu.stanford.nlp.trees.TreeNormalizer
      extended byedu.stanford.nlp.trees.DanBobChrisTreeNormalizer

public class DanBobChrisTreeNormalizer
extends TreeNormalizer

Normalizes trees roughly 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 (on |, =, -) 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". Dan's mod: -NONE- are all made into Word.EMPTY but left in.

Implementation note: This class should probably be removed and made a constructor option of BobChrisTreeNormalizer, which should in turn be folded into the ParametricTreeNormalizer.

Author:
Dan Klein

Constructor Summary
DanBobChrisTreeNormalizer()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DanBobChrisTreeNormalizer

public DanBobChrisTreeNormalizer()
Method Detail

normalizeTerminal

public String normalizeTerminal(String leaf)
Normalizes a leaf contents. This implementation interns the leaf.

Overrides:
normalizeTerminal in class TreeNormalizer
Parameters:
leaf - The String that decorates the leaf
Returns:
The normalized form of this leaf String

normalizeNonterminal

public String normalizeNonterminal(String category)
Normalizes a nonterminal contents. This implementation strips functional tags, etc. and interns the nonterminal.

Overrides:
normalizeNonterminal in class TreeNormalizer
Parameters:
category - The String that decorates this nonterminal node
Returns:
The normalized form of this nonterminal String

normalizeWholeTree

public Tree normalizeWholeTree(Tree tree,
                               TreeFactory tf)
Normalize a whole tree -- one can assume that this is the root. Dan's mod: -NONE- are all made into Word.EMPTY but left in. (Chris: rather than the way this is done, I wonder if using the transform() method of the Tree class wouldn't be much more efficient.) This tries to be robust to different Tree implementations in detecting

Overrides:
normalizeWholeTree in class TreeNormalizer
Parameters:
tree - The tree to be normalized
tf - the TreeFactory to create new nodes (if needed)
Returns:
Tree the normalized tree


Stanford NLP Group