Beispiel #1
0
        /// <summary>
        /// This event is fired after the user pauses, typically at the end of a sentence. The full recognized string is returned here.
        /// </summary>
        /// <param name="text">The text that was heard by the recognizer.</param>
        /// <param name="confidence">A representation of how confident (rejected, low, medium, high) the recognizer is of this recognition.</param>
        private async void DictationRecognizer_DictationResult(string text, ConfidenceLevel confidence)
        {
            // We have final text
            dictationResult = text;

            // Clear intermediate text
            textSoFar.Clear();

            // Make sure we have a minimum confidence level
            if (confidence > minimumConfidenceLevel) // Numerically this is inverted. Lower confidence levels are higher numbers.
            {
                LogWarn($"Heard '{dictationResult}' but confidence was too low.");
            }
            else
            {
                if (luisManager != null)
                {
                    LogInfo($"Heard '{dictationResult}', sending to LUIS.");
                    await luisManager.PredictAndHandleAsync(text);
                }
                else
                {
                    LogError($"Heard '{dictationResult}' but no LuisManager available.");
                }
            }
        }
Beispiel #2
0
        public async void OnSpeechResult(string speechResult)
        {
            // No longer listening
            isListening = false;

            // We have final text
            dictationResult = speechResult;

            if (luisManager != null)
            {
                LogInfo($"Heard '{dictationResult}', sending to LUIS.");
                await luisManager.PredictAndHandleAsync(dictationResult);
            }
            else
            {
                LogError($"Heard '{dictationResult}' but no LuisManager available.");
            }

            // If continuous, start again.
            if (continuousRecognition)
            {
                StartListeningAndroid();
            }
        }