hama-js
Version:
G2P, phoneme-ASR, and P2G inference for Node, Bun, and browsers, powered by a self-contained WASM engine (no onnxruntime).
18 lines (17 loc) • 793 B
TypeScript
export declare const P2G_SPECIAL_TOKENS: Set<string>;
export declare const normalizePhonemeTokens: (value: string | readonly string[]) => string[];
export declare const renderText: (tokens: readonly string[]) => string;
export declare const normalizeP2gText: (text: string) => string;
export interface P2GAlignment {
token: string;
phonemeIndex: number;
phoneme: string;
}
export interface P2GDecoded {
text: string;
tokens: string[];
alignments: P2GAlignment[];
}
/** Filter special tokens and pair each kept output token with its source-phoneme
* alignment, shared by the Node and browser P2G models. */
export declare const decodeP2GOutput: (genIds: readonly number[], align: readonly number[], tokens: readonly string[], source: readonly string[]) => P2GDecoded;