Exemple #1
0
        private void Recognizer_Result(object sender, SpeechResultEvent e)
        {
            bool isFinalResult = e.FinalResult;

            if (e.Hypothesis != null)
            {
                System.Diagnostics.Debug.WriteLine(e.Hypothesis.Hypstr);
            }
        }
Exemple #2
0
        private void Recognizer_Result(object sender, SpeechResultEvent e)
        {
            bool isFinalResult = e.FinalResult;

            if (e.Hypothesis != null && e.Hypothesis.Hypstr.Count() > 0 && (n != e.Hypothesis.Hypstr.Count())) // e.Hypothesis.Hypstr expands when words are detected
            {
                lastHypo = e.Hypothesis.Hypstr.Substring(0, e.Hypothesis.Hypstr.Count() - n);                  // get the last word detected (the first one in Hypstr)
                n        = e.Hypothesis.Hypstr.Count();

                if (MainPage.ViewModel.IsKeyphraseMode == true)
                {
                    MainPage.ViewModel.Hypothesis = lastHypo;
                }
                else if (MainPage.ViewModel.IsKeywordsMode == true)
                {
                    MainPage.ViewModel.Hypothesis = lastHypo;
                    System.Diagnostics.Debug.WriteLine($"\nYou said: {lastHypo}");
                }
            }
        }