Spaces:
Sleeping
Sleeping
File size: 622 Bytes
2db8ee1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | def chunk_by_slide(text):
# Split by newline and group logically
lines = text.split("\n")
chunks = []
current_chunk = ""
for line in lines:
line = line.strip()
if not line:
continue
# If line looks like a heading, start new chunk
if line.endswith("Structure") or line.endswith("Generation"):
if current_chunk:
chunks.append(current_chunk.strip())
current_chunk = line + "\n"
else:
current_chunk += line + " "
if current_chunk:
chunks.append(current_chunk.strip())
return chunks
|