Create retrieval chunks that preserve answerable context across boundaries.
The full prompt is available without an account.
Implement chunk_text(text, chunk_size, overlap) that splits text into overlapping chunks.
- Use a sliding window: advance chunk_size - overlap characters each step.
- Each chunk (except possibly the last) should be exactly chunk_size characters.
- Include the last chunk even if it is shorter than chunk_size.
- If overlap >= chunk_size, no overlap is applied (stride equals chunk_size).
- Return a list of strings.
Read-only Python 3.12 preview. Sign in to edit and execute it.
def chunk_text(text, chunk_size, overlap):
# TODO: split text into overlapping chunks
return []