You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -72,7 +72,7 @@ The [Recognizer class](/cpp/cognitive-services/speech/speechrecognizer) for the
72
72
Single-shot recognition asynchronously recognizes a single utterance. The end of a single utterance is determined by listening for silence at the end or until a maximum of 15 seconds of audio is processed. Here's an example of asynchronous single-shot recognition via [`RecognizeOnceAsync`](/cpp/cognitive-services/speech/speechrecognizer#recognizeonceasync):
73
73
74
74
```cpp
75
-
auto result = recognizer->RecognizeOnceAsync().get();
75
+
auto result = speechRecognizer->RecognizeOnceAsync().get();
76
76
```
77
77
78
78
You need to write some code to handle the result. This sample evaluates [`result->Reason`](/cpp/cognitive-services/speech/recognitionresult#reason) and:
@@ -114,8 +114,8 @@ Continuous recognition is a bit more involved than single-shot recognition. It r
114
114
Start by defining the input and initializing [`SpeechRecognizer`](/cpp/cognitive-services/speech/speechrecognizer):
Next, create a variable to manage the state of speech recognition. Declare `promise<void>` because at the start of recognition, you can safely assume that it's not finished:
@@ -132,12 +132,12 @@ Next, subscribe to the events that [`SpeechRecognizer`](/cpp/cognitive-services/
132
132
*[`Canceled`](/cpp/cognitive-services/speech/asyncrecognizer#canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
A common task for speech recognition is specifying the input (or source) language. The following example shows how you would change the input language to German. In your code, find your [`SpeechConfig`](/cpp/cognitive-services/speech/speechconfig) instance and add this line directly below it:
[`SetSpeechRecognitionLanguage`](/cpp/cognitive-services/speech/speechconfig#setspeechrecognitionlanguage) is a parameter that takes a string as an argument. Refer to the [list of supported speech-to-text locales](../../../language-support.md?tabs=stt).
The previous examples use single-shot recognition, which recognizes a single utterance. The end of a single utterance is determined by listening for silence at the end or until a maximum of 15 seconds of audio is processed.
187
187
188
-
In contrast, you use continuous recognition when you want to control when to stop recognizing. It requires you to subscribe to the `Recognizing`, `Recognized`, and `Canceled` events to get the recognition results. To stop recognition, you must call [`StopContinuousRecognitionAsync`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.stopcontinuousrecognitionasync). Here's an example of how continuous recognition is performed on an audio input file.
188
+
In contrast, you use continuous recognition when you want to control when to stop recognizing. It requires you to subscribe to the `Recognizing`, `Recognized`, and `Canceled` events to get the recognition results. To stop recognition, you must call [`StopContinuousRecognitionAsync`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.stopcontinuousrecognitionasync). Here's an example of how continuous recognition is performed on an audio input file.
189
189
190
190
Start by defining the input and initializing [`SpeechRecognizer`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer):
Then create a `TaskCompletionSource<int>` instance to manage the state of speech recognition:
@@ -202,18 +202,18 @@ var stopRecognition = new TaskCompletionSource<int>();
202
202
203
203
Next, subscribe to the events that `SpeechRecognizer` sends:
204
204
205
-
*[`Recognizing`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.recognizing): Signal for events that contain intermediate recognition results.
206
-
*[`Recognized`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.recognized): Signal for events that contain final recognition results, which indicate a successful recognition attempt.
207
-
*[`SessionStopped`](/dotnet/api/microsoft.cognitiveservices.speech.recognizer.sessionstopped): Signal for events that indicate the end of a recognition session (operation).
208
-
*[`Canceled`](/dotnet/api/microsoft.cognitiveservices.speech.speechrecognizer.canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
205
+
*[`Recognizing`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.recognizing): Signal for events that contain intermediate recognition results.
206
+
*[`Recognized`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.recognized): Signal for events that contain final recognition results, which indicate a successful recognition attempt.
207
+
*[`SessionStopped`](/dotnet/api/microsoft.cognitiveservices.speech.speechRecognizer.sessionstopped): Signal for events that indicate the end of a recognition session (operation).
208
+
*[`Canceled`](/dotnet/api/microsoft.cognitiveservices.speech.speechspeechRecognizer.canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
Next, create a variable to manage the state of speech recognition. Declare a `Semaphore` instance at the class scope:
@@ -150,18 +150,18 @@ Next, subscribe to the events that [`SpeechRecognizer`](/java/api/com.microsoft.
150
150
151
151
*[`recognizing`](/java/api/com.microsoft.cognitiveservices.speech.speechrecognizer.recognizing): Signal for events that contain intermediate recognition results.
152
152
*[`recognized`](/java/api/com.microsoft.cognitiveservices.speech.speechrecognizer.recognized): Signal for events that contain final recognition results, which indicate a successful recognition attempt.
153
-
*[`sessionStopped`](/java/api/com.microsoft.cognitiveservices.speech.recognizer.sessionstopped): Signal for events that indicate the end of a recognition session (operation).
153
+
*[`sessionStopped`](/java/api/com.microsoft.cognitiveservices.speech.speechRecognizer.sessionstopped): Signal for events that indicate the end of a recognition session (operation).
154
154
*[`canceled`](/java/api/com.microsoft.cognitiveservices.speech.speechrecognizer.canceled): Signal for events that contain canceled recognition results. These results indicate a recognition attempt that was canceled as a result or a direct cancellation request. Alternatively, they indicate a transport or protocol failure.
0 commit comments