如何在Windows Phone 8应用程序中进行语音识别服务 [英] How to enable speech recognition service in windows phone 8 app progrmmatically

查看:56
本文介绍了如何在Windows Phone 8应用程序中进行语音识别服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发语音识别应用。如何以编程方式检查语音识别服务是启用还是禁用。请检查下面的代码并让我知道解决方案。   
        

I am developing  speech recognition app. How can i check programmatically whether the  speech recognition service enable or disable. Please check below code and let me know the solution.            

              var _englishRecognizer = InstalledSpeechRecognizers.All.FirstOrDefault(d => d.Language.ToUpper()==" EN-US");

              var speechRecognition = new SpeechRecognizer();

              speechRecognition.SetRecognizer(_englishRecognizer);

              speechRecognition.Settings.EndSilenceTimeout = TimeSpan.FromSeconds(1.2);

              var recoResult = await speechRecognition.RecognizeAsync();



                if(recoResult.TextConfidence == SpeechRecognitionConfidence.High ||

          recoResult.TextConfidence == SpeechRecognitionConfidence.Medium || recoResult。正文!= null)

                {

              var _englishRecognizer = InstalledSpeechRecognizers.All.FirstOrDefault(d => d.Language.ToUpper() == "EN-US");
              var speechRecognition = new SpeechRecognizer();
              speechRecognition.SetRecognizer(_englishRecognizer);
              speechRecognition.Settings.EndSilenceTimeout = TimeSpan.FromSeconds(1.2);
              var recoResult = await speechRecognition.RecognizeAsync();

                if (recoResult.TextConfidence == SpeechRecognitionConfidence.High ||
                  recoResult.TextConfidence == SpeechRecognitionConfidence.Medium || recoResult.Text != null)
                {

                 }

                 }

Sudhanthira

Sudhanthira

推荐答案

如果您向清单添加ID_CAP_SPEECH_RECOGNITION,则该应用将不会安装在没有该功能的手机上。 

If you add  ID_CAP_SPEECH_RECOGNITION to the manifest the app will not install on phones that do not have that capability. 

这就是你所追求的吗?

之后如果你打电话给服务但它关闭它会提示转动它on:

After that if you call the service and it is off it will prompt to turn it on:

等待YOURRECOGNIZER.RecognizeWithUIAsync();

await YOURRECOGNIZER.RecognizeWithUIAsync();

可以测试返回值以查看它们是否已拒绝:

the return value can be tested to see if they declined:

Windows.Phone.Speech.Recognition.SpeechRecognitionUIResult

  ;  RecognitionResult  null  Windows.Phone.Speech.Recognition.SpeechRecognitionResult

   ResultStatus  PrivacyPolicyDeclined 

Windows.Phone.Speech.Recognition.SpeechRecognitionUIResult
  RecognitionResult null Windows.Phone.Speech.Recognition.SpeechRecognitionResult
  ResultStatus PrivacyPolicyDeclined 


这篇关于如何在Windows Phone 8应用程序中进行语音识别服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆