Exemple #1
0
        private async void ContinuousRecognitionSession_ResultGenerated(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession sender, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs args)
        {
            var sResult = args.Result;

            processInfo(sResult);
            //if (sResult.SemanticInterpretation.Properties.ContainsKey("TURNON")&&sResult.SemanticInterpretation.Properties["TURNON"][0].ToString() != "...")
            //{
            //    string objectX = sResult.SemanticInterpretation.Properties["TURNON"][0].ToString();
            //    var messageDialog = new Windows.UI.Popups.MessageDialog(objectX + " is turned on.", "Text spoken");
            //    await messageDialog.ShowAsync();
            //    return;
            //}
            //if (sResult.SemanticInterpretation.Properties.ContainsKey("TURNOFF") && sResult.SemanticInterpretation.Properties["TURNOFF"][0].ToString() != "...")
            //{
            //    string objectX = sResult.SemanticInterpretation.Properties["TURNOFF"][0].ToString();
            //    var messageDialog = new Windows.UI.Popups.MessageDialog(objectX + " is turned off.", "Text spoken");
            //    await messageDialog.ShowAsync();
            //    return;
            //}
            //if (sResult.SemanticInterpretation.Properties.ContainsKey("TURNONALL") && sResult.SemanticInterpretation.Properties["TURNONALL"][0].ToString() != "...")
            //{
            //    string objectX = sResult.SemanticInterpretation.Properties["TURNONALL"][0].ToString();
            //    var messageDialog = new Windows.UI.Popups.MessageDialog(String.Format("All {0} are turned on.",objectX));
            //    await messageDialog.ShowAsync();
            //    return;
            //}
            //if (sResult.SemanticInterpretation.Properties.ContainsKey("TURNOFFALL") && sResult.SemanticInterpretation.Properties["TURNOFFALL"][0].ToString() != "...")
            //{
            //    string objectX = sResult.SemanticInterpretation.Properties["TURNOFFALL"][0].ToString();
            //    var messageDialog = new Windows.UI.Popups.MessageDialog(String.Format("All {0} are turned off.", objectX));
            //    await messageDialog.ShowAsync();
            //    return;
            //}
        }
        private void ContinuousRecognitionSession_ResultGenerated(SR.SpeechContinuousRecognitionSession sender, SR.SpeechContinuousRecognitionResultGeneratedEventArgs args)
        {
            if (args.Result.Status == SR.SpeechRecognitionResultStatus.Success)
            {
                Debug.WriteLine("Result Text:{0}, Confidence:{1}({2:F4}), Constraint:{3})",
                                args.Result.Text,
                                args.Result.Confidence,
                                args.Result.RawConfidence,
                                (args.Result.Constraint != null) ? args.Result.Constraint.Tag : "<No tag>");
                if (
                    (args.Result.Confidence == SR.SpeechRecognitionConfidence.High) ||
                    (args.Result.Confidence == SR.SpeechRecognitionConfidence.Medium))
                {
                    switch (args.Result.Constraint.Tag)
                    {
                    case "EnableCommanding":
                        ProcessSpeechStatusChangeCommand(args.Result);
                        break;

                    case "Commands":
                        ProcessSpeechCommand(args.Result);
                        break;

                    default:
                        Debug.WriteLine($"**** Unknown constraint '{args.Result.Constraint.Tag}'");
                        break;
                    }
                }
            }
            else
            {
                Debug.WriteLine("Result: status({0})", args.Result.Status);
            }
        }
 private void ContinuousRecognitionSession_Completed(SR.SpeechContinuousRecognitionSession sender, SR.SpeechContinuousRecognitionCompletedEventArgs args)
 {
     Debug.WriteLine($"--> Speech reco session completed: {args.Status}");
     if (IsActive)
     {
         IsActive = false;
         Activated(this, IsActive);
     }
 }
Exemple #4
0
        private async void ContinuousRecognitionSession_ResultGenerated(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession sender, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs args)
        {
            Debug.WriteLine(JsonConvert.SerializeObject(args.Result));

            if (args.Result.Confidence == Windows.Media.SpeechRecognition.SpeechRecognitionConfidence.High ||
                args.Result.Confidence == Windows.Media.SpeechRecognition.SpeechRecognitionConfidence.Medium)
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    HandleRecognitionResult(args.Result);
                });
            }
            else
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    Debug.WriteLine("I'm sorry I did not understand your command. Please say again");
                });
            }
        }
Exemple #5
0
 private void ContinuousRecognitionSession_Completed(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession sender, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs args)
 {
     Debug.WriteLine("Continous Recognition Session Completed.");
 }
Exemple #6
0
 private void ContinuousRecognitionSession_Completed(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession sender, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs args)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
        private async void ContinuousRecognitionSession_ResultGenerated(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession sender, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs args)
        {
            var sResult = args.Result;

            processInfo(sResult);
        }