Project Files
dist / preparer.d.ts
/**
* @file preparer.ts
* @description Podcast script preparation pipeline for VibeVoice TTS.
*
* Handles the full preparation workflow:
* - Abbreviation expansion (first-use or all)
* - Direction tag extraction ([emphasis], [slower], etc.)
* - Pause marker conversion ([pause 1s] → empty lines)
* - Sentence splitting & paragraph breaking
* - Script chunking (~500 words per chunk)
* - TTS parameter recommendations
*
* VibeVoice specifics:
* - Empty lines = natural pauses
* - No SSML support — plain text only
* - Max ~500 words per chunk for best quality
* - 150-170 WPM is standard podcast speaking rate
*/
import type { ScriptChunk, TTSRecommendations, PauseMarker, PrepareResult, DirectionTag } from "./types";
/**
* Expand common abbreviations for TTS clarity.
* `firstUseOnly`: expand only the first occurrence of each abbreviation.
* `all`: expand every occurrence.
*/
export declare function expandAbbreviations(text: string, options?: {
firstUseOnly?: boolean;
all?: boolean;
}): string;
/**
* Extract direction tags from text and return them as user-facing hints.
* Unlike emotion annotations, direction tags are preserved as metadata
* to guide the human operator on TTS parameter adjustments.
*/
export declare function extractDirectionTags(text: string): {
cleanedText: string;
directions: Array<{
tag: DirectionTag;
position: number;
context: string;
}>;
};
/**
* Convert explicit [pause Xs] markers to empty lines.
* VibeVoice interprets empty lines as natural pauses.
*/
export declare function convertPauseMarkers(text: string): {
convertedText: string;
pauses: PauseMarker[];
};
/**
* Convert bracket-based expression markers to VibeVoice expression tags.
* E.g., `[laughs]` → `<laughs>`, `[sighs]` → `<sighs>`.
*
* Supports ANY expression — not just known tags. The model can invent
* new ones freely: `[roar]` → `<roar>`, `[sing softly]` → `<sing softly>`.
*/
export declare function convertExpressionBrackets(text: string): {
convertedText: string;
expressions: Array<{
tag: string;
position: number;
original: string;
}>;
};
/**
* Split a paragraph into sentences.
* Handles common edge cases: abbreviations, decimal numbers, ellipsis.
*/
export declare function splitIntoSentences(paragraph: string): string[];
/**
* Split long paragraphs into smaller chunks of max N sentences.
* Returns an array of shorter paragraphs.
*/
export declare function splitParagraphs(text: string, maxSentences?: number): string[];
/**
* Count words in text (handles multi-language).
*/
export declare function countWords(text: string): number;
/**
* Split a prepared script into chunks of approximately `targetWords` words.
* Chunks are aligned with paragraph boundaries when possible.
*/
export declare function chunkScript(text: string, targetWords?: number): ScriptChunk[];
/**
* Generate TTS parameter recommendations based on script analysis.
*/
export declare function generateTTSRecommendations(text: string, chunkSize?: number): TTSRecommendations;
/**
* Run the full podcast script preparation pipeline.
*
* Steps:
* 1. Expand abbreviations
* 2. Extract direction tags (preserve as metadata)
* 3. Convert pause markers to empty lines
* 4. Split long paragraphs
* 5. Chunk the script
* 6. Generate TTS recommendations
*/
export declare function prepareScript(text: string, params?: {
chunkSize?: number;
paragraphPauses?: boolean;
sentencePauses?: boolean;
maxSentencesPerParagraph?: number;
expandAbbreviations?: boolean;
preserveDirections?: boolean;
output?: "plain" | "script" | "json";
}): PrepareResult;
//# sourceMappingURL=preparer.d.ts.map