pub struct RecursiveChunker { /* private fields */ }Expand description
Hierarchical chunker: tries paragraphs → sentences → fixed-char fallback.
- First splits by
\n\n(paragraphs) - If a paragraph is still larger than
max_chunk_size, splits by sentences - If a sentence is still too large, uses fixed-size character splitting
§Example
use traitclaw_rag::chunker::{Chunker, RecursiveChunker};
let chunker = RecursiveChunker::new(200);
let text = "Para 1.\n\nPara 2 sentence one. Para 2 sentence two.";
let chunks = chunker.chunk(text);
assert!(!chunks.is_empty());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RecursiveChunker
impl RefUnwindSafe for RecursiveChunker
impl Send for RecursiveChunker
impl Sync for RecursiveChunker
impl Unpin for RecursiveChunker
impl UnsafeUnpin for RecursiveChunker
impl UnwindSafe for RecursiveChunker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more