UNPKG

chonkie

Version:

🦛 CHONK your texts in TS with Chonkie!✨The no-nonsense lightweight and efficient chunking library.

44 lines (43 loc) • 1.14 kB
export interface Chunk { text: string; start_index: number; end_index: number; token_count?: number; } /** * Visualizer class for Chonkie. * * This class can take in Chonkie Chunks and visualize them on the terminal * or save them as a standalone HTML file. */ export declare class Visualizer { private static readonly HIPPO_SVG_CONTENT; private readonly theme; private readonly textColor; private readonly themeName; constructor(theme?: string | string[]); /** * Get the theme from the theme name. */ private getTheme; /** * Get a color from the theme based on index. */ private getColor; /** * Darken a hex color by a multiplier (0 to 1). */ private darkenColor; /** * Print the chunks to the terminal. */ print(chunks: Chunk[], fullText?: string): void; /** * Save the chunk visualization as a standalone HTML file. */ save(filename: string, chunks: Chunk[], fullText?: string, title?: string): void; /** * Return the string representation of the Visualizer. */ toString(): string; }