Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nltk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
nltk
Commits
08af14ed
Commit
08af14ed
authored
Feb 23, 2015
by
Ondrej Platek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reimplement draw_dot(now to_dot) for current dep. graph
parent
0599fd07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
nltk/parse/dependencygraph.py
+9
-8
No files found.
nltk/parse/dependencygraph.py
View file @
08af14ed
...
@@ -129,7 +129,7 @@ class DependencyGraph(object):
...
@@ -129,7 +129,7 @@ class DependencyGraph(object):
"""
"""
return
node_address
in
self
.
nodes
return
node_address
in
self
.
nodes
def
draw
_dot
(
self
):
def
to
_dot
(
self
):
"""
"""
Returns a dot representation suitable for using with Graphviz
Returns a dot representation suitable for using with Graphviz
@rtype C{String}
@rtype C{String}
...
@@ -139,13 +139,14 @@ class DependencyGraph(object):
...
@@ -139,13 +139,14 @@ class DependencyGraph(object):
s
+=
'edge [dir=forward]
\n
'
s
+=
'edge [dir=forward]
\n
'
s
+=
'node [shape=plaintext]
\n
'
s
+=
'node [shape=plaintext]
\n
'
# Draw the remaining nodes
# Draw the remaining nodes
for
head
,
h_node
in
self
.
nodes
.
iteritems
():
for
node
in
sorted
(
self
.
nodes
.
values
()):
s
+=
'
\n
%
s [label="
%
s (
%
s)"]'
%
(
h_node
[
'address'
],
h_node
[
'address'
],
h_node
[
'word'
])
s
+=
'
\n
%
s [label="
%
s (
%
s)"]'
%
(
node
[
'address'
],
node
[
'address'
],
node
[
'word'
])
if
head
!=
0
:
# not TOP
for
rel
,
deps
in
node
[
'deps'
]
.
iteritems
():
if
h_node
[
'rel'
]
!=
'_'
:
for
dep
in
deps
:
s
+=
'
\n
%
s ->
%
s [label="
%
s"]'
%
(
h_node
[
'head'
],
h_node
[
'address'
],
h_node
[
'rel'
])
if
rel
!=
None
:
else
:
s
+=
'
\n
%
s ->
%
s [label="
%
s"]'
%
(
node
[
'address'
],
dep
,
rel
)
s
+=
'
\n
%
s ->
%
s '
%
(
h_node
[
'head'
],
h_node
[
'address'
])
else
:
s
+=
'
\n
%
s ->
%
s '
%
(
node
[
'address'
],
dep
)
s
+=
"
\n
}"
s
+=
"
\n
}"
return
s
return
s
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment