Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
Microsoft Speech Platform
ISpRecognizer2::EmulateRecognitionEx
ISpRecognizer2::EmulateRecognitionEx emulates a recognition from a specified text string rather than from spoken input, and extends the functionality of ISpRecognizer::EmulateRecognition.
<pre IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml"> <strong>HRESULT EmulateRecognitionEx(</strong><a runat="server" href="jj127695(v=msdn.10).md"><strong>ISpPhrase</strong></a> *<em>pPhrase</em>, <strong>DWORD</strong> <em>dwCompareFlags</em> <strong>);</strong> </pre>
Parameters
- pPhrase
The text string for which to emulate recognition. - dwCompareFlags
Determines how the comparison is to be performed. The values are LINGUISTIC_IGNORECASE, LINGUISTIC_IGNOREDIACRITIC, NORM_IGNORECASE, NORM_IGNOREKANATYPE, NORM_IGNORENONSPACE, NORM_IGNORESYMBOLS, NORM_IGNOREWIDTH, NORM_LINGUISTIC_CASING, and SORT_STRINGSORT. These values are identical to those used for the dwCmpFlags parameter of the CompareString function. For more information, see CompareString.
Return Values
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_INVALIDARG | pPhase is invalid. |
SP_NO_PARSE_FOUND | The phrase did not match any active rules. |
SP_RECOGNIZER_INACTIVE | Recognition is not currently active, so emulation cannot complete. |
FAILED(hr) | Appropriate error message. |
Remarks
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.