/// <summary> /// Initializes a new instance of the <see cref="BingSpeechRecognizer"/> class. /// </summary> /// <param name="pipeline">The pipeline to add the component to.</param> /// <param name="configuration">The component configuration.</param> public BingSpeechRecognizer(Pipeline pipeline, BingSpeechRecognizerConfiguration configuration) : base(pipeline) { this.configuration = configuration ?? new BingSpeechRecognizerConfiguration(); this.intentData = pipeline.CreateEmitter <IntentData>(this, "IntentData"); // create emitters for all possible Bing speech recognition events this.partialSpeechResponseEvent = pipeline.CreateEmitter <PartialSpeechResponseEventArgs>(this, nameof(PartialSpeechResponseEventArgs)); this.speechErrorEvent = pipeline.CreateEmitter <SpeechErrorEventArgs>(this, nameof(SpeechErrorEventArgs)); this.speechResponseEvent = pipeline.CreateEmitter <SpeechResponseEventArgs>(this, nameof(SpeechResponseEventArgs)); // Create the Cognitive Services DataRecognitionClient this.speechRecognitionClient = this.CreateSpeechRecognitionClient(); }
/// <summary> /// Initializes a new instance of the <see cref="BingSpeechRecognizer"/> class. /// </summary> /// <param name="pipeline">The pipeline to add the component to.</param> /// <param name="configuration">The component configuration.</param> public BingSpeechRecognizer(Pipeline pipeline, BingSpeechRecognizerConfiguration configuration) : base(pipeline) { this.Configuration = configuration ?? new BingSpeechRecognizerConfiguration(); this.PartialRecognitionResults = pipeline.CreateEmitter <IStreamingSpeechRecognitionResult>(this, nameof(this.PartialRecognitionResults)); // create emitters for all possible Bing speech recognition events this.PartialSpeechResponseEvent = pipeline.CreateEmitter <PartialSpeechResponseEventArgs>(this, nameof(PartialSpeechResponseEventArgs)); this.SpeechErrorEvent = pipeline.CreateEmitter <SpeechErrorEventArgs>(this, nameof(SpeechErrorEventArgs)); this.SpeechResponseEvent = pipeline.CreateEmitter <SpeechResponseEventArgs>(this, nameof(SpeechResponseEventArgs)); // create table of last stream originating times this.lastPostedOriginatingTimes = new Dictionary <int, DateTime>(); // Create the Cognitive Services DataRecognitionClient this.speechRecognitionClient = this.CreateSpeechRecognitionClient(); }