Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import networkx as nx
|
|
5 |
|
6 |
|
7 |
def render_dependency_tree(words, parents, labels):
|
8 |
-
fig, ax = plt.subplots(figsize=(
|
9 |
|
10 |
# Create a directed graph
|
11 |
G = nx.DiGraph()
|
@@ -16,8 +16,8 @@ def render_dependency_tree(words, parents, labels):
|
|
16 |
|
17 |
# Adding edges with labels
|
18 |
for i, (parent, label) in enumerate(zip(parents, labels)):
|
19 |
-
if parent !=
|
20 |
-
G.add_edge(parent, i, label=label)
|
21 |
|
22 |
# Position nodes using Graphviz
|
23 |
pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|
|
|
5 |
|
6 |
|
7 |
def render_dependency_tree(words, parents, labels):
|
8 |
+
fig, ax = plt.subplots(figsize=(32, 16))
|
9 |
|
10 |
# Create a directed graph
|
11 |
G = nx.DiGraph()
|
|
|
16 |
|
17 |
# Adding edges with labels
|
18 |
for i, (parent, label) in enumerate(zip(parents, labels)):
|
19 |
+
if parent != 0:
|
20 |
+
G.add_edge(parent - 1, i, label=label)
|
21 |
|
22 |
# Position nodes using Graphviz
|
23 |
pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|