@picovoice/cheetah-web
Version:
Cheetah Speech-to-Text engine for web browsers (via WebAssembly)
84 lines • 2.56 kB
TypeScript
import { PvModel } from '@picovoice/web-utils';
import { CheetahError } from './cheetah_errors';
export declare enum PvStatus {
SUCCESS = 10000,
OUT_OF_MEMORY = 10001,
IO_ERROR = 10002,
INVALID_ARGUMENT = 10003,
STOP_ITERATION = 10004,
KEY_ERROR = 10005,
INVALID_STATE = 10006,
RUNTIME_ERROR = 10007,
ACTIVATION_ERROR = 10008,
ACTIVATION_LIMIT_REACHED = 10009,
ACTIVATION_THROTTLED = 10010,
ACTIVATION_REFUSED = 10011
}
/**
* CheetahModel types
*/
export type CheetahModel = PvModel;
export type CheetahOptions = {
/** @defaultValue 'best' */
device?: string;
/** @defaultValue 1.0 */
endpointDurationSec?: number;
/** @defaultValue false */
enableAutomaticPunctuation?: boolean;
/** @defaultValue false */
enableTextNormalization?: boolean;
/** @defaultValue undefined */
processErrorCallback?: (error: CheetahError) => void;
};
export type CheetahTranscript = {
transcript: string;
isEndpoint?: boolean;
isFlushed?: boolean;
};
export type CheetahWorkerInitRequest = {
command: 'init';
accessKey: string;
modelPath: string;
options: CheetahOptions;
wasmSimd: string;
wasmSimdLib: string;
wasmPThread: string;
wasmPThreadLib: string;
sdk: string;
};
export type CheetahWorkerProcessRequest = {
command: 'process';
inputFrame: Int16Array;
};
export type CheetahWorkerFlushRequest = {
command: 'flush';
};
export type CheetahWorkerReleaseRequest = {
command: 'release';
};
export type CheetahWorkerRequest = CheetahWorkerInitRequest | CheetahWorkerProcessRequest | CheetahWorkerFlushRequest | CheetahWorkerReleaseRequest;
export type CheetahWorkerFailureResponse = {
command: 'failed' | 'error';
status: PvStatus;
shortMessage: string;
messageStack: string[];
};
export type CheetahWorkerInitResponse = CheetahWorkerFailureResponse | {
command: 'ok';
frameLength: number;
sampleRate: number;
version: string;
};
export type CheetahWorkerProcessResponse = CheetahWorkerFailureResponse | {
command: 'ok';
cheetahTranscript: CheetahTranscript;
};
export type CheetahWorkerFlushResponse = CheetahWorkerFailureResponse | {
command: 'ok';
cheetahTranscript: CheetahTranscript;
};
export type CheetahWorkerReleaseResponse = CheetahWorkerFailureResponse | {
command: 'ok';
};
export type CheetahWorkerResponse = CheetahWorkerInitResponse | CheetahWorkerProcessResponse | CheetahWorkerFlushResponse | CheetahWorkerReleaseResponse;
//# sourceMappingURL=types.d.ts.map