nielklug commited on
Commit
9842b72
·
1 Parent(s): 1673b0e
Files changed (1) hide show
  1. app.py +4 -4
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
- # t = Tree.fromstring(re.sub(r'(-\w+)+', '', parse_tree))
38
- # t = Tree.fromstring(parse_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,5 +48,5 @@ if text:
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
 
 
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