Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -35,11 +35,9 @@ if text:
|
|
35 |
|
36 |
# Convert the bracket parse tree into an NLTK Tree
|
37 |
mod_tree = str(parse_tree).replace("$\(", "$LRB").replace("$\)", "$RRB")
|
38 |
-
|
39 |
-
# t = Tree.fromstring(re.sub(r'(-\w+)+', '', mod_tree))
|
40 |
-
# t = Tree.fromstring(mod_tree)
|
41 |
|
42 |
-
|
43 |
|
44 |
col1 = st.columns(1)[0]
|
45 |
col1.header("POS tagging result:")
|
@@ -50,5 +48,5 @@ if text:
|
|
50 |
col2.write(mod_tree.replace('_', '\_').replace('$', '\$').replace('*', '\*'))
|
51 |
|
52 |
# Display the graph in the Streamlit app
|
53 |
-
|
54 |
|
|
|
35 |
|
36 |
# Convert the bracket parse tree into an NLTK Tree
|
37 |
mod_tree = str(parse_tree).replace("$\(", "$LRB").replace("$\)", "$RRB")
|
38 |
+
t = Tree.fromstring(re.sub(r'(-\w+)+', '', mod_tree))
|
|
|
|
|
39 |
|
40 |
+
tree_svg = TreePrettyPrinter(t).svg(nodecolor='black', leafcolor='black', funccolor='black')
|
41 |
|
42 |
col1 = st.columns(1)[0]
|
43 |
col1.header("POS tagging result:")
|
|
|
48 |
col2.write(mod_tree.replace('_', '\_').replace('$', '\$').replace('*', '\*'))
|
49 |
|
50 |
# Display the graph in the Streamlit app
|
51 |
+
col2.image(tree_svg, use_column_width=True)
|
52 |
|