VectorMind / backend /utils /text_utils.py
Ash-211's picture
feat: add frontend and backend code for multimodal RAG knowledge assistant
2db8ee1
Raw
History Blame Contribute Delete
622 Bytes
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