Share via


Note

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

Microsoft Speech Platform

ISpRecognizer::EmulateRecognition

ISpRecognizer::EmulateRecognition emulates a recognition from a specified text string rather than from spoken input.

<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT EmulateRecognition(</strong><a runat="server" href="jj127695(v=msdn.10).md"><strong>ISpPhrase</strong></a> *<em>pPhrase</em> <strong>);</strong> </pre>

Parameters

  • pPhrase
    [in] The phrase to emulate.

Return Values

Value Description
S_OK Function completed successfully.
S_FALSE The phrase to be recognized ended before the end of the grammar was reached.
SP_NO_PARSE_FOUND Function completed successfully but the phrase does not parse through any active rule.
SP_NO_RULES_ACTIVE Function completed successfully but there are no active rules to parse.
E_POINTER ppCoMemPhrase is invalid or bad.
SPERR_UNINITIALIZED Phrase is uninitialized.
E_OUTOFMEMORY Exceeded available memory.
FAILED(hr) Appropriate error message.

Remarks

In the case of ambiguous rules or paths in a grammar, the ::EmulateRecognition method will return an arbitrary rule or path. That is, the rule recognized at runtime may not be consistent.

You can use emulation to determine whether a word is in a grammar and what semantics are returned when the word is recognized. All the events will be fired back to the application exactly as if a normal recognition had taken place. The result phrase will have the semantic properties set in the same way a real result would. A recognition event will be produced only if the text actually parses through the active rules. Another ISpRecoContext containing an active rule that can parse the text can receive the emulated recognition.

For a comprehensive set of tools that you can use to validate, debug, test, and optimize grammars for voice applications, see Microsoft Grammar Development Tools.