MatteoScript commited on
Commit
2c13b0b
·
verified ·
1 Parent(s): f8ee6ca

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -3
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
- lastpos = max(input_string.rfind(d, 0, length) for d in delimiters)
196
- indice_divisione = lastpos if lastpos >= 0 else length
 
 
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 = []