Java Reference
In-Depth Information
parseTree.pennPrint();
The output is as follows:
(ROOT
(S
(NP (DT The) (NN cow))
(VP (VBD jumped)
(PP (IN over)
(NP (DT the) (NN moon))))
(. .)))
The Tree class provides numerous methods for working with parse trees.
Using the TreePrint class
The TreePrint class provides a simple way to display the tree. An instance of the class
is created using a string describing the display format to be used. An array of valid output
formats can be obtained using the static outputTreeFormats variable and are listed
in the following table:
Tree Format Strings
penn
dependencies
collocations
oneline
typedDependencies
semanticGraph
rootSymbolOnly typedDependenciesCollapsed conllStyleDependencies
words
latexTree
conll2007
wordsAndTags xmlTree
Stanford uses type dependencies to describe the grammatical relationships that exist with-
in a sentence. These are detailed in the Stanford Typed Dependencies Manual ( ht-
tp://nlp.stanford.edu/software/dependencies_manual.pdf ) .
The following code example illustrates how the TreePrint class can be used. The
printTree method performs the actual display operation.
Search WWH ::




Custom Search