Azure Speech API 语言

Azure Speech API language

我已经在网页上实现了聊天功能,可以使用 Azure 语音 API 使用语音转文本。它工作正常,但我不明白在哪里可以设置 API 可以理解的语言。 我想让它听懂法语,但当我用法语说话时,它会用熟悉的声音用英语单词转录。 如何/在哪里设置语言? 我明确表示我不是在 Azure 仪表板上设置服务的人。

有一个 locale 参数,您可以像下面这样选择使用 example:

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

如果您不提供值,则使用以下 example

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

您可以找到这些参数的可能值 here

SpeechSDK supports recognition in different languages, please check samples here.

谢谢,