Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
RecognizeMode Enumeration
Enumerates values of the recognition mode.
Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
'Declaration
Public Enumeration RecognizeMode
'Usage
Dim instance As RecognizeMode
public enum RecognizeMode
Members
Member name | Description | |
---|---|---|
Single | Specifies that recognition terminates after completion. | |
Multiple | Specifies that recognition does not terminate after completion. |
Remarks
This enumeration is used as an argument to RecognizeAsync(RecognizeMode)
Examples
The following example shows the implementation of a start/stop button for an application that has a graphical user interface and uses SpeechRecognitionEngine. Depending on the state of the application, RecognizeAsync(RecognizeMode) is called with either Single or Multiple when the button is clicked.
private void _startRecogButton_Click(object sender, EventArgs eventArgs)
{
// Toggle speech recognition on.
if (_startRecogButton.Text == "Start Speech Recognition")
{
_startRecogButton.Text = "Stop Speech Recognition";
if (_useMultiple)
{
_recognitionEngine.RecognizeAsync(RecognizeMode.Multiple);
}
else
{
_recognitionEngine.RecognizeAsync(RecognizeMode.Single);
}
}
// Toggle speech recognition off.
else
{
_startRecogButton.Text = "Start Speech Recognition";
// Stop after current phrase is finished.
if (_friendlyStop)
{
_recognitionEngine.RecognizeAsyncStop();
}
// Stop before current phrase is finished.
else
{
_recognitionEngine.RecognizeAsyncCancel();
}
}
}