SpeechRecognitionEngine.QueryRecognizerSetting(String) SpeechRecognitionEngine.QueryRecognizerSetting(String) SpeechRecognitionEngine.QueryRecognizerSetting(String) SpeechRecognitionEngine.QueryRecognizerSetting(String) Method

Definition

Returns the values of settings for the recognizer.

public:
 System::Object ^ QueryRecognizerSetting(System::String ^ settingName);
public object QueryRecognizerSetting (string settingName);
member this.QueryRecognizerSetting : string -> obj
Public Function QueryRecognizerSetting (settingName As String) As Object

Parameters

settingName
String String String String

The name of the setting to return.

Returns

The value of the setting.

Exceptions

The recognizer does not have a setting by that name.

Examples

The following example is part of a console application that outputs the values for a number of the settings defined for the recognizer that supports the en-US locale. The example generates the following output.

Settings for recognizer MS-1033-80-DESK:  

  ResourceUsage                  is not supported by this recognizer.  
  ResponseSpeed                  = 150  
  ComplexResponseSpeed           = 500  
  AdaptationOn                   = 1  
  PersistedBackgroundAdaptation  = 1  

Press any key to exit...  

using System;  
using System.Globalization;  
using System.Speech.Recognition;  

namespace RecognizerSettings  
{  
  class Program  
  {  
    static readonly string[] settings = new string[] {  
      "ResourceUsage",  
      "ResponseSpeed",  
      "ComplexResponseSpeed",  
      "AdaptationOn",  
      "PersistedBackgroundAdaptation"  
    };  

    static void Main(string[] args)  
    {  
      using (SpeechRecognitionEngine recognizer =  
        new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US")))  
      {  
        Console.WriteLine("Settings for recognizer {0}:",  
          recognizer.RecognizerInfo.Name);  
        Console.WriteLine();  

        foreach (string setting in settings)  
        {  
          try  
          {  
            object value = recognizer.QueryRecognizerSetting(setting);  
            Console.WriteLine("  {0,-30} = {1}", setting, value);  
          }  
          catch  
          {  
            Console.WriteLine("  {0,-30} is not supported by this recognizer.",  
              setting);  
          }  
        }  
      }  
      Console.WriteLine();  

      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Remarks

Recognizer settings can contain string, 64-bit integer, or memory address data. The following table describes the settings that are defined for a Microsoft Speech API (SAPI)-compliant recognizer. The following settings must have the same range for each recognizer that supports the setting. A SAPI-compliant recognizer is not required to support these settings and can support other settings.

Name Description
ResourceUsage Specifies the recognizer's CPU consumption. The range is from 0 to 100. The default value is 50.
ResponseSpeed Indicates the length of silence at the end of unambiguous input before the speech recognizer completes a recognition operation. The range is from 0 to 10,000 milliseconds (ms). This setting corresponds to the recognizer's EndSilenceTimeout property. Default = 150ms.
ComplexResponseSpeed Indicates the length of silence at the end of ambiguous input before the speech recognizer completes a recognition operation. The range is from 0 to 10,000ms. This setting corresponds to the recognizer's EndSilenceTimeoutAmbiguous property. Default = 500ms.
AdaptationOn Indicates whether adaptation of the acoustic model is ON (value = 1) or OFF (value = 0). The default value is 1 (ON).
PersistedBackgroundAdaptation Indicates whether background adaptation is ON (value = 1) or OFF (value = 0), and persists the setting in the registry. The default value is 1 (ON).

To update a setting for the recognizer, use one of the UpdateRecognizerSetting methods.

Applies to

See also