ISpRecoContext2::SetRuleWeight (SAPI 5.4)

Microsoft Speech API 5.4

ISpRecoContext2::SetRuleWeight

ISpRecoContext2::SetRuleWeight sets the weight on the specified rule.

  
    HRESULT SetRuleWeight(
   LPCWSTR    pszRuleName,
   ULONG      ulRuleId,
   float      flWeight
);

Parameters

  • pszRuleName
    The name of the rule.
  • ulRuleId
    The ID number of the rule.
  • flWeight
    A floating point number between 0 and 1. A higher number biases the recognizer to favour this rule over another rule when the developer knows that one rule is more likely to be uttered than the other. This is used to tune the accuracy of an application.

Return values

Value
S_OK
E_INVALIDARG
FAILED(hr)

Remarks

Be sure that you use the correct letter casing when specifying the rule name. Rule names are case-sensitive in SAPI. For example, if the name of the rule to target is "Test", and you set the value of pszRuleName to "test", the call will generate an error or incorrectly target a rule named "test".