Expand description
Deterministic text chunking for the packing stage.
No chunker exists anywhere else in the workspace (every other “chunk” is vector batching), so this is the reference implementation. Guarantees:
- Deterministic: same text + same policy ⇒ same chunks, same ranges.
- UTF-8 safe: never cuts inside a multi-byte char.
- Fence-atomic: never cuts inside a triple-backtick-fenced code block — a fence
larger than
ChunkPolicy::max_chunk_bytesstays one oversized chunk rather than being broken (the packing layer decides its fate whole). - Covering: without overlap, the chunk ranges partition the input — concatenating them reconstructs the text byte for byte.
Structs§
- Chunk
Policy - How oversized fragments are split before packing.
- Text
Chunk - One chunk of a larger text.
Enums§
- Chunk
Boundary - Which boundaries the chunker prefers to cut at.
Functions§
- chunk_
text - Split
textinto chunks underpolicy. Empty text yields no chunks.