Export (0) Print
Expand All

RecognizerInfo Class

Represents information about a SpeechRecognitionEngine object.

System.Object
  Microsoft.Speech.Recognition.RecognizerInfo

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

public class RecognizerInfo

SpeechRecognitionEngine.RecognizerInfo provides identifying information for an initialized SpeechRecognitionEngine object.

You can use instances of RecognizerInfo to construct a specific configuration of SpeechRecognitionEngine using the SpeechRecognitionEngine(RecognizerInfo) constructor.

The static method InstalledRecognizers() returns a list of all available SpeechRecognitionEngine configurations as RecognizerInfo instances.

The example below validates a given CultureInfo and identifier string against the permitted SpeechRecognitionEngine configurations, expressed as a list of RecognizerInfo objects.

If the CultureInfo and identifier string are valid, the example creates a new instance of SpeechRecognitionEngine using the RecognizerInfo instance as an argument.


private SpeechRecognitionEngine SelectRecognizer(CultureInfo requiredCulture, string requiredId) 
{
  // Select based on a specific recognizer configuration:
  SpeechRecognitionEngine speechRecognitionEngine = null;
  foreach (RecognizerInfo config in SpeechRecognitionEngine.InstalledRecognizers()) 
  {
    if (config.Culture.Equals(requiredCulture) && config.Id== requiredId) 
    {
      speechRecognitionEngine = new SpeechRecognitionEngine(config);
      break;
    }
  }
  return speechRecognitionEngine;
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft