Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -192,11 +192,12 @@ async def CreaListaInput(input_data):
|
|
192 |
|
193 |
async def split_at_space_or_dot(input_string, length):
|
194 |
delimiters = ['\n\n', '.\n', ';\n', '.', ' ']
|
195 |
-
|
196 |
-
|
|
|
|
|
197 |
return indice_divisione + 1
|
198 |
|
199 |
-
|
200 |
def DividiInstructionJSON(lista_dizionari, input_data):
|
201 |
ListaInput = []
|
202 |
nuova_lista_dizionari = []
|
|
|
192 |
|
193 |
async def split_at_space_or_dot(input_string, length):
|
194 |
delimiters = ['\n\n', '.\n', ';\n', '.', ' ']
|
195 |
+
positions = [input_string.rfind(d, 0, length) for d in delimiters]
|
196 |
+
valid_positions = [pos for pos in positions if pos >= 0]
|
197 |
+
lastpos = max(valid_positions) if valid_positions else length
|
198 |
+
indice_divisione = int(lastpos)
|
199 |
return indice_divisione + 1
|
200 |
|
|
|
201 |
def DividiInstructionJSON(lista_dizionari, input_data):
|
202 |
ListaInput = []
|
203 |
nuova_lista_dizionari = []
|