3

我在 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'。

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

4

1 回答 1

1

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

语音识别器

locale您可以像 pass 一样传递一个可选参数subscriptionKey,请参阅来源

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

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

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

语音合成器

用途gendervoiceName参数(来源):

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

于 2018-01-24T13:48:55.623 回答