Compartilhar via


ISpSREngine::RuleNotify (Windows CE 5.0)

Send Feedback

This method informs the SR engine when CFG rules are added, changed, or removed.

HRESULT RuleNotify(  SPCFGNOTIFY Action,  ULONG cRules,  const SPRULEENTRY* pRules);

Parameters

  • Action
    [in] The action that is occurring. Possible values are defined for the SPCFGNOTIFY enumeration.
  • cRules
    [in] Number of rules specified in pRules.
  • pRules
    [in] Pointer to an array of SPRULEENTRY structures containing information on each rule.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
FAILED(hr) Appropriate error message.

Remarks

The engine sees each CFG as containing one or more rules, with top-level rules activated for recognition. Each rule is defined as an SPRULEENTRY structure.

Each rule has an initial state and additional states, connected by transitions. A transition can be: a word transition indicating a word to be recognized, a rule transition indicating a reference to a sub-rule, an epsilon (null) transition, or a special transition for such features as embedding dictation in a CFG.

References to sub-rules can be recursive, that is, rules can reference themselves, either directly or indirectly. Left recursion is not supported and SAPI will reject grammars using it when loading. Inside a grammar, transitions can have semantic properties, although the engine does not typically need to see these.

SAPI takes full control of loading a grammar upon a request from an application. The grammar is loaded from a file, a URL, a resource, or memory. A load operation involves the loading of either binary or XML forms of the grammar, and the resolving of imports. When the grammar is loaded, SAPI notifies the SR engine about the contents of the grammar through various DDI methods.

For the SR engine to find out the full contents of a rule, it can use the ISpSREngineSite::GetStateInfo method. This gives information about all the subsequent transitions and states following from any given state (starting with the initial state of the rule).

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapiddk.h, Sapiddk.idl.
Link Library: Sapilib.lib.

See Also

ISpSREngine | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.