Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Span ¶
type Span struct {
Start, End int
}
Span is a chunk's [Start, End) byte offsets in the text it was cut from; -1, -1 for a chunk that could not be found there.
func Align ¶
Align finds where each chunk lies in text. Chunks come in text order and may overlap (a chunker's overlap), so each is looked for from just after the previous chunk's start, within a window a little longer than the chunk past where the previous one ended. A chunker moves forward, so a chunk ends past the previous one: an occurrence lying wholly inside the previous chunk (repetitive text repeated a few characters in) is skipped for the next one, and each chunk takes its own occurrence, in order. A chunker that returns the text verbatim (NornicDB's own; Voyage's contextualized auto-chunking, checked against its API) is matched exactly; one that trims or collapses whitespace is matched with whitespace ignored. A chunk found neither way is -1, -1, and the next is looked for from the same place.