SpeechRecognitionEngine.QueryRecognizerSetting(String) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- settingName
- String
The name of the setting to return.
The value of the setting.
settingName
is null
.
settingName
is the empty string ("").
The recognizer does not have a setting by that name.
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();
}
}
}
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.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: