pub trait ChunkingStrategy: Send + Sync {
// Required method
fn chunk(&self, text: &str) -> Vec<TextChunk>;
}Expand description
Core trait for text chunking strategies
This trait provides a simple interface for different chunking approaches. Implementations can range from simple text splitters to sophisticated AST-based code chunking strategies.
§Examples
use graphrag_core::{ChunkingStrategy, TextChunk};
struct SimpleChunker;
impl ChunkingStrategy for SimpleChunker {
fn chunk(&self, text: &str) -> Vec<TextChunk> {
// Simple implementation
vec![]
}
}