pub struct RecursiveCharSplitter { /* private fields */ }Expand description
Splits text by character count, falling back through a list of
separators until each chunk is at most chunk_size characters.
Adjacent chunks share a chunk_overlap window so context isn’t lost
at boundaries. Mirrors LangChain’s RecursiveCharacterTextSplitter in
behaviour but operates on Rust &str and counts characters, not tokens.
Implementations§
Source§impl RecursiveCharSplitter
impl RecursiveCharSplitter
Sourcepub fn with_chunk_size(self, n: usize) -> Self
pub fn with_chunk_size(self, n: usize) -> Self
Set the target maximum chunk size (in chars).
Sourcepub fn with_overlap(self, n: usize) -> Self
pub fn with_overlap(self, n: usize) -> Self
Set the overlap window between adjacent chunks.
Sourcepub fn with_separators<I, S>(self, seps: I) -> Self
pub fn with_separators<I, S>(self, seps: I) -> Self
Override the separator list (tried in order, coarsest first).
Trait Implementations§
Source§impl Default for RecursiveCharSplitter
impl Default for RecursiveCharSplitter
Auto Trait Implementations§
impl Freeze for RecursiveCharSplitter
impl RefUnwindSafe for RecursiveCharSplitter
impl Send for RecursiveCharSplitter
impl Sync for RecursiveCharSplitter
impl Unpin for RecursiveCharSplitter
impl UnsafeUnpin for RecursiveCharSplitter
impl UnwindSafe for RecursiveCharSplitter
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