Skip to content

Add a sliding-window (overlap) chunker #6

Description

@AshwinUgale

The problem / use case

Context: Chunkers live in src/retrieval_lab/text.py (FixedSizeChunker,
RecursiveChunker, SemanticChunker, ParentChildChunker). A sliding-window /
overlap chunker is a natural, widely-used addition.

What: Add a SlidingWindowChunker(size, overlap) next to the others, exported from
retrieval_lab, and wire it into the CLI --chunkers parser (e.g. sliding:400x100).

Acceptance:

  • appears as a --chunkers option and runs end-to-end in retrieval-lab demo
  • a test in tests/test_chunking.py (correct sizes + overlap; spans still map to gold)
  • CHANGELOG.md updated

Pointers: copy the shape of FixedSizeChunker; remember gold is a source-document
span, so a "hit" is any retrieved chunk overlapping the gold span — overlap chunks are fine.

Proposed idea

Add an overlap-based chunker that emits fixed-size chunks with a configurable stride, so adjacent chunks share context — a common strategy the sweep can compare against the existing ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions