UNPKG

@euirim/microsoft-cognitiveservices-speech-sdk

Version:
61 lines (60 loc) 4 kB
import { ConnectionEvent, EventSource, IAudioSource, IAudioStreamNode, IConnection, IDisposable, Promise } from "../common/Exports"; import { CancellationErrorCode, CancellationReason, Recognizer, SpeechRecognitionResult } from "../sdk/Exports"; import { AgentConfig, DynamicGrammarBuilder, RecognitionMode, RequestSession, SpeechContext } from "./Exports"; import { IAuthentication } from "./IAuthentication"; import { IConnectionFactory } from "./IConnectionFactory"; import { RecognizerConfig } from "./RecognizerConfig"; import { SpeechConnectionMessage } from "./SpeechConnectionMessage.Internal"; export declare abstract class ServiceRecognizerBase implements IDisposable { private privAuthentication; private privConnectionFactory; private privAudioSource; private privSpeechServiceConfigConnectionId; private privConnectionConfigurationPromise; private privConnectionPromise; private privAuthFetchEventId; private privIsDisposed; private privMustReportEndOfStream; private privConnectionEvents; private privSpeechContext; private privDynamicGrammar; private privAgentConfig; protected privRequestSession: RequestSession; protected privConnectionId: string; protected privRecognizerConfig: RecognizerConfig; protected privRecognizer: Recognizer; constructor(authentication: IAuthentication, connectionFactory: IConnectionFactory, audioSource: IAudioSource, recognizerConfig: RecognizerConfig, recognizer: Recognizer); readonly audioSource: IAudioSource; readonly speechContext: SpeechContext; readonly dynamicGrammar: DynamicGrammarBuilder; readonly agentConfig: AgentConfig; isDisposed(): boolean; dispose(reason?: string): void; readonly connectionEvents: EventSource<ConnectionEvent>; readonly recognitionMode: RecognitionMode; protected recognizeOverride: (recoMode: RecognitionMode, sc: (e: SpeechRecognitionResult) => void, ec: (e: string) => void) => any; recognize(recoMode: RecognitionMode, successCallback: (e: SpeechRecognitionResult) => void, errorCallBack: (e: string) => void): Promise<boolean>; stopRecognizing(): void; connect(): void; protected disconnectOverride: () => any; disconnect(): void; static telemetryData: (json: string) => void; static telemetryDataEnabled: boolean; sendMessage(message: string): void; protected abstract processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage, successCallback?: (e: SpeechRecognitionResult) => void, errorCallBack?: (e: string) => void): void; protected sendTelemetryData: () => Promise<boolean> | Promise<Promise<boolean>>; protected abstract cancelRecognition(sessionId: string, requestId: string, cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string, cancelRecoCallback: (r: SpeechRecognitionResult) => void): void; protected cancelRecognitionLocal(cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string, cancelRecoCallback: (r: SpeechRecognitionResult) => void): void; protected receiveMessageOverride: (sc?: (e: SpeechRecognitionResult) => void, ec?: (e: string) => void) => any; protected receiveMessage: (successCallback: (e: SpeechRecognitionResult) => void, errorCallBack: (e: string) => void) => Promise<IConnection>; protected sendSpeechContext: (connection: IConnection) => Promise<boolean>; protected connectImplOverride: (isUnAuthorized: boolean) => any; protected connectImpl(isUnAuthorized?: boolean): Promise<IConnection>; protected configConnectionOverride: () => any; protected fetchConnectionOverride: () => any; protected sendSpeechServiceConfig: (connection: IConnection, requestSession: RequestSession, SpeechServiceConfigJson: string) => Promise<boolean>; protected sendAudio: (audioStreamNode: IAudioStreamNode) => Promise<boolean>; private sendFinalAudio; private fetchConnection; private configureConnection; }