Exemple #1
0
 /// <summary>
 ///     Logs Canceled events
 ///     And sets the TaskCompletionSource to 0, in order to trigger Recognition Stop
 /// </summary>
 private static void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, RecognizerType rt,
                                          TaskCompletionSource <int> source)
 {
     source.TrySetResult(0);
     Console.WriteLine("--- recognition canceled ---");
     Console.WriteLine($"CancellationReason: {e.Reason.ToString()}. ErrorDetails: {e.ErrorDetails}.");
 }
 private void Recognizer_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         MessageBlock.Text = $"Canceled: {e.Result.Reason}";
     });
 }
 private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e)
 {
     //show errors in main window
     if (e.Reason == CancellationReason.Error)
     {
         this.WriteLine($"Recognition Canceled. Reason: {e.Reason}, ErrorDetails: {e.ErrorDetails}");
     }
 }
 private void CanceledHandler(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     lock (threadLocker)
     {
         message = e.ErrorDetails.ToString();
         Debug.Log("CanceledHandler: " + message);
     }
 }
Exemple #5
0
 private void SpeechCanceledHandler(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     lock (_threadLocker)
     {
         _unfinishedTranscription = null;
         _transcription           = e.ErrorDetails.ToString();
     }
 }
        /// <summary>
        /// Logs Canceled events
        /// And sets the TaskCompletionSource to 0, in order to trigger Recognition Stop
        /// </summary>
        private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, RecoType rt, TaskCompletionSource <int> source)
        {
            SpeechCanceledEventArgs eventArgs = new SpeechCanceledEventArgs();

            eventArgs.Message = "--- recognition canceled ---";
            OnSpeechCanceledEvent(eventArgs);
            eventArgs.Message = $"CancellationReason: {e.Reason.ToString()}. ErrorDetails: {e.ErrorDetails}.";
            OnSpeechCanceledEvent(eventArgs);
        }
        /// <summary>
        /// Logs Canceled events
        /// And sets the TaskCompletionSource to 0, in order to trigger Recognition Stop
        /// </summary>
        private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, RecoType rt, TaskCompletionSource <int> source)
        {
            var log = (rt == RecoType.Base) ? this.baseModelLogText : this.customModelLogText;

            source.TrySetResult(0);
            this.WriteLine(log, "--- recognition canceled ---");
            this.WriteLine(log, $"CancellationReason: {e.Reason.ToString()}. ErrorDetails: {e.ErrorDetails}.");
            this.WriteLine(log);
        }
Exemple #8
0
        /// <summary>
        /// 日志取消事件
        /// 并将TaskCompletionSource设置为0,以便触发识别停止
        /// </summary>
        private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, TaskCompletionSource <int> source)
        {
            var log = this.baseModelLogText;

            source.TrySetResult(0);
            this.WriteLine(log, "--- 识别结束 ---");
            this.WriteLine(log, $"取消原因: {e.Reason.ToString()}. 详细原因: {e.ErrorDetails}.");
            this.WriteLine(log);
        }
Exemple #9
0
        private void OnCanceled(object sender, SpeechRecognitionCanceledEventArgs e)
        {
            string text = e.Result.Text.Trim();

            if (text.Length > 0)
            {
                _callback(text);
            }
        }
Exemple #10
0
 // "Canceled" events are fired if the server encounters some kind of error.
 // This is often caused by invalid subscription credentials.
 private void CanceledHandler(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     UnityEngine.Debug.LogFormat($"CANCELED: Reason={e.Reason}");
     if (e.Reason == CancellationReason.Error)
     {
         UnityEngine.Debug.LogFormat($"CANCELED: ErrorDetails={e.ErrorDetails}");
         UnityEngine.Debug.LogFormat($"CANCELED: Did you update the subscription info?");
     }
 }
Exemple #11
0
        private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, TaskCompletionSource <int> source)
        {
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                IsListening = false;
                Status      = "Recognition canceled";
            });

            source.TrySetResult(0);
        }
Exemple #12
0
    private void DialogServiceConnector_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
    {
        stateIndicatorString = $"Cancellation details={e.ErrorDetails}";
        Debug.LogFormat($"Canceled with reason: {e.Reason}");

        if (e.Reason.Equals(CancellationReason.Error))
        {
            Debug.LogFormat($"Cancellation error code: {e.ErrorCode}");
            Debug.LogFormat($"Cancellation details: {e.ErrorDetails}");
        }
    }
 private void SpeechBotConnector_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     if (e.Reason == CancellationReason.Error)
     {
         Trace.TraceInformation($"[{DateTime.Now.ToString("h:mm:ss tt", CultureInfo.CurrentCulture)}] Canceled event received due to an error. {e.ErrorCode} - {e.ErrorDetails}.");
     }
     else if (e.Reason == CancellationReason.EndOfStream)
     {
         Trace.TraceInformation($"[{DateTime.Now.ToString("h:mm:ss tt", CultureInfo.CurrentCulture)}] Canceled event received due to end of stream.");
     }
 }
        private void Connector_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
        {
            var err = $"Error {e.ErrorCode} : {e.ErrorDetails}";

            this.UpdateStatus(err);
            this.RunOnUiThread(() =>
            {
                this.ListeningState = ListenState.NotListening;
                this.Messages.Add(new MessageDisplay(err, Sender.Channel));
            });
        }
    // "Canceled" events are fired if the server encounters some kind of error.
    // This is often caused by invalid subscription credentials.
    private void CanceledHandler(object sender, SpeechRecognitionCanceledEventArgs e)
    {
        Debug.Log($"CANCELED: Reason={e.Reason}");

        errorString = e.ToString();
        if (e.Reason == CancellationReason.Error)
        {
            Debug.LogError($"CANCELED: ErrorDetails={e.ErrorDetails}");
            Debug.LogError("CANCELED: Did you update the subscription info?");
        }
    }
    // "Canceled" Events are fired if the server encounters and error of some kind. Usually, invalid subscription credentials, update API key.
    private void CanceledHandler(object sender, SpeechRecognitionCanceledEventArgs e)
    {
        UnityEngine.Debug.LogFormat($"CANCELED: Reason={e.Reason}");

        errorString = e.ToString();
        if (e.Reason == CancellationReason.Error)
        {
            UnityEngine.Debug.LogFormat($"CANCELED: ErrorDetails={e.ErrorDetails}");
            UnityEngine.Debug.LogFormat($"CANCELED: Did you update your API key?");
        }
    }
 /// <summary>
 ///  Signal for events containing canceled recognition results
 ///  (indicating a recognition attempt that was canceled as a result or a direct cancellation request or, alternatively, a transport or protocol failure)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Recognizer_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     _mainVM.Status = ($"CANCELED: Reason={e.Reason}");
     if (e.Reason == CancellationReason.Error)
     {
         //Just writing to debug output here, could display this to user
         Debug.WriteLine($"CANCELED: ErrorCode={e.ErrorCode}");
         Debug.WriteLine($"CANCELED: ErrorDetails={e.ErrorDetails}");
         Debug.WriteLine($"CANCELED: Did you update the subscription info?");
     }
     stopRecognition.TrySetResult(0);
 }
        /// <summary>
        /// Logs Canceled events
        /// And sets the TaskCompletionSource to 0, in order to trigger Recognition Stop
        /// </summary>
        private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, RecoType rt, TaskCompletionSource <int> source)
        {
            var log = (rt == RecoType.Base) ? this.baseModelLogText : this.customModelLogText;

            source.TrySetResult(0);
            this.WriteLine(log, "--- recognition canceled ---");
            this.WriteLine(log, $"CancellationReason: {e.Reason.ToString()}. ErrorDetails: {e.ErrorDetails}.");
            this.WriteLine(log);
            Console.WriteLine("End of text ...");
            this.WriteLine(log, String.Format(CultureInfo.InvariantCulture, "{0}", sbText.ToString()));
            Console.Write(sbText.ToString());
        }
        private void RecognizerCancelled(object sender, SpeechRecognitionCanceledEventArgs e)
        {
            var cancellation = CancellationDetails.FromResult(e.Result);

            Console.WriteLine($"CANCELED: Reason={cancellation.Reason}");

            if (cancellation.Reason == CancellationReason.Error)
            {
                Debug.WriteLine($"CANCELED: ErrorDetails={cancellation.ErrorDetails}");
                Debug.WriteLine($"CANCELED: Did you update the subscription info?");
            }
        }
Exemple #20
0
        private async void RecognizeCanceled(object sender, SpeechRecognitionCanceledEventArgs eventArgs)
        {
            isListening = false;
            await changeControls(true);

            await Task.Run(() =>
            {
                Dispatcher.Invoke(() =>
                {
                    RecognizedTextBlock.Text = eventArgs.Reason.ToString();
                });
            });
        }
Exemple #21
0
        private static void SpeechRecognizerOnCanceled(object sender, SpeechRecognitionCanceledEventArgs e)
        {
            System.Console.WriteLine($"CANCELED: Reason={e.Reason}");

            if (e.Reason == CancellationReason.Error)
            {
                System.Console.WriteLine($"CANCELED: ErrorCode={e.ErrorCode}");
                System.Console.WriteLine($"CANCELED: ErrorDetails={e.ErrorDetails}");
                System.Console.WriteLine($"CANCELED: Did you update the subscription info?");
            }

            s_stopRecognition.TrySetResult(0);
        }
 private void Recognizer_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     if (e.Reason == CancellationReason.Error)
     {
         var errorCode    = e.ErrorCode;
         var errorMessage = e.ErrorDetails;
         OnError(errorCode, errorMessage);
     }
     else
     {
         OnRecognitionCanceled();
     }
 }
Exemple #23
0
    /// <summary>
    /// "Canceled" events are fired if the server encounters some kind of error.
    /// This is often caused by invalid subscription credentials.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void CanceledHandler(object sender, SpeechRecognitionCanceledEventArgs e)
    {
        UnityEngine.Debug.LogFormat($"CANCELED: Reason={e.Reason}");

        errorString = e.ToString();
        UnityDispatcher.InvokeOnAppThread(() => { UpdateUI(); });
        if (e.Reason == CancellationReason.Error)
        {
            UnityEngine.Debug.LogFormat($"CANCELED: ErrorDetails={e.ErrorDetails}");
            UnityEngine.Debug.LogFormat($"CANCELED: Did you update the subscription info?");
        }
        isRecognizing = false;
        RecognizerCleanup(false);
    }
        private void DialogServiceConnector_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
        {
            string cancelText = $"Canceled with reason: {e.Reason}";

            if (e.Reason.Equals(CancellationReason.Error))
            {
                cancelText += "\n" + $"Cancellation error code: {e.ErrorCode}";
                cancelText += "\n" + $"Cancellation details: {e.ErrorDetails}";
            }

            UpdateUI(() =>
            {
                this.Messages.Add(new MessageDisplay(cancelText, Sender.Other));
            });
        }
        /// <summary>
        /// Logs Canceled events
        /// And sets the TaskCompletionSource to 0, in order to trigger Recognition Stop.
        /// </summary>
        private void CanceledEventHandler(SpeechRecognitionCanceledEventArgs e, TaskCompletionSource <int> source)
        {
            if (log != null)
            {
                log.LogInformation($"Speech recognition: Session Cancelled: {0}.", e.ToString());

                if (FinalResultsCumulative.Count > 0)
                {
                    CreateTranscriptJson();
                }

                source.TrySetResult(0);

                return;
            }
        }
Exemple #26
0
        private void OnSpeechCanceled(object s, SpeechRecognitionCanceledEventArgs e)
        {
            DebugLogger.LogMessage(LogLevel.Error, Constants.ApplicationName,
                                   $"AzureSpeechModule: CANCELED: Reason={e.Reason}", DateTime.Now);

            if (e.Reason == CancellationReason.Error)
            {
                DebugLogger.LogMessage(LogLevel.Error, Constants.ApplicationName,
                                       $"AzureSpeechModule: CANCELED: ErrorCode={e.ErrorCode}", DateTime.Now);
                DebugLogger.LogMessage(LogLevel.Error, Constants.ApplicationName,
                                       $"AzureSpeechModule: CANCELED: ErrorDetails={e.ErrorDetails}", DateTime.Now);
                DebugLogger.LogMessage(LogLevel.Error, Constants.ApplicationName,
                                       "AzureSpeechModule: CANCELED: Did you update the subscription info?", DateTime.Now);
            }

            StopRecognition.TrySetResult(0);
        }
        private async void OnCanceled(object sender, SpeechRecognitionCanceledEventArgs args)
        {
            if (args.Reason == CancellationReason.Error)
            {
                stopRecognitionTaskCompletionSource?.TrySetResult(0);

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    dictatedTextBuilder = new StringBuilder($"ErrorCode={args.ErrorCode};\nErrorDetails={args.ErrorDetails}");
                    recognitionData     = new RecognitionData(dictatedTextBuilder.ToString(), null);
                    SetRecognitionData(recognitionData);

                    ShowNotificationEventHandler?.Invoke(this, new NotificationViewModel {
                        NotificationType = NotificationType.Error
                    });
                });
            }
        }
Exemple #28
0
        private void Connector_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
        {
            if (e.Reason == CancellationReason.Error &&
                e.ErrorCode == CancellationErrorCode.ConnectionFailure &&
                e.ErrorDetails.Contains("1000"))
            {
                // Connection was closed by the remote host.
                // Error code: 1000.
                // Error details: Exceeded maximum websocket connection idle duration (>300000ms = 5 minutes).
                // A graceful timeout after a connection is idle manifests as an error but isn't an
                // exceptional condition -- we don't want it show up as a big red bubble!
                UpdateStatus("Active connection timed out but ready to reconnect on demand.");
            }
            else
            {
                var statusMessage = $"Error ({e.ErrorCode}): {e.ErrorDetails}";
                UpdateStatus(statusMessage);
                listeningState = ListenState.NotListening;

                AddMessage(new MessageDisplay(statusMessage, Sender.Channel));
            }
        }
 private void _speechClient_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     Debug.WriteLine("Recognition was cancelled." + e.Reason + "===" + e.ErrorCode + "+++" + e.ErrorDetails);
 }
 private void Recognizer_Canceled(object sender, SpeechRecognitionCanceledEventArgs e)
 {
     MessageBox.Show(e.ErrorDetails);
 }