Share via


ISpCFGInterpreter::Interpret (SAPI 5.3)

Microsoft Speech API 5.3

ISpCFGInterpreter::Interpret

ISpCFGInterpreter::Interpret examines a grammar and generates new properties and text replacements.

Interpret is typically called by SAPI only when a grammar includes a reference to a context-free grammar (CFG) interpreter.

  
    <RULE NAME="MyRule" INTERPRETER="TRUE"/>
  

SAPI will internally call ISpCFGInterpreter_Interpret whenever the speech recognition engine calls ISpSREngineSite_ParseFromTransitions with a rule handle matching "MyRule".

Application writers and engine vendors can use the ISpCFGInterpreter interface to manipulate the semantic properties returned to the application. For example, the CFG interpreter could detect whenever the grammar contained a semantic property called "Today" and replace the semantic property value with the actual system date and time.

  
    HRESULT Interpret(ISpPhraseBuilder        *pPhrase,
   const ULONG              ulFirstElement,
   const ULONG              ulCountOfElements,
ISpCFGInterpreterSite   *pSite
);

Parameters

  • pPhrase
    [in] Address of the ISpPhraseBuilder interface containing the phrase information.
  • ulFirstElement
    [in] Value specifying the location of the first element in pPhrase.
  • ulCountOfElements
    [in] Value specifying the number of phrase elements in pPhrase.
  • pSite
    [in] Address of the ISpCFGInterpreterSite interface containing methods that can be used to attach semantic properties or text replacements to the parent phrase.

Return values

Value
S_OK
FAILED(hr)