如何更改 bing 聊天机器人的语言
How can I change language on bing speech in bot
我在 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'.
还有我可以根据用户使用的语言更改语言的方法吗?
有 2 个不同的项目:语音输入 (SpeechRecognizer) 和语音输出 (SpeechSynthesizer)
语音识别器
有一个可选的 locale
参数,您可以像传递 subscriptionKey
一样传递它,请参阅 sources:
export interface ICognitiveServicesSpeechRecognizerProperties {
locale?: string,
subscriptionKey?: string,
fetchCallback?: (authFetchEventId: string) => Promise<string>,
fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
}
如果 none 提供 (source):
const locale = properties.locale || 'en-US';
语音合成器
使用gender
和voiceName
参数(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
我在 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'.
还有我可以根据用户使用的语言更改语言的方法吗?
有 2 个不同的项目:语音输入 (SpeechRecognizer) 和语音输出 (SpeechSynthesizer)
语音识别器
有一个可选的 locale
参数,您可以像传递 subscriptionKey
一样传递它,请参阅 sources:
export interface ICognitiveServicesSpeechRecognizerProperties {
locale?: string,
subscriptionKey?: string,
fetchCallback?: (authFetchEventId: string) => Promise<string>,
fetchOnExpiryCallback?: (authFetchEventId: string) => Promise<string>
}
如果 none 提供 (source):
const locale = properties.locale || 'en-US';
语音合成器
使用gender
和voiceName
参数(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