Spaces:
Running
Running
fix
Browse files
app.py
CHANGED
@@ -20,12 +20,12 @@ def postag(tk):
|
|
20 |
def genFlatDepthTree(expr):
|
21 |
doc = nlp(expr)
|
22 |
root = next(doc.sents).root
|
23 |
-
node = Node(root.text+"
|
24 |
|
25 |
def tree(tk, last_node, depth):
|
26 |
if tk.n_lefts + tk.n_rights > 0:
|
27 |
for ch in tk.children:
|
28 |
-
tree(ch, Node(ch.text+"
|
29 |
|
30 |
tree(root, node, 0)
|
31 |
flat_tree = ""
|
|
|
20 |
def genFlatDepthTree(expr):
|
21 |
doc = nlp(expr)
|
22 |
root = next(doc.sents).root
|
23 |
+
node = Node(root.text+"\t (Root)"+postag(root)+" - [0]", parent=None)
|
24 |
|
25 |
def tree(tk, last_node, depth):
|
26 |
if tk.n_lefts + tk.n_rights > 0:
|
27 |
for ch in tk.children:
|
28 |
+
tree(ch, Node(ch.text+"\t"+postag(ch)++" - ["str(depth+1)+"]", parent=last_node), depth+1)
|
29 |
|
30 |
tree(root, node, 0)
|
31 |
flat_tree = ""
|