【问题标题】:How can I change language on bing speech in bot如何在 bot 中更改 bing 语音的语言
【发布时间】:2018-01-24 12:28:53
【问题描述】:

我在 botframeowrk 中使用 bing 语音,如下所示:

var speechOptions = 
{
    speechRecognizer: new CognitiveServices.SpeechRecognizer(
    {
        subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY'
    }),
    speechSynthesizer: new CognitiveServices.SpeechSynthesizer(
    {
        subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY',
        gender: CognitiveServices.SynthesisGender.Female,
        voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
    })
}

我想将语言从 'en-us' 更改为其他语言,有没有我应该添加的选项,例如 lang:'it-it'。

还有一种方法可以让我根据用户说的语言更改语言吗?

【问题讨论】:

    标签: speech-recognition botframework bing-speech


    【解决方案1】:

    有2个不同的项目:语音输入(SpeechRecognizer)和语音输出(SpeechSynthesizer)

    语音识别器

    有一个可选的locale参数可以像传递subscriptionKey一样传递,见sources

    export interface ICognitiveServicesSpeechRecognizerProperties {
        locale?: string,
        subscriptionKey?: string,
        fetchCallback?: (authFetchEventId: string) => Promise<string>,
        fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
    }
    

    如果没有提供,则有一个后备 (source):

    const locale = properties.locale || 'en-US';
    

    语音合成器

    使用gendervoiceName参数(sources):

    export interface ICognitiveServicesSpeechSynthesisProperties {
        subscriptionKey?: string,
        gender?: SynthesisGender,
        voiceName?: string,
        fetchCallback?: (authFetchEventId: string) => Promise<string>,
        fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
    }
    

    对于这些参数的可能值,您可以在此处找到一个列表:https://docs.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/bingvoiceoutput#SupLocales

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-26
      • 2017-02-17
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      • 2016-05-20
      相关资源
      最近更新 更多