use embedcache::ContentChunker;
use async_trait::async_trait;
pub struct SentenceChunker;
#[async_trait]
impl ContentChunker for SentenceChunker {
async fn chunk(&self, content: &str, _size: usize) -> Vec<String> {
content
.split('.')
.map(|s| s.trim())
.filter(|s| !s.is_empty())
.map(|s| format!("{}.", s)) .collect()
}
fn name(&self) -> &str {
"sentence"
}
}
fn main() {
println!("This example shows how to implement a custom chunking strategy.");
println!("See the source code for implementation details.");
}