Text Chunker
v0.1.0Added Sep 26, 2026Sample dataRecursive text splitter for RAG. Splits documents on paragraph, sentence and word boundaries into chunks of a target size, with overlap.
cargo install kura-rs
kura add text-chunkerCopies 2 source files into your project. You own the code from then on.
If another tool already installs a kura command, run cargo install kura-rs --bin kura-rs and use kura-rs add instead.
use crate::parts::text_chunker::Chunker;
let chunker = Chunker::new(1_000).overlap(200);
for chunk in chunker.split(&document) {
index.add(chunk.text, chunk.range);
}Verification
Sample dataChecked against langchain-text-splitters 0.3.8 (Python) using differential testing: the same inputs go to both implementations and the outputs are compared.
These numbers are placeholders. They have not been measured yet and must not be read as real results. This part is marked "sample": true in its registry file.
Benchmarks
Sample datakura-rs (Rust) against langchain-text-splitters across input sizes. Faster at every measured input size, up to 26× faster.
These numbers are placeholders. They have not been measured yet and must not be read as real results. This part is marked "sample": true in its registry file.
Show data table
| Input size | kura-rs (Rust) | langchain-text-splitters | Speedup |
|---|---|---|---|
| 1 | 0.08 ms | 0.9 ms | 11× |
| 10 | 0.4 ms | 6.2 ms | 16× |
| 100 | 3.1 ms | 71 ms | 23× |
| 1,000 | 29 ms | 720 ms | 25× |
| 10,000 | 290 ms | 7.4 s | 26× |
Files
- parts/text_chunker/mod.rs
- parts/text_chunker/boundaries.rs