import { Tokenizer } from "./tokenizer.js"; import { Chunk } from "./types.js"; //#region src/table.d.ts interface TableChunkerOptions { /** * Tokenizer to use. Use 'row' (default) for row-based chunking, * or any tokenizer string/instance for token-based chunking. */ tokenizer?: Tokenizer | 'row' | string; /** * Maximum chunk size. For 'row' tokenizer, this is max data rows per chunk. * For other tokenizers, this is max tokens per chunk. * Default: 3 */ chunkSize?: number; } /** * Chunks markdown or HTML tables by splitting rows into smaller sub-tables, * each repeating the original header. * * Supports two modes: * - Row mode ('row' tokenizer): groups up to `chunkSize` data rows per chunk * - Token mode (any other tokenizer): fits as many rows as possible within `chunkSize` tokens */ declare class TableChunker { readonly chunkSize: number; private tokenizer; private readonly isRowMode; private constructor(); /** * Create a TableChunker instance. * * @param options - Configuration options * @returns Promise resolving to TableChunker instance * * @example * // Row-based (default): each chunk has at most 3 data rows * const chunker = await TableChunker.create(); * * @example * // Row-based with custom row count * const chunker = await TableChunker.create({ tokenizer: 'row', chunkSize: 5 }); * * @example * // Token-based chunking * const chunker = await TableChunker.create({ tokenizer: 'character', chunkSize: 512 }); */ static create(options?: TableChunkerOptions): Promise; /** * Split a markdown table into its header (column names + separator line) * and an array of data row strings. */ private splitMarkdownTable; /** * Extract ... row strings from HTML body content. */ private findHtmlRows; /** * Split an HTML table into its header (everything up to tbody content) * and an array of row strings. */ private splitHtmlTable; /** * Chunk a markdown or HTML table into smaller sub-tables, each repeating the header. * * @param text - The input markdown or HTML table as a string * @returns Array of chunks */ chunk(text: string): Chunk[]; private chunkByRows; private chunkByTokens; toString(): string; } //#endregion export { TableChunker, TableChunkerOptions }; //# sourceMappingURL=table.d.ts.map