edu.stanford.nlp.trees.international.negra
Class NegraPennTreeNormalizer

java.lang.Object
  extended by edu.stanford.nlp.trees.TreeNormalizer
      extended by edu.stanford.nlp.trees.international.negra.NegraPennTreeNormalizer
All Implemented Interfaces:
Serializable

public class NegraPennTreeNormalizer
extends TreeNormalizer

Tree normalizer for Negra Penn Treebank format.

Author:
Roger Levy
See Also:
Serialized Form

Field Summary
protected  TreebankLanguagePack tlp
           
 
Constructor Summary
NegraPennTreeNormalizer()
           
NegraPennTreeNormalizer(TreebankLanguagePack tlp)
           
 
Method Summary
protected  String cleanUpLabel(String label)
          Remove things like hyphened functional tags and equals from the end of a node label.
 boolean getInsertNPinPP()
           
 boolean getLeaveGF()
           
 String nonUnaryRootSymbol()
           
 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.
 String rootSymbol()
           
 void setInsertNPinPP(boolean b)
           
 void setLeaveGF(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tlp

protected final TreebankLanguagePack tlp
Constructor Detail

NegraPennTreeNormalizer

public NegraPennTreeNormalizer()

NegraPennTreeNormalizer

public NegraPennTreeNormalizer(TreebankLanguagePack tlp)
Method Detail

rootSymbol

public String rootSymbol()

nonUnaryRootSymbol

public String nonUnaryRootSymbol()

setLeaveGF

public void setLeaveGF(boolean b)

getLeaveGF

public boolean getLeaveGF()

setInsertNPinPP

public void setInsertNPinPP(boolean b)

getInsertNPinPP

public boolean getInsertNPinPP()

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. This implementation deletes empty elements (ones with nonterminal tag label starting with '*T') from the tree. It does work for a null tree.

The NegraPennTreeNormalizer also changes the Label to a NegraLabel and notes the functional marking as part of the NegraLabel.

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

cleanUpLabel

protected String cleanUpLabel(String label)
Remove things like hyphened functional tags and equals from the end of a node label.



Stanford NLP Group