ISpSREngineSite::GetTransitionProperty

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

ISpSREngineSite::GetTransitionProperty

ISpSREngineSite::GetTransitionProperty retrieves semantic property information for a transition in a grammar.

HRESULT GetTransitionProperty(
   SPTRANSITIONID           ID,
   SPTRANSITIONPROPERTY   **ppCoMemProperty
);

Parameters

ID
[in] The transition identifier.
ppCoMemProperty
[out] Address of a pointer to a SPTRANSITIONPROPERTY that receives the property information. Applications calling this method must call CoTaskMemFree() to free memory returned. If the transition does not have a semantic property, this will be set to point to NULL, and S_FALSE will be returned.

Return values

Value Description
S_OK Function completed successfully and transition has a property.
S_FALSE Function completed successfully but transition does not have a property.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY Exceeded available memory.
FAILED(hr) Appropriate error message.

Remarks

CFG grammars can contain properties (also known as ‘semantic tags’) within a grammar. This provides a means for semantic information to be embedded inside a grammar.

By default, the engine does not recognize these properties. Typically, an engine will recognize only the speech from the words in the grammar, and SAPI will parse and add the property information in the ISpSREngineSite::ParseFromTransitions call. However, it is possible for an engine to recognize this information by calling this method on any transition. If there is a property on this transition, the property name or ID and value is returned in the SPTRANSITIONPROPERTY structure, which must be freed after each use using CoTaskMemFree.

An engine can find out if a transition has a semantic property attached before calling this method by looking at the fHasProperty flag in the SPTRANSITIONENTRY structure associated with this transition.