Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -34,10 +34,10 @@ if text:
|
|
34 |
parse_tree = parse(tokens)
|
35 |
|
36 |
# Convert the bracket parse tree into an NLTK Tree
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
|
42 |
col1 = st.columns(1)[0]
|
43 |
col1.header("POS tagging result:")
|
@@ -48,5 +48,5 @@ if text:
|
|
48 |
col2.write(parse_tree.replace('_', '\_').replace('$', '\$').replace('*', '\*'))
|
49 |
|
50 |
# Display the graph in the Streamlit app
|
51 |
-
|
52 |
|
|
|
34 |
parse_tree = parse(tokens)
|
35 |
|
36 |
# Convert the bracket parse tree into an NLTK Tree
|
37 |
+
mod_tree = 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(parse_tree.replace('_', '\_').replace('$', '\$').replace('*', '\*'))
|
49 |
|
50 |
# Display the graph in the Streamlit app
|
51 |
+
col2.image(tree_svg, use_column_width=True)
|
52 |
|