-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Currently chunks are split into an Iterator<str>
without context for what part of the document they came from. For instance markdown subheadings dont have context for their parent heading.
Instead of returning raw strings we could instead provide some more context:
struct Chunk<'text>{
/// information for which part of a document hierarchy the chunk belongs to.
/// This will differ depending on the splitter.
breadcrumbs: Vec<&'text str>,
/// The raw content of the split text
content: &'text str
}
Related to #116, it would also be valuable for code chunks. I haven't looked into tree-sitter
but we could at least do this for rust files using syn
.
As an alternative maybe Chunk
could be a trait, and each splitter has its own metadata types.
trait Chunk<'text>{
fn content(&self)-> &'text str;
}
Metadata
Metadata
Assignees
Labels
No labels