Represents information about a SpeechRecognitionEngine object.
Inheritance Hierarchy
Namespace:
Microsoft.Speech.Recognition
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Class RecognizerInfo |
Visual Basic (Usage) |
---|
Dim instance As RecognizerInfo |
C# |
---|
public class RecognizerInfo |
Remarks
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.
Examples
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.
C# | Copy Code |
---|---|
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; } |