ISRGramNotifySink::PhraseFinish

HRESULT PhraseFinish(DWORD dwFlags, QWORD qTimeStampBegin,

QWORD qTimeStampEnd, PSRPHRASE pSRPhrase,
PIUNKNOWN pIUnknownResult);

Informs the application that the speaker has finished a phrase and the speech-recognition engine is certain about the words that were spoken.

· Return value is ignored.

dwFlags

[in] This parameter can be one or both of the following values:

Value

Meaning

ISRNOTEFIN_RECOGNIZED

The recognition was above the threshold set with the ISRAttributes::ThresholdSet member function. If this flag is not set, the engine did not have enough confidence in the recognition, and it should be declared as an "unknown utterance."

ISRNOTEFIN_THISGRAMMAR

This grammar had the highest score of all active grammars and claimed the recognition. If this flag is not set, another grammar had a higher score and claimed the recognition.


For an application to accept a recognition as valid, both ISRNOTEFIN_RECOGNIZED and ISRNOTEFIN_THISGRAMMAR should be set.

qTimeStampBegin

[in] Time, in bytes, when the phrase began. Most applications ignore this parameter.

qTimeStampEnd

[in] Time, in bytes, when the phrase ended. Most applications ignore this parameter.

pSRPhrase

[in] Address of an SRPHRASE structure that contains the engine's best recognition choice for the phrase. If dwFlags does not contain either ISRNOTEFIN_RECOGNIZED or ISRNOTEFIN_THISGRAMMAR, pSRPhrase may be NULL.

pIUnknownResult

[in] Address of an IUnknown interface of the speech-recognition results object created for this recognition. If this parameter is NULL, this engine has no object to return. The IUnknown interface and the object are released when the application returns from the PhraseFinish member function. Unless the application calls the IUnknown::QueryInterface member function on one of the object's interfaces, the results object is freed. This allows the application to ignore the pIUnknownResult parameter without causing results objects to accumulate and consume memory needlessly.

Depending on the grammar, a phrase can be the following:

· Context-free grammar. An ordered list of spoken words that traverse and complete the grammar tree from start to finish. A phrase should be sent even if it is grammatically incorrect.

· Limited-domain or dictation grammar. An ordered set of words. Typically, the PhraseFinish member function is sent once per utterance, but this is not guaranteed. In some cases, PhraseFinish may be sent several times per utterance; in other cases one PhraseFinish may be sent for several utterances.

The information provided in pSRPhrase should satisfy most applications. Those that need more information can use the speech-recognition results object, if the engine provides it. This object probably supports one or more of the speech-recognition results interfaces (ISRResAudio, ISRResBasic, and so on), but the application must query for each interface desired.

The application can keep a speech-recognition results object for later reference, although this object can consume large amounts of memory. However, from the engine's point of view, it doesn't really have to create the whole object until the QueryInterface member function is called.

If two or more grammars contain the same phrase, and this phrase is recognized, it is indeterminant which of the grammars will cause the engine to set the ISRNOTEFIN_THISGRAMMAR flag in the dwFlags parameter of the ISRGramNotifySink::PhraseFinish member function.