@responsivevoice/text
v2.0.0
Published
Text processing utilities for ResponsiveVoice TTS - chunking, preprocessing, and normalization
Readme
Internal package — published as a dependency of
@responsivevoice/core. You usually do not install this directly.
Installation
npm install @responsivevoice/textUsage
import {
chunkText,
getEstimatedTimeLength,
djb2Hash,
} from '@responsivevoice/text';
const chunks = chunkText('Long text to split for TTS...', {
characterLimit: 100,
});
const durationMs = getEstimatedTimeLength('Hello, how are you today?');
const hash = djb2Hash('Hello world');API
| Export | Description |
| -------------------------------- | ---------------------------------------------------------- |
| chunkText | Split text into chunks respecting sentence/word boundaries |
| createTextChunker | Create a reusable chunker with configured options |
| hasCJKContent | Detect CJK characters for language-aware chunking |
| getEstimatedTimeLength | Estimate speech duration in ms (with text preprocessing) |
| getEstimatedTimeLengthWithRate | Estimate duration adjusted for speech rate |
| djb2Hash | Fast DJB2 string hash |
License
MIT
