GirishaBuilds01's picture
Create utils.py
4e25243 verified
raw
history blame contribute delete
287 Bytes
def chunk_text(text, chunk_size=400, overlap=80):
chunks = []
start = 0
text_length = len(text)
while start < text_length:
end = min(start + chunk_size, text_length)
chunks.append(text[start:end])
start += chunk_size - overlap
return chunks