/// <summary> /// Called when the final recognition result received. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An object that contains the event data.</param> private void OnSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { // Convention for intervals is to use the end time as the originating time so we add the duration as well. DateTime originatingTime = this.streamStartTime + e.Result.Audio.AudioPosition + e.Result.Audio.Duration; // Post the raw result from the underlying recognition engine this.PostWithOriginatingTimeConsistencyCheck(this.SpeechRecognized, e, originatingTime); if (e.Result.Alternates.Count > 0) { var result = this.BuildSpeechRecognitionResult(e.Result); this.PostWithOriginatingTimeConsistencyCheck(this.Out, result, originatingTime); if (e.Result.Semantics != null) { IntentData intents = this.BuildIntentData(e.Result.Semantics); this.PostWithOriginatingTimeConsistencyCheck(this.IntentData, intents, originatingTime); } } }
/// <summary> /// Initializes a new instance of the <see cref="WakeWordEndEventArgs" /> class. /// </summary> /// <param name="e">The event.</param> internal WakeWordEndEventArgs(ExternalInterface.Event e) : base(e) { IntentHeard = e.WakeWord.WakeWordEnd.IntentHeard; IntentJson = e.WakeWord.WakeWordEnd.IntentJson; Intent = ParseUserIntent(e.WakeWord.WakeWordEnd.IntentJson); }