import { BaseChunker } from "./base.js"; /** A chunk and the units it covers, [start, end). */ export interface Span { text: string; start: number; end: number; } /** * Word-based recursive chunker with overlap. * * Words rather than characters produce chunks that align to natural * boundaries. Overlap keeps context across chunk edges. * * Scripts written without spaces (Chinese, Japanese, Thai, ...) have no word * boundaries to split on, so each of their characters counts as one unit. * Without this a whole unspaced document would be a single "word" and * therefore a single chunk of any length. */ export declare class RecursiveChunker extends BaseChunker { split(text: string): string[]; /** Like split(), with each chunk's unit range, for locating it in the source. */ spans(text: string): Span[]; } /** * Units in text as the chunker counts them. Counts add up across text joined * with whitespace, so offsets of pages or lines can be summed. */ export declare function countUnits(text: string): number;