UNPKG

@picovoice/leopard-web

Version:

Leopard Speech-to-Text engine for web browsers (via WebAssembly)

82 lines 2.48 kB
import { PvModel } from '@picovoice/web-utils'; 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 } /** * LeopardModel types */ export type LeopardModel = PvModel; export type LeopardOptions = { /** @defaultValue false */ enableAutomaticPunctuation?: boolean; /** @defaultValue false */ enableDiarization?: boolean; }; export type LeopardWord = { /** Transcribed word. */ word: string; /** Start of word in seconds. */ startSec: number; /** End of word in seconds. */ endSec: number; /** Transcription confidence. It is a number within [0, 1]. */ confidence: number; /** The speaker tag is `-1` if diarization is not enabled during initialization; * otherwise, it's a non-negative integer identifying unique speakers, with `0` reserved for * unknown speakers. */ speakerTag: number; }; export type LeopardTranscript = { transcript: string; words: LeopardWord[]; }; export type LeopardWorkerInitRequest = { command: 'init'; accessKey: string; modelPath: string; options: LeopardOptions; wasm: string; wasmSimd: string; sdk: string; }; export type LeopardWorkerProcessRequest = { command: 'process'; inputFrame: Int16Array; transfer: boolean; }; export type LeopardWorkerReleaseRequest = { command: 'release'; }; export type LeopardWorkerRequest = LeopardWorkerInitRequest | LeopardWorkerProcessRequest | LeopardWorkerReleaseRequest; export type LeopardWorkerFailureResponse = { command: 'failed' | 'error'; status: PvStatus; shortMessage: string; messageStack: string[]; }; export type LeopardWorkerInitResponse = LeopardWorkerFailureResponse | { command: 'ok'; sampleRate: number; version: string; }; export type LeopardWorkerProcessResponse = LeopardWorkerFailureResponse | { command: 'ok'; result: LeopardTranscript; inputFrame?: Int16Array; }; export type LeopardWorkerReleaseResponse = LeopardWorkerFailureResponse | { command: 'ok'; }; export type LeopardWorkerResponse = LeopardWorkerInitResponse | LeopardWorkerProcessResponse | LeopardWorkerReleaseResponse; //# sourceMappingURL=types.d.ts.map