pub struct TextChunker { /* private fields */ }Expand description
Text chunker for splitting documents
Implementations§
Source§impl TextChunker
impl TextChunker
Sourcepub fn new(config: ChunkerConfig) -> Self
pub fn new(config: ChunkerConfig) -> Self
Create a new text chunker with the given configuration
Sourcepub fn with_word_chunking(chunk_size: usize, chunk_overlap: usize) -> Self
pub fn with_word_chunking(chunk_size: usize, chunk_overlap: usize) -> Self
Create with word-based chunking (backward compatible)
Sourcepub fn with_semantic_chunking(max_chunk_size: usize) -> Self
pub fn with_semantic_chunking(max_chunk_size: usize) -> Self
Create with semantic chunking
Sourcepub fn with_character_chunking(chunk_size: usize, chunk_overlap: usize) -> Self
pub fn with_character_chunking(chunk_size: usize, chunk_overlap: usize) -> Self
Create with character-based chunking
Sourcepub fn chunk(&self, text: &str) -> Vec<String>
pub fn chunk(&self, text: &str) -> Vec<String>
Chunk text and return simple string vector (backward compatible)
Sourcepub fn chunk_with_metadata(&self, text: &str) -> Vec<Chunk>
pub fn chunk_with_metadata(&self, text: &str) -> Vec<Chunk>
Chunk text with full metadata
Sourcepub fn config(&self) -> &ChunkerConfig
pub fn config(&self) -> &ChunkerConfig
Get the current configuration
Trait Implementations§
Source§impl Clone for TextChunker
impl Clone for TextChunker
Source§fn clone(&self) -> TextChunker
fn clone(&self) -> TextChunker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextChunker
impl Debug for TextChunker
Auto Trait Implementations§
impl Freeze for TextChunker
impl RefUnwindSafe for TextChunker
impl Send for TextChunker
impl Sync for TextChunker
impl Unpin for TextChunker
impl UnsafeUnpin for TextChunker
impl UnwindSafe for TextChunker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more