hama-js
Version:
G2P, phoneme-ASR, and P2G inference for Node, Bun, and browsers, powered by a self-contained WASM engine (no onnxruntime).
29 lines (28 loc) • 841 B
TypeScript
import { type P2GAlignment } from "./p2g-text.js";
export declare const P2G_MAX_INPUT_LEN = 192;
export declare const P2G_MAX_OUTPUT_LEN = 192;
export declare const P2G_MAX_SEQUENCE_LEN = 416;
export interface P2GOptions {
modelPath?: string;
vocabPath?: string;
}
export interface P2GResult {
text: string;
tokens: string[];
alignments: P2GAlignment[];
}
export declare class P2GNodeModel {
private readonly engine;
private readonly handle;
private readonly tokens;
private readonly token2id;
private readonly bos;
private readonly src;
private readonly tgt;
private readonly eos;
private readonly pad;
private readonly unk;
private constructor();
static create(options?: P2GOptions): Promise<P2GNodeModel>;
predict(phonemes: string | readonly string[]): P2GResult;
}