nielklug commited on
Commit
d8faa73
·
1 Parent(s): de2d7dd
Files changed (1) hide show
  1. parse.py +1 -0
parse.py CHANGED
@@ -10,6 +10,7 @@ def parse(words):
10
  input_sentence = benepar.InputSentence(words=words)
11
  tree = parser.parse(input_sentence)
12
  tree = str(tree).replace('-LRB-','\\(').replace('-RRB-','\\)').replace('-LSB-','\\[').replace('-RSB-','\\]').replace('($(-','($\\(-')
 
13
  # put the whole parse tree on a single line
14
  tree = re.sub(r'\s+', ' ', tree.strip())
15
  tree = re.sub(r' \(', '(', tree)
 
10
  input_sentence = benepar.InputSentence(words=words)
11
  tree = parser.parse(input_sentence)
12
  tree = str(tree).replace('-LRB-','\\(').replace('-RRB-','\\)').replace('-LSB-','\\[').replace('-RSB-','\\]').replace('($(-','($\\(-')
13
+ tree = tree.replace("$(", "$LRB").replace("$)", "$RRB")
14
  # put the whole parse tree on a single line
15
  tree = re.sub(r'\s+', ' ', tree.strip())
16
  tree = re.sub(r' \(', '(', tree)