Java Reference
In-Depth Information
In this case, the TreePrint object is created showing the type dependencies "col-
lapsed".
TreePrint treePrint =
new TreePrint("typedDependenciesCollapsed");
treePrint.printTree(parseTree);
The output of this sequence is as follows where the number reflects its position within the
sentence:
det(cow-2, The-1)
nsubj(jumped-3, cow-2)
root(ROOT-0, jumped-3)
det(moon-6, the-5)
prep_over(jumped-3, moon-6)
Using the "penn" string to create the object results in the following output:
(ROOT
(S
(NP (DT The) (NN cow))
(VP (VBD jumped)
(PP (IN over)
(NP (DT the) (NN moon))))
(. .)))
The "dependencies" string produces a simple list of dependencies:
dep(cow-2,The-1)
dep(jumped-3,cow-2)
dep(null-0,jumped-3,root)
dep(jumped-3,over-4)
dep(moon-6,the-5)
dep(over-4,moon-6)
The formats can be combined using commas. The following example will result in both
the penn style and the typedDependenciesCollapsed formats being used for the
display:
"penn,typedDependenciesCollapsed"
Search WWH ::




Custom Search