Split by characters when no other separator works
(&self, text: &str)
| 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 | |
| 735 | impl TextSplitterTrait for RecursiveSplitter { |
no test coverage detected