/** * TTS Text Processing Utilities * * Stateless utility functions for text segmentation and NDJSON processing. * These functions are designed to be pure functions without side effects. */ /** * Split input text into sentence chunks suitable for TTS processing. * * Enhanced version that implements intelligent text segmentation respecting * sentence boundaries while ensuring each chunk stays within TTS API limits. * It handles various punctuation patterns and provides graceful fallback to * word/character boundaries when necessary. * * Chunking Strategy: * 1. First, split by sentence boundaries (multilingual punctuation) * 2. Merge sentences into chunks up to maxLength * 3. If a sentence exceeds maxLength: * - For text with spaces: split by words * - For text without spaces (Japanese, etc.): split by characters * * @param text - Input text to be segmented * @param maxLength - Maximum length of each chunk * @returns Array of text chunks, each guaranteed to be <= maxLength */ export declare function chunkText(text: string, maxLength?: number): string[]; /** * Extract audio data from NDJSON response. * * Handles both single JSON object and NDJSON (multiple lines) formats. * Decodes base64-encoded audio data and returns as binary. * * @param ndjsonStr - NDJSON string containing audio_base64 field * @returns Decoded binary audio data */ export declare function extractAudioFromNdjson(ndjsonStr: string): Uint8Array; //# sourceMappingURL=text_utils.d.ts.map