Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 64d6256

Browse files
commented code for generation of fig. 3-4. tree
1 parent 84f0529 commit 64d6256

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎Chapter-3/dependency_parsing.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@
4141
dep_tree = [parse.tree() for parse in result][0]
4242
print dep_tree
4343
dep_tree.draw()
44-
44+
45+
'''
46+
# code for generation of annotated dependency tree shown in Figure 3-4
47+
from graphviz import Source
48+
dep_tree_dot_repr = [parse for parse in result][0].to_dot()
49+
source = Source(dep_tree_dot_repr, filename="dep_tree", format="png")
50+
source.view()
51+
'''
4552

4653
import nltk
4754
tokens = nltk.word_tokenize(sentence)
@@ -61,4 +68,4 @@
6168
tree = res[0]
6269
print tree
6370

64-
tree.draw()
71+
tree.draw()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /