InferenceAI

Enter at least two characters to search.

Start free

Chunk Text with Overlap

easyRAG15 min10 XP

Split a list of words into chunks of size, retaining overlap words between adjacent chunks. Rejecting invalid sizes is not required.

Examples

EXAMPLE WALKTHROUGHoverlap one

A guided view of the published example, not a trace of your code.

INPUT[["a","b","c","d","e"],3,1]
TASKchunk_text()
EXPECTED OUTPUT[["a","b","c"],["c","d","e"]]

Start with the input values shown in this example.

Example 1 of 2

Input: words = ["a","b","c","d","e"], size = 3, overlap = 1

Output: [["a","b","c"],["c","d","e"]]

Explanation: overlap one

Input: words = [1,2,3,4], size = 2, overlap = 0

Output: [[1,2],[3,4]]

Explanation: no overlap

Hint 1

The stride is size minus overlap.

Topics

PythonRAGData Processing