我正在开发语音识别应用。如何以编程方式检查语音识别服务是启用还是禁用。请检查下面的代码并让我知道解决方案。
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 RecognitionResultnullWindows.Phone.Speech.Recognition.SpeechRecognitionResult ResultStatusPrivacyPolicyDeclined
更多推荐
如何在Windows Phone 8应用程序中进行语音识别服务
发布评论