edu.stanford.nlp.trees
Class TreePrint

java.lang.Object
  extended by edu.stanford.nlp.trees.TreePrint

public class TreePrint
extends java.lang.Object

A class for customizing the print method(s) for a edu.stanford.nlp.trees.Tree as the output of the parser. This now supports printing in multiple ways and altering behavior via properties.


Field Summary
static java.lang.String headMark
           
static java.lang.String[] outputTreeFormats
           
 
Constructor Summary
TreePrint(java.lang.String formats, java.lang.String options, TreebankLanguagePack tlp)
           
TreePrint(java.lang.String formats, java.lang.String options, TreebankLanguagePack tlp, HeadFinder hf)
          Make a TreePrint instance.
TreePrint(java.lang.String formats, TreebankLanguagePack tlp)
           
 
Method Summary
 HeadFinder getHeadFinder()
           
static void main(java.lang.String[] args)
          utility code...
 Tree markHeadNodes(Tree t)
           
 void printFooter(java.io.PrintWriter pw)
           
 void printHeader(java.io.PrintWriter pw, java.lang.String charset)
           
 void printTree(Tree t)
          Prints the tree to the default PrintWriter.
 void printTree(Tree t, java.io.PrintWriter pw)
          Prints the tree, with an empty ID.
 void printTree(Tree t, java.lang.String id, java.io.PrintWriter pw)
          Prints the tree.
 void setHeadFinder(HeadFinder hf)
          Set the headfinder to be used for lexicalizing trees.
 void setPrintWriter(java.io.PrintWriter pw)
          Sets the default print writer for printing trees with the instance.
 void setStem(boolean stem)
          Sets whether or not to stem the Trees using Morphology.
 void setStem(boolean stem, java.lang.String verbFile)
          Sets whether or not to stem the Trees using Morphology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputTreeFormats

public static final java.lang.String[] outputTreeFormats

headMark

public static final java.lang.String headMark
See Also:
Constant Field Values
Constructor Detail

TreePrint

public TreePrint(java.lang.String formats,
                 TreebankLanguagePack tlp)

TreePrint

public TreePrint(java.lang.String formats,
                 java.lang.String options,
                 TreebankLanguagePack tlp)

TreePrint

public TreePrint(java.lang.String formats,
                 java.lang.String options,
                 TreebankLanguagePack tlp,
                 HeadFinder hf)
Make a TreePrint instance.

Parameters:
formats - A comma separated list of ways to print each Tree. Known formats are: oneline, penn, latexTree, wordsAndTags, dependencies, typedDependencies. All of them print a blank line after the output except for oneline.
options - Options that additionally specify how trees are to be printed (for instance, whether stemming should be done). Known options are: stem, lexicalize, markHeadNodes, xml.
tlp - The TreebankLanguagePack used to do things like delete or ignore punctuation in output
hf - The HeadFinder used in printing output
Method Detail

printTree

public void printTree(Tree t)
Prints the tree to the default PrintWriter.


printTree

public void printTree(Tree t,
                      java.io.PrintWriter pw)
Prints the tree, with an empty ID.


printTree

public void printTree(Tree t,
                      java.lang.String id,
                      java.io.PrintWriter pw)
Prints the tree.

Parameters:
id - A name for this sentence.

printHeader

public void printHeader(java.io.PrintWriter pw,
                        java.lang.String charset)

printFooter

public void printFooter(java.io.PrintWriter pw)

setStem

public void setStem(boolean stem)
Sets whether or not to stem the Trees using Morphology.


setStem

public void setStem(boolean stem,
                    java.lang.String verbFile)
Sets whether or not to stem the Trees using Morphology.

Parameters:
verbFile - the verbFile used by Morphology

setHeadFinder

public void setHeadFinder(HeadFinder hf)
Set the headfinder to be used for lexicalizing trees. Relevant if the output is to be lexicalized. By default, CollinsHeadFinder is used.


getHeadFinder

public HeadFinder getHeadFinder()

setPrintWriter

public void setPrintWriter(java.io.PrintWriter pw)
Sets the default print writer for printing trees with the instance. Unless this is set, the default is System.out.


markHeadNodes

public Tree markHeadNodes(Tree t)

main

public static void main(java.lang.String[] args)
utility code...