【问题标题】:When I try to set a language to SpeechRecognize (WP 8.1) doesn't work当我尝试将语言设置为 SpeechRecognize (WP 8.1) 时不起作用
【发布时间】:2015-08-13 00:43:44
【问题描述】:

当我尝试将语言设置为 SpeechRecognize (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();

        }

有人可以帮助我吗?

【问题讨论】:

    标签: c# windows-phone-8.1 speechsynthesizer


    【解决方案1】:

    我认为这是因为您安装的 Locale 不是那种语言。如果你想确定,试试这个:

    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);
                }
    
        }
    

    【讨论】:

      猜你喜欢
      • 2016-06-19
      • 1970-01-01
      • 2020-01-20
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 2019-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多