Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

ISpRecoGrammar2::SetRulePriority

ISpRecoGrammar2::SetRulePriority sets the priority on the specified rule.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT SetRulePriority(</strong> <strong> LPCWSTR</strong> <em>pszRuleName</em>, <strong> ULONG</strong> <em>ulRuleId</em>, <strong> int</strong> <em>nRulePriority</em> <strong>);</strong> </pre>

Parameters

  • pszRuleName
    The name of the rule.
  • ulRuleId
    The ID number of the rule.
  • nRulePriority
    The priority to be assigned to the rule (between -128 and + 127). When a given utterance satisfies more than one rule, the recognizer applies the rule with the highest priority. When an utterance satisfies several rules with the same priority, or several rules with no priority, the recognizer applies the most recently activated rule.

Return Values

Value Description
S_OK Function completed successfully.
E_INVALIDARG One of the parameters is invalid.
FAILED(hr) Appropriate error message.

Remarks

Be sure that you use the correct letter casing when specifying the rule name. Rule names are case-sensitive in the Speech Platform. 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".