UNPKG

@aituber-onair/voice

Version:

Voice synthesis library for AITuber OnAir

44 lines (43 loc) 1.36 kB
import { EmotionType } from '../types/voice'; /** * Regular expressions for emotion tag parsing */ export declare const EMOTION_TAG_REGEX: RegExp; export declare const EMOTION_TAG_CLEANUP_REGEX: RegExp; /** * Result of emotion extraction */ export interface EmotionExtractionResult { emotion?: string; cleanText: string; } /** * Utility class for parsing and handling emotion tags in text */ export declare class EmotionParser { /** * Extract emotion from text and return clean text * @param text Text that may contain emotion tags like [happy] * @returns Object containing extracted emotion and clean text */ static extractEmotion(text: string): EmotionExtractionResult; /** * Check if an emotion is valid * @param emotion Emotion string to validate * @returns True if the emotion is valid */ static isValidEmotion(emotion: string): emotion is EmotionType; /** * Remove all emotion tags from text * @param text Text containing emotion tags * @returns Clean text without emotion tags */ static cleanEmotionTags(text: string): string; /** * Add emotion tag to text * @param emotion Emotion to add * @param text Text content * @returns Text with emotion tag prepended */ static addEmotionTag(emotion: string, text: string): string; }