Share via


ISpRecognizer

This interface enables applications to control aspects of an SR engine and its audio input. Each object implementing this interface represents a recognizer for a single engine. A standard application may not need to call many of the methods on this interface, as SAPI tries to set up the engine sensibly by default.

Each recognizer object is connected to one or more recognition contexts (ISpRecoContext). Through the contexts, the recognizer can control the recognition grammars to be used, start and stop recognition, and receive events and recognition results.

There are two implementations of ISpRecognizer in SAPI. One is for in-process (InProc) recognition, for which the SR engine is created in the same process as the application and only this application can connect to the recognizer. The other implementation is the shared-recognizer implementation, for which the SR engine is created in a separate process. Only one shared engine will run on a system, and all applications using the shared engine connect to the same recognizer. This implementation 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 implementation of ISpRecognizer, since it allows multiple SAPI applications to work at once. The InProc recognizer implementation should be used for other application types, such as an application recognizing from wave files or a telephony server application requiring multiple SR engines.

When to Implement

This interface is implemented by SAPI. Application developers use this interface but do not implement it.

There are two objects that implement this interface. These are created by applications by creating a COM object with either of the following CLSIDs:

  • SpInprocRecognizer (CLSID_SpInprocRecognizer)
  • SpSharedRecognizer (CLSID_SpSharedRecognizer)

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.

When to Use

Your application can call methods of the ISpRecognizer interface to configure or retrieve the attributes of the SR engine.

Methods

The following table lists methods for the ISpRecognizer interface.

Methods Description
CreateRecoContext Creates a recognition context for the SR engine object.
DisplayUI Displays a user interface component.
EmulateRecognition Emulates a recognition from a text phrase rather than from spoken audio.
GetFormat Gets the format of the current audio input.
GetInputObjectToken Gets the input token object for the stream.
GetInputStream Gets the input stream.
GetRecognizer Identifies the SR engine that is currently being used with the recognizer.
GetRecoProfile Gets the current recognition profile token.
GetRecoState Gets the state of the recognition engine.
GetStatus Gets current status information for the engine.
IsSharedInstance Determines if the recognizer is the shared or InProc implementation.
IsUISupported Checks if the SR engine supports a particular user interface component.
SetInput Specifies which input stream the SR engine should use.
SetRecognizer Sets the SR engine to use with the recognizer.
SetRecoProfile Sets the recognition profile for the recognizer to use.
SetRecoState Sets the state of the recognizer to reflect the SR engine state.

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.

See Also

SAPI Interfaces

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.