QueryRecognizerSetting Method

Microsoft Speech Platform SDK 11

Collapse imageExpand ImageCopy imageCopyHover image

Returns the values of the current settings for a speech recognition engine managed by a SpeechRecognitionEngine object.

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

Syntax

Visual Basic (Declaration)
Public Function QueryRecognizerSetting ( _
	settingName As String _
) As Object
Visual Basic (Usage)
Dim instance As SpeechRecognitionEngine
Dim settingName As String
Dim returnValue As Object

returnValue = instance.QueryRecognizerSetting(settingName)
C#
public Object QueryRecognizerSetting(
	string settingName
)

Parameters

settingName
Type: System..::..String

Return Value

Type: System..::..Object

The value of the setting.

Remarks

Recognizer settings can contain string, 64-bit integer, or memory address data. The following table describes the settings that are defined for a recognizer that complies with the Microsoft Speech Platform SDK 11. The following settings must have the same range for each recognizer that supports the setting. A recognizer that complies with the Speech Platform SDK 11 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.

HighConfidenceThreshold

Not used by Microsoft.Speech. The value specified here is effectively the same as any value above the LowConfidenceThreshold. The range is from 0 to 100, inclusive. The default value is 80.

NormalConfidenceThreshold

Not used by Microsoft.Speech. The value specified here is effectively the same as any value above the LowConfidenceThreshold. The range is from 0 to 100, inclusive. The default value is 50.

LowConfidenceThreshold

Not used by Microsoft.Speech. Separates the speech recognized confidence range from the speech rejected confidence range. The range is from 0 to 100, inclusive. The default value is 20.

CFGConfidenceRejectionThreshold

The speech recognition engine accepts full utterances with confidence scores above or equal to this threshold, and rejects full utterances with phrase confidence scores below this threshold. This property accepts the following values:

  • The value -1 causes the engine to use its default value.

  • A value in the range of 0-100 sets the phrase confidence rejection threshold to the specified value.

If this value is set to 0, the speech recognition accepts all utterances. If this value is set to 100, the speech recognition engine rejects all utterances. This property is not to be confused with HighConfidenceThreshold, NormalConfidenceThreshold, or LowConfidenceThreshold, which are used to determine how any given confidence value is categorized (low, medium, or high).

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.

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,000 ms. This setting corresponds to the recognizer's EndSilenceTimeoutAmbiguous property.

EngineThreadPriority

Sets the priority of the engine thread(s). The range of permitted values is defined by the OS.

  • The minimum value is min(THREAD_PRIORITY_IDLE,THREAD_PRIORITY_HIGHEST)

  • The maximum value is max(THREAD_PRIORITY_IDLE,THREAD_PRIORITY_HIGHEST)

The values of these constants are in defined winbase.h.

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).

AssumeCFGFromTrustedSource

Bypasses file integrity checks when loading a CFG, to reduce load time. This should *only* be used by applications that can guarantee that the CFG they are loading has previously been compiled by the application (or by another application it trusts) and has been stored in a secure location where it could not be edited by a malicious agent. This property accepts the following values:

  • Value set to 0 = AssumeCFGFromTrustedSource is OFF

  • Value set to 1 = AssumeCFGFromTrustedSource is ON

The threshold values are used to divide a confidence scale into four portions: rejected, low, medium, and high. This is to allow assigning of a text value to confidence scores in defined ranges. Microsoft.Speech does not distinguish between high, normal, and low confidence levels, and does not assign text values to ranges of confidence scores. Modifying the values for HighConfidenceThreshold and NormalConfidenceThreshold, and LowConfidenceThreshold will have no effect on recognition.

To dictate the confidence level at which higher values indicate recognized speech, and equal or lower values indicate rejected speech, use CFGConfidenceRejectionThreshold. Recognition results with confidence values greater than or equal to the CFGConfidenceRejectionThreshold trigger a SpeechRecognized event. Recognition results with confidence values less than the CFGConfidenceRejectionThreshold trigger a SpeechRecognitionRejected event.

The confidence scores assigned to words and phrases by the recognition engine become the values of the RecognizedWordUnit..::..Confidence and RecognizedPhrase..::..Confidence properties, and are converted to range from 0 to 1, instead of from 0-100.

To modify one of the recognizer's settings, use one of the UpdateRecognizerSetting methods.

You can modify how the speech recognition responds to non-speech input using the BabbleTimeout, InitialSilenceTimeout, EndSilenceTimeout, and EndSilenceTimeoutAmbiguous properties.

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.

 Copy imageCopy Code
using System;
using System.Globalization;
using Microsoft.Speech.Recognition;

namespace RecognizerSettings
{
  class Program
  {
    static readonly string[] settings = new string[] {
      "ResourceUsage",
      "HighConfidenceThreshold",
      "NormalConfidenceThreshold",
      "LowConfidenceThreshold",
      "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();
    }
  }
}

See Also