Example #1
0
        private void ClientOnResponseReceived(object sender, SpeechResponseEventArgs speechResponseEventArgs)
        {
            var status = speechResponseEventArgs.PhraseResponse.RecognitionStatus;

            if (status == RecognitionStatus.EndOfDictation ||
                status == RecognitionStatus.DictationEndSilenceTimeout)
            {
                OnEndRecognition(new EndEventArgs {
                    EndReasonText = status.ToString()
                });
            }
            else
            {
                foreach (var phraseResponseResult in speechResponseEventArgs.PhraseResponse.Results)
                {
                    var item = new RecognitionItem();
                    item.Text        = phraseResponseResult.DisplayText;
                    item.Confidence  = phraseResponseResult.Confidence.ToString();
                    item.LexicalForm = phraseResponseResult.LexicalForm;
                    OnRecognition(item);
                }
            }
        }
Example #2
0
 protected virtual void OnRecognition(RecognitionItem item)
 {
     Recognition?.Invoke(this, new RecognizedEventArgs(item));
 }