ISpSRAlternates::Commit

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

ISpSRAlternates::Commit

ISpSRAlternates::Commit instructs the alternate analyzer to update the speech recognition (SR) engine's acoustic and/or language model based on the selected alternate phrase, versus the original phrase.

SAPI calls Commit when an application calls ISpPhraseAlt::Commit. The alternate analyzer compares the original phrase (see SPPHRASEALTREQUEST.pPhrase) and the new alternate phrase (see SPPHRASEALT) to improve recognition accuracy.

Depending on the manufacturer, the SR engine might provide a custom related data block (see SPPHRASEALTREQUEST.pvResultExtra) so that the analyzer can synchronize the data block with the new alternate phrase. If the user wants to re-analyze the new phrase (after being serialized and deserialized), or if the user chooses a different alternate, SAPI provides the revised data block to the analyzer.

The alternate analyzer communicates with the SR engine by retrieving the ISpRecoContext interface from the SPPHRASEALTREQUEST.pRecoContext field, and querying (see IUnknown::QueryInterface) for the SR engine's private extension (see ISpPrivateEngineCall).

HRESULT Commit(
   SPPHRASEALTREQUEST  *pAltRequest,
   SPPHRASEALT         *pAlt,
   void               **ppvResultExtra,
   ULONG               *pcbResultExtra
);

Parameters

pAltRequest
[in] A pointer to the structure of type SPPHRASEALTREQUEST that specifies the original alternate request and phrase information.
pAlt
[in] A pointer to the structure of type SPPHRASEALT that specifies the application-chosen alternate phrase.
ppvResultExtra
[out] Additional engine-defined information that should be included with recognition result.
pcbResultExtra
[out] Size, in bytes, of ppvResultExtra.

Return values

Value Description
S_OK Function completed successfully.
FAILED (hr) Appropriate error message.