CRecognitionAlgMgr Class Reference

class CRecognitionAlgMgr : public CActive

This class is an aggregation of all related algorithms. It manages the algorithms and coordinate transfer of data.

NssDevASR.lib
Since
2.0

Inherits from

Public Member Functions
~CRecognitionAlgMgr ()
void ActivateGrammarL (const TSIGrammarID )
void AdaptModelsL (const CSIResultSet &, TInt , TLanguage )
void AlgorithmState ()
void Cancel ()
void CombineComplete ( HBufC8 *, TInt )
void DeactivateGrammarL (const TSIGrammarID )
void EndRecSession ()
void GetEnginePropertiesL (const RArray < TInt > &, RArray < TInt > &)
void GetGrammarL (const TSIGrammarID , CSICompiledGrammar **, CSICompiledGrammar **)
TBool GetUtteranceDuration ( TUint32 &, TUint32 &, TReal &)
void InitFrontEnd ( TRecognizerMode )
void InitRecognizerBE ( CSIResultSet &)
void LoadEnginePropertiesL (const RArray < TInt > &, const RArray < TInt > &)
void LoadGrammarL (const CSIGrammar &)
void LoadGrammarL (const CSICompiledGrammar &)
void LoadLexiconL (const CSILexicon &)
void LoadModelsL (const CSDModelBank &)
void LoadModelsL (const CSIModelBank &)
void MaahdAdaptationComplete ( TInt )
void MarhdoEouDetected ( TInt )
void MarhdoFeatureVector (const TDesC8 &, TInt32 , TInt32 )
void MarhdoInitRecognizerBEComplete ( TInt )
void MarhdoInitRecognizerFEComplete ( TInt )
void MarhdoInitializationComplete ( TInt )
void MarhdoRecognitionComplete ( TInt )
void MarhdoRequestSpeechData ()
CRecognitionAlgMgr * NewL ( MRecAlgMgrObserver &)
void SendSpeechData ( TPtrC8 &, TBool )
void SetRejection ( TUint32 )
TInt StartRecSession ( TRecognizerMode )
void StartRecognitionL ()
void UnloadGrammarL (const CSIGrammar &)
void UnloadGrammarL (const CSICompiledGrammar &)
void UnloadRule ( TSIGrammarID , TSIRuleID )
Private Member Functions
CRecognitionAlgMgr ( MRecAlgMgrObserver &)
void ConstructL ()
void DoCancel ()
void HandleActivateGrammar ()
void HandleDeActivateGrammar ()
void HandleInitFrontEnd ()
void HandleInitRecognizerBE ()
void HandleInitTrainBE ()
void HandleLoadGrammar ()
void HandleLoadLexicon ()
void HandleLoadModels ()
void HandleUnloadGrammar ()
void HandleUnloadRule ()
void HandleUtteranceDataRcvd ()
void Ready (const TInt )
void RunL ()
Inherited Functions
CActive::CActive(TInt)
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::RunError(TInt)
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enum TAlgState { EIdle  = 0, EProcessing , ECancel }
Inherited Enumerations
CActive:TPriority
Private Attributes
CASRSAdaptHwDevice * iAdaptHw
TBool iAdaptation
HBufC8 * iAdaptationData
TAlgState iBEState
RPointerArray < TSIRuleVariantInfo > iBlackList
TPtrC8 iBuffer
TBool iCombineNeeded
HBufC8 * iCombinedGrammar
TBool iEnd
TUint32 iEndFrame
TAlgState iFEState
TBool iFeatures
TReal iFrameLength
TSIGrammarID iGrammarID
TBool iInitialized
TRecognizerMode iMode
void * iModel
RArray < TUint > iNBestList
MRecAlgMgrObserver * iRecAlgMgrObserver
CASRSRecognitionHwDevice * iRecoHw
TInt iRequestFunction
TSIRuleID iRuleID
const void * iSDCompGrammar
const void * iSDGrammar
const void * iSDLexicon
CSDModelBank * iSDModelBank
void * iSDResult
RPointerArray < CSICompiledGrammar > iSIActiveGrammars
const CSICompiledGrammar * iSICompGrammar
RPointerArray < CSICompiledGrammar > iSIDeActivatedGrammars
const CSIGrammar * iSIGrammar
const CSILexicon * iSILexicon
CSIModelBank * iSIModelBank
CSIResultSet * iSIResult
RArray < TInt > iScores
TUint32 iStartFrame
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CRecognitionAlgMgr(MRecAlgMgrObserver &)

CRecognitionAlgMgr ( MRecAlgMgrObserver & aObserver ) [private]

C++ default constructor.

Parameters

MRecAlgMgrObserver & aObserver

~CRecognitionAlgMgr()

~CRecognitionAlgMgr ( ) [virtual]

Destructor.

Member Functions Documentation

ActivateGrammarL(const TSIGrammarID)

void ActivateGrammarL ( const TSIGrammarID aGrammarID )

Activates a grammar.

Since
2.8

Parameters

const TSIGrammarID aGrammarID

AdaptModelsL(const CSIResultSet &, TInt, TLanguage)

void AdaptModelsL ( const CSIResultSet & aResultSet,
TInt aResultIndex,
TLanguage aLanguage
)

Adapts models

2.8

Parameters

const CSIResultSet & aResultSet
TInt aResultIndex
TLanguage aLanguage

AlgorithmState()

void AlgorithmState ( )

Used during unit testing to print the state of the algorithm

Cancel()

void Cancel ( )

Cancels the current or started tasks.

Since
2.0

CombineComplete(HBufC8 *, TInt)

void CombineComplete ( HBufC8 * aResult,
TInt aError
)

Grammar combination has been completed.

Parameters

HBufC8 * aResult
TInt aError

ConstructL()

void ConstructL ( ) [private]

Symbian 2nd phase constructor

DeactivateGrammarL(const TSIGrammarID)

void DeactivateGrammarL ( const TSIGrammarID aGrammarID )

Deactivates a grammar

Since
2.8

Parameters

const TSIGrammarID aGrammarID

DoCancel()

void DoCancel ( ) [private, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel() .

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel() .

CActive::Cancel

EndRecSession()

void EndRecSession ( )

This method is used to indicate the end of a recognition session. The EndRecSession() method should be used to end the session.

Since
2.0

GetEnginePropertiesL(const RArray< TInt > &, RArray< TInt > &)

void GetEnginePropertiesL ( const RArray < TInt > & aPropertyId,
RArray < TInt > & aPropertyValue
)

Retreive the properties of the underlying speech recognition engine.

Since
2.0

Parameters

const RArray < TInt > & aPropertyId
RArray < TInt > & aPropertyValue

GetGrammarL(const TSIGrammarID, CSICompiledGrammar **, CSICompiledGrammar **)

void GetGrammarL ( const TSIGrammarID aGrammarID,
CSICompiledGrammar ** aSIActiveGrammar,
CSICompiledGrammar ** aSIDeActivatedGrammar
)

Get the specified grammar.

Since
2.8

Parameters

const TSIGrammarID aGrammarID
CSICompiledGrammar ** aSIActiveGrammar
CSICompiledGrammar ** aSIDeActivatedGrammar

GetUtteranceDuration(TUint32 &, TUint32 &, TReal &)

TBool GetUtteranceDuration ( TUint32 & aStartFrame,
TUint32 & aEndFrame,
TReal & aFrameLength
)

Retreive the duration of the utterance detected by the algorithm.

Since
2.0

Parameters

TUint32 & aStartFrame
TUint32 & aEndFrame
TReal & aFrameLength

HandleActivateGrammar()

void HandleActivateGrammar ( ) [private]

HandleDeActivateGrammar()

void HandleDeActivateGrammar ( ) [private]

HandleInitFrontEnd()

void HandleInitFrontEnd ( ) [private]

The following methods are asynchronous handlers for the corresponding synchronous calls.

HandleInitRecognizerBE()

void HandleInitRecognizerBE ( ) [private]

HandleInitTrainBE()

void HandleInitTrainBE ( ) [private]

HandleLoadGrammar()

void HandleLoadGrammar ( ) [private]

HandleLoadLexicon()

void HandleLoadLexicon ( ) [private]

HandleLoadModels()

void HandleLoadModels ( ) [private]

HandleUnloadGrammar()

void HandleUnloadGrammar ( ) [private]

HandleUnloadRule()

void HandleUnloadRule ( ) [private]

HandleUtteranceDataRcvd()

void HandleUtteranceDataRcvd ( ) [private]

InitFrontEnd(TRecognizerMode)

void InitFrontEnd ( TRecognizerMode aFeMode )

Initializes the front-end module in the speech recognition engine. The frontend module used during training/recognition functions is started as a result. This method is intended to be used in conjunction with InitTrainBE().

Since
2.0

Parameters

TRecognizerMode aFeMode

InitRecognizerBE(CSIResultSet &)

void InitRecognizerBE ( CSIResultSet & aResult )

Initialize the recognition engine back-end. The module responsible for recognition function is started as a result. This method must be used before any recognition operations and intended to be used in conjunction with InitFrontEnd() .

Since
2.0

Parameters

CSIResultSet & aResult A reference to an object where the recognition result will be written.

LoadEnginePropertiesL(const RArray< TInt > &, const RArray< TInt > &)

void LoadEnginePropertiesL ( const RArray < TInt > & aParameterId,
const RArray < TInt > & aParameterValue
)

Load the specified parameter(s) to the engines.

Parameters

const RArray < TInt > & aParameterId
const RArray < TInt > & aParameterValue

LoadGrammarL(const CSIGrammar &)

void LoadGrammarL ( const CSIGrammar & aGrammar )

Load the specified grammar into the recognizer.

Since
2.8

Parameters

const CSIGrammar & aGrammar A reference to a grammar in an internal format.

LoadGrammarL(const CSICompiledGrammar &)

void LoadGrammarL ( const CSICompiledGrammar & aGrammar )

Parameters

const CSICompiledGrammar & aGrammar

LoadLexiconL(const CSILexicon &)

void LoadLexiconL ( const CSILexicon & aLexicon )

Load the specified lexicon into the recognizer.

Since
2.0

Parameters

const CSILexicon & aLexicon A reference to a lexicon in an internal format.

LoadModelsL(const CSDModelBank &)

void LoadModelsL ( const CSDModelBank & aModels )

Load the specified model bank into the recognizer.

Since
2.0

Parameters

const CSDModelBank & aModels A reference to a model bank.

LoadModelsL(const CSIModelBank &)

void LoadModelsL ( const CSIModelBank & aModels )

Parameters

const CSIModelBank & aModels

MaahdAdaptationComplete(TInt)

void MaahdAdaptationComplete ( TInt aError )

Called when adaptation has been done

Parameters

TInt aError

MarhdoEouDetected(TInt)

void MarhdoEouDetected ( TInt aError )
Called by the hardware device when end-of-utterance is detected by the acoustic frontend. This method must be called before MarhdoRecognitionComplete() .
Since
Series60 2.8

Parameters

TInt aError Recognition result code. KErrNone if successful, otherwise KErrTooLong, KErrTooShort, KErrAsrSpeechTooEarly, KErrNoSpeech

MarhdoFeatureVector(const TDesC8 &, TInt32, TInt32)

void MarhdoFeatureVector ( const TDesC8 & aFV,
TInt32 aSNR,
TInt32 aPosition
)
Called by the hardware device when a feature vector is extracted by acoustic frontend.
Since
Series60 2.8

Parameters

const TDesC8 & aFV A buffer containing a feature vector.
TInt32 aSNR Signal-to-noise ratio.
TInt32 aPosition Indicates whether this is the first, subsequent or last feature vector in a series.

MarhdoInitRecognizerBEComplete(TInt)

void MarhdoInitRecognizerBEComplete ( TInt aError )
Called by the hardware device when backend initialization is completed.
Since
Series60 2.8

Parameters

TInt aError Initialization result code. KErrNone if successful otherwise a system-wide error code.

MarhdoInitRecognizerFEComplete(TInt)

void MarhdoInitRecognizerFEComplete ( TInt aError )
Called by the hardware device when the InitializeL() method has completed.
Since
Series60 2.8

Parameters

TInt aError Initialization result code. KErrNone if successful otherwise a system-wide error code.

MarhdoInitializationComplete(TInt)

void MarhdoInitializationComplete ( TInt aError )
Called by the hardware device when the InitializeL() method has completed.
Since
Series60 2.8

Parameters

TInt aError Initialization result code. KErrNone if successful otherwise a system-wide error code.

MarhdoRecognitionComplete(TInt)

void MarhdoRecognitionComplete ( TInt aError )
Called by the hardware device when recognition result is available.
Since
Series60 2.8

Parameters

TInt aError Recognition result code. KErrNone if successful. KErrRejected if the recognition result is rejected, otherwise a system-wide error code

MarhdoRequestSpeechData()

void MarhdoRequestSpeechData ( )
Called by the hardware device to request for utterance data. The response to the request is sent in SendSpeechData() .
Since
Series60 2.8

NewL(MRecAlgMgrObserver &)

CRecognitionAlgMgr * NewL ( MRecAlgMgrObserver & aObserver ) [static]

Two-phased constructor.

Parameters

MRecAlgMgrObserver & aObserver

Ready(const TInt)

void Ready ( const TInt aStatus ) [private]

Used to complete a request

Parameters

const TInt aStatus

RunL()

void RunL ( ) [private, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

SendSpeechData(TPtrC8 &, TBool)

void SendSpeechData ( TPtrC8 & aBuffer,
TBool aEnd
)

Use to send the utterance data as a response to the RequestSpeechData().

Since
2.8

Parameters

TPtrC8 & aBuffer
TBool aEnd

SetRejection(TUint32)

void SetRejection ( TUint32 aRejection )

Sets rejection value

Parameters

TUint32 aRejection

StartRecSession(TRecognizerMode)

TInt StartRecSession ( TRecognizerMode aMode )

Request to start a recognition session.

Since
2.0

Parameters

TRecognizerMode aMode

StartRecognitionL()

void StartRecognitionL ( )

Starts recognition.

UnloadGrammarL(const CSIGrammar &)

void UnloadGrammarL ( const CSIGrammar & aGrammar )

Unloads the specified grammar from the recognizer.

Since
2.8

Parameters

const CSIGrammar & aGrammar A reference to a grammar.

UnloadGrammarL(const CSICompiledGrammar &)

void UnloadGrammarL ( const CSICompiledGrammar & aGrammar )

Parameters

const CSICompiledGrammar & aGrammar

UnloadRule(TSIGrammarID, TSIRuleID)

void UnloadRule ( TSIGrammarID aGrammarID,
TSIRuleID aRuleID
)

Request to unload the specified rule in the grammar from recognizer.

Parameters

TSIGrammarID aGrammarID
TSIRuleID aRuleID

Member Enumerations Documentation

Enum TAlgState

Current working state of the recognizer

Enumerators

EIdle = 0
EProcessing
ECancel

Member Data Documentation

CASRSAdaptHwDevice * iAdaptHw

CASRSAdaptHwDevice * iAdaptHw [private]

TBool iAdaptation

TBool iAdaptation [private]

HBufC8 * iAdaptationData

HBufC8 * iAdaptationData [private]

TAlgState iBEState

TAlgState iBEState [private]

RPointerArray< TSIRuleVariantInfo > iBlackList

RPointerArray < TSIRuleVariantInfo > iBlackList [private]

TPtrC8 iBuffer

TPtrC8 iBuffer [private]

TBool iCombineNeeded

TBool iCombineNeeded [private]

HBufC8 * iCombinedGrammar

HBufC8 * iCombinedGrammar [private]

TBool iEnd

TBool iEnd [private]

TUint32 iEndFrame

TUint32 iEndFrame [private]

TAlgState iFEState

TAlgState iFEState [private]

TBool iFeatures

TBool iFeatures [private]

TReal iFrameLength

TReal iFrameLength [private]

TSIGrammarID iGrammarID

TSIGrammarID iGrammarID [private]

TBool iInitialized

TBool iInitialized [private]

TRecognizerMode iMode

TRecognizerMode iMode [private]

void * iModel

void * iModel [private]

RArray< TUint > iNBestList

RArray < TUint > iNBestList [private]

MRecAlgMgrObserver * iRecAlgMgrObserver

MRecAlgMgrObserver * iRecAlgMgrObserver [private]

CASRSRecognitionHwDevice * iRecoHw

CASRSRecognitionHwDevice * iRecoHw [private]

TInt iRequestFunction

TInt iRequestFunction [private]

TSIRuleID iRuleID

TSIRuleID iRuleID [private]

const void * iSDCompGrammar

const void * iSDCompGrammar [private]

const void * iSDGrammar

const void * iSDGrammar [private]

const void * iSDLexicon

const void * iSDLexicon [private]

CSDModelBank * iSDModelBank

CSDModelBank * iSDModelBank [private]

void * iSDResult

void * iSDResult [private]

RPointerArray< CSICompiledGrammar > iSIActiveGrammars

RPointerArray < CSICompiledGrammar > iSIActiveGrammars [private]

const CSICompiledGrammar * iSICompGrammar

const CSICompiledGrammar * iSICompGrammar [private]

RPointerArray< CSICompiledGrammar > iSIDeActivatedGrammars

RPointerArray < CSICompiledGrammar > iSIDeActivatedGrammars [private]

const CSIGrammar * iSIGrammar

const CSIGrammar * iSIGrammar [private]

const CSILexicon * iSILexicon

const CSILexicon * iSILexicon [private]

CSIModelBank * iSIModelBank

CSIModelBank * iSIModelBank [private]

CSIResultSet * iSIResult

CSIResultSet * iSIResult [private]

RArray< TInt > iScores

RArray < TInt > iScores [private]

TUint32 iStartFrame

TUint32 iStartFrame [private]