MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / split_by_characters

Method split_by_characters

core/src/text_splitter.rs:721–732  ·  view source on GitHub ↗

Split by characters when no other separator works

(&self, text: &str)

Source from the content-addressed store, hash-verified

719
720 /// Split by characters when no other separator works
721 fn split_by_characters(&self, text: &str) -> Vec<String> {
722 let mut result = Vec::new();
723 let mut start = 0;
724
725 while start < text.len() {
726 let end = (start + self.chunk_size).min(text.len());
727 result.push(text[start..end].to_string());
728 start = end;
729 }
730
731 result
732 }
733}
734
735impl TextSplitterTrait for RecursiveSplitter {

Callers 1

recursive_splitMethod · 0.80

Calls 2

lenMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected