当我尝试将语言设置为语音识别(WP 8.1)不工作

本文关键字:WP 工作 语音识别 设置 语言 | 更新日期: 2023-09-27 18:07:31

当我尝试将语言设置为语音识别(Windows Phone 8.1)时,它会运行异常。但是在文档中告诉我要按我的方式做D;

private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var rec = new SpeechRecognizer();
            await rec.CompileConstraintsAsync();
            rec.UIOptions.AudiblePrompt = "Aguardando o comando";
            var stream = await rec.RecognizeWithUIAsync();
        }

这行不通:

private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
             var rec = new SpeechRecognizer(new Windows.Globalization.Language("pt-BR"));
            await rec.CompileConstraintsAsync();
            rec.UIOptions.AudiblePrompt = "Aguardando o comando";
            var stream = await rec.RecognizeWithUIAsync();
        }

谁能帮我一下?

当我尝试将语言设置为语音识别(WP 8.1)不工作

我认为这是因为您安装的区域设置不是该语言。如果你想确定,试试这个:

private async void Button_Click_1(object sender, RoutedEventArgs e)
    {
           try(){
         var rec = new SpeechRecognizer(new Windows.Globalization.Language("pt-BR"));
        await rec.CompileConstraintsAsync();
        rec.UIOptions.AudiblePrompt = "Aguardando o comando";
        var stream = await rec.RecognizeWithUIAsync();
            }
         catch(Exception e)
           {
             Debug.WriteLine(e);
            }
    }