ISpRecognizer (Microsoft Speech Platform)

Microsoft Speech Platform SDK 11

Microsoft Speech Platform

ISpRecognizer

The ISpRecognizer interface enables applications to control aspects of the speech recognition (SR) engine. Each ISpRecognizer interface represents a single SR engine. The application can connect to each recognizer object one or more recognition contexts, from which the application can control the recognition grammars to be used, start and stop recognition, and receive events and recognition results. The ISpRecognizer interface allows some additional control of the SR engine and its audio input. A standard application may not need to call many of the methods on this interface as SAPI tries to set the engine up sensibly by default.

There are two implementations of the ISpRecognizer and ISpRecoContext in SAPI. One is for recognition "in-process" (InProc), where the SR engine is created in the same process as the application. Only this application can connect to this recognizer. The other implementation is the "shared-recognizer," where the SR engine is created in a separate process. There will only be one shared engine running on a system, and all applications using the shared engine connect to the same recognizer. This allows several speech applications to work simultaneously, and allows the user to speak to any application, as recognition is done from the grammars of all applications. For desktop-based speech applications it is recommended to use the shared recognizer because of the way it allows multiple SAPI applications to work at once. For other types of application, such as recognizing from wave files or a telephony server application where multiple SR engines will be required, the InProc recognizer should be used.

When to Use

Call methods of the ISpRecognizer interface to configure or retrieve the attributes of the SR engine.

Implemented By
  • This interface is implemented by SAPI. Application developers use this interface but do not implement it.
How Created
There are two objects that implement this interface. These are created by applications by creating a COM object with either of the following CLSIDs:

Alternatively, the shared recognizer can be created by creating a SpSharedRecoContext (CLSID_SpSharedRecoContext), and then calling ISpRecoContext::GetRecognizer on this object to get a reference to the SpSharedRecognizer object.

Methods in Vtable Order

ISpRecognizer Methods Description
ISpProperties Inherits from ISpProperties and all those methods are accessible from ISpRecognizer.
SetRecognizer Specifies the SR engine to be used.
GetRecognizer Retrieves which SR engine is currently being used.
SetInput Specifies which input stream the SR engine should use.
GetInputObjectToken Retrieves the input token object for the stream.
GetInputStream Retrieves the input stream.
CreateRecoContext Creates a recognition context for this instance of an SR engine.
GetRecoProfile Retrieves the current recognition profile token.
SetRecoProfile Sets the recognition profile to be used by the recognizer.
IsSharedInstance Determines if the recognizer is the shared or InProc implementation.
GetRecoState Retrieves the state of the recognition engine.
SetRecoState Sets the state of the recognition engine.
GetStatus Retrieves current status information for the engine.
GetFormat Retrieves the format of the current audio input.
IsUISupported Checks if the SR engine supports a particular user interface component.
DisplayUI Displays a user interface component.
EmulateRecognition Emulates a recognition from a text phrase rather than from spoken audio.