IanRonk commited on
Commit
225162b
1 Parent(s): 0c897e5

Update functions/punctuation.py

Browse files
Files changed (1) hide show
  1. functions/punctuation.py +8 -5
functions/punctuation.py CHANGED
@@ -39,11 +39,14 @@ def parse_output(output, comb):
39
  added = 0
40
  tt = comb[i]
41
  for elem in o:
42
- # Loop over the output chunks and add the . and ?
43
- if elem["entity_group"] not in ["0", ",", ""]:
44
- split = elem["end"] + added
45
- tt = tt[:split] + elem["entity_group"] + tt[split:]
46
- added += 1
 
 
 
47
  total.append(tt)
48
  return " ".join(total)
49
 
 
39
  added = 0
40
  tt = comb[i]
41
  for elem in o:
42
+ try:
43
+ # Loop over the output chunks and add the . and ?
44
+ if elem["entity_group"] not in ["0", ",", ""]:
45
+ split = elem["end"] + added
46
+ tt = tt[:split] + elem["entity_group"] + tt[split:]
47
+ added += 1
48
+ except:
49
+ continue
50
  total.append(tt)
51
  return " ".join(total)
52