Update app.py
Browse files
app.py
CHANGED
@@ -121,14 +121,20 @@ def get_split_sentences(sentence, entity_tags):
|
|
121 |
if tag['entity_group'] == 'PP':
|
122 |
start = tag['start']
|
123 |
end = tag['end']
|
124 |
-
|
|
|
|
|
|
|
125 |
current_sentence.append(token)
|
126 |
split_sentences.append(" ".join(current_sentence))
|
127 |
current_sentence = [] # Reset the current sentence
|
128 |
else:
|
129 |
start = tag['start']
|
130 |
end = tag['end']
|
131 |
-
|
|
|
|
|
|
|
132 |
current_sentence.append(token)
|
133 |
|
134 |
# If the sentence ends without a [PAUSE] token, add the final sentence
|
|
|
121 |
if tag['entity_group'] == 'PP':
|
122 |
start = tag['start']
|
123 |
end = tag['end']
|
124 |
+
if end<len(sentence)-1:
|
125 |
+
token = sentence[start:end] # Adjust for 0-based indexing
|
126 |
+
else:
|
127 |
+
token = sentence[start:end+1]
|
128 |
current_sentence.append(token)
|
129 |
split_sentences.append(" ".join(current_sentence))
|
130 |
current_sentence = [] # Reset the current sentence
|
131 |
else:
|
132 |
start = tag['start']
|
133 |
end = tag['end']
|
134 |
+
if end<len(sentence)-1:
|
135 |
+
token = sentence[start:end] # Adjust for 0-based indexing
|
136 |
+
else:
|
137 |
+
token = sentence[start:end+1]
|
138 |
current_sentence.append(token)
|
139 |
|
140 |
# If the sentence ends without a [PAUSE] token, add the final sentence
|