热门将MS Web-Chat组件与Google-Speech-To-Text API集成?

时间:2019-04-14 13:08:07

标签: javascript botframework microsoft-cognitive google-speech-api

根据Microsoft文档,我们可以如下配置Web-Chat组件以使用我们自己的自定义语音识别

const speechOptions = {
    speechRecognizer: new YourOwnSpeechRecognizer(),
    speechSynthesizer: new YourOwnSpeechSynthesizer()
  };

如何在JAVASCRIPT中实现“ YourOwnSpeechRecognizer”?

1 个答案:

答案 0 :(得分:0)

这是您必须要做的事情:-

export interface ISpeechRecognizer {
    locale: string;
    isStreamingToService: boolean;
    referenceGrammarId: string; // unique identifier to send to the speech implementation to bias SR to this scenario

    onIntermediateResult: Func<string, void>;
    onFinalResult: Func<string, void>;
    onAudioStreamingToService: Action;
    onRecognitionFailed: Action;

    warmup(): void;
    setGrammars(grammars?: string[]): void;
    startRecognizing(): Promise<void>;
    stopRecognizing(): Promise<void>;
    speechIsAvailable(): boolean;
}

您必须提供实现ISpeechRecognizer的自定义语音识别。

希望有帮助。