Spaces:
Runtime error
Runtime error
Update functions/punctuation.py
Browse files- 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 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|