davda54 commited on
Commit
8f83e8d
·
1 Parent(s): a19f5b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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=(10, 6))
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 != -1:
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')