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()
voidActivateGrammarL(const TSIGrammarID)
voidAdaptModelsL(const CSIResultSet &, TInt, TLanguage)
voidAlgorithmState()
voidCancel()
voidCombineComplete(HBufC8 *, TInt)
voidDeactivateGrammarL(const TSIGrammarID)
voidEndRecSession()
voidGetEnginePropertiesL(const RArray< TInt > &, RArray< TInt > &)
voidGetGrammarL(const TSIGrammarID, CSICompiledGrammar **, CSICompiledGrammar **)
TBool GetUtteranceDuration(TUint32 &, TUint32 &, TReal &)
voidInitFrontEnd(TRecognizerMode)
voidInitRecognizerBE(CSIResultSet &)
voidLoadEnginePropertiesL(const RArray< TInt > &, const RArray< TInt > &)
voidLoadGrammarL(const CSIGrammar &)
voidLoadGrammarL(const CSICompiledGrammar &)
voidLoadLexiconL(const CSILexicon &)
voidLoadModelsL(const CSDModelBank &)
voidLoadModelsL(const CSIModelBank &)
voidMaahdAdaptationComplete(TInt)
voidMarhdoEouDetected(TInt)
voidMarhdoFeatureVector(const TDesC8 &, TInt32, TInt32)
voidMarhdoInitRecognizerBEComplete(TInt)
voidMarhdoInitRecognizerFEComplete(TInt)
voidMarhdoInitializationComplete(TInt)
voidMarhdoRecognitionComplete(TInt)
voidMarhdoRequestSpeechData()
CRecognitionAlgMgr *NewL(MRecAlgMgrObserver &)
voidSendSpeechData(TPtrC8 &, TBool)
voidSetRejection(TUint32)
TInt StartRecSession(TRecognizerMode)
voidStartRecognitionL()
voidUnloadGrammarL(const CSIGrammar &)
voidUnloadGrammarL(const CSICompiledGrammar &)
voidUnloadRule(TSIGrammarID, TSIRuleID)
Private Member Functions
CRecognitionAlgMgr(MRecAlgMgrObserver &)
voidConstructL()
voidDoCancel()
voidHandleActivateGrammar()
voidHandleDeActivateGrammar()
voidHandleInitFrontEnd()
voidHandleInitRecognizerBE()
voidHandleInitTrainBE()
voidHandleLoadGrammar()
voidHandleLoadLexicon()
voidHandleLoadModels()
voidHandleUnloadGrammar()
voidHandleUnloadRule()
voidHandleUtteranceDataRcvd()
voidReady(const TInt)
voidRunL()
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
enumTAlgState { 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)

voidActivateGrammarL(const TSIGrammarIDaGrammarID)

Activates a grammar.

Since
2.8

Parameters

const TSIGrammarID aGrammarID

AdaptModelsL(const CSIResultSet &, TInt, TLanguage)

voidAdaptModelsL(const CSIResultSet &aResultSet,
TIntaResultIndex,
TLanguageaLanguage
)

Adapts models

2.8

Parameters

const CSIResultSet & aResultSet
TInt aResultIndex
TLanguage aLanguage

AlgorithmState()

voidAlgorithmState()

Used during unit testing to print the state of the algorithm

Cancel()

voidCancel()

Cancels the current or started tasks.

Since
2.0

CombineComplete(HBufC8 *, TInt)

voidCombineComplete(HBufC8 *aResult,
TIntaError
)

Grammar combination has been completed.

Parameters

HBufC8 * aResult
TInt aError

ConstructL()

voidConstructL()[private]

Symbian 2nd phase constructor

DeactivateGrammarL(const TSIGrammarID)

voidDeactivateGrammarL(const TSIGrammarIDaGrammarID)

Deactivates a grammar

Since
2.8

Parameters

const TSIGrammarID aGrammarID

DoCancel()

voidDoCancel()[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()

voidEndRecSession()

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 > &)

voidGetEnginePropertiesL(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 **)

voidGetGrammarL(const TSIGrammarIDaGrammarID,
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()

voidHandleActivateGrammar()[private]

HandleDeActivateGrammar()

voidHandleDeActivateGrammar()[private]

HandleInitFrontEnd()

voidHandleInitFrontEnd()[private]

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

HandleInitRecognizerBE()

voidHandleInitRecognizerBE()[private]

HandleInitTrainBE()

voidHandleInitTrainBE()[private]

HandleLoadGrammar()

voidHandleLoadGrammar()[private]

HandleLoadLexicon()

voidHandleLoadLexicon()[private]

HandleLoadModels()

voidHandleLoadModels()[private]

HandleUnloadGrammar()

voidHandleUnloadGrammar()[private]

HandleUnloadRule()

voidHandleUnloadRule()[private]

HandleUtteranceDataRcvd()

voidHandleUtteranceDataRcvd()[private]

InitFrontEnd(TRecognizerMode)

voidInitFrontEnd(TRecognizerModeaFeMode)

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 &)

voidInitRecognizerBE(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 & aResultA reference to an object where the recognition result will be written.

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

voidLoadEnginePropertiesL(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 &)

voidLoadGrammarL(const CSIGrammar &aGrammar)

Load the specified grammar into the recognizer.

Since
2.8

Parameters

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

LoadGrammarL(const CSICompiledGrammar &)

voidLoadGrammarL(const CSICompiledGrammar &aGrammar)

Parameters

const CSICompiledGrammar & aGrammar

LoadLexiconL(const CSILexicon &)

voidLoadLexiconL(const CSILexicon &aLexicon)

Load the specified lexicon into the recognizer.

Since
2.0

Parameters

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

LoadModelsL(const CSDModelBank &)

voidLoadModelsL(const CSDModelBank &aModels)

Load the specified model bank into the recognizer.

Since
2.0

Parameters

const CSDModelBank & aModelsA reference to a model bank.

LoadModelsL(const CSIModelBank &)

voidLoadModelsL(const CSIModelBank &aModels)

Parameters

const CSIModelBank & aModels

MaahdAdaptationComplete(TInt)

voidMaahdAdaptationComplete(TIntaError)

Called when adaptation has been done

Parameters

TInt aError

MarhdoEouDetected(TInt)

voidMarhdoEouDetected(TIntaError)
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 aErrorRecognition result code. KErrNone if successful, otherwise KErrTooLong, KErrTooShort, KErrAsrSpeechTooEarly, KErrNoSpeech

MarhdoFeatureVector(const TDesC8 &, TInt32, TInt32)

voidMarhdoFeatureVector(const TDesC8 &aFV,
TInt32aSNR,
TInt32aPosition
)
Called by the hardware device when a feature vector is extracted by acoustic frontend.
Since
Series60 2.8

Parameters

const TDesC8 & aFVA buffer containing a feature vector.
TInt32 aSNRSignal-to-noise ratio.
TInt32 aPositionIndicates whether this is the first, subsequent or last feature vector in a series.

MarhdoInitRecognizerBEComplete(TInt)

voidMarhdoInitRecognizerBEComplete(TIntaError)
Called by the hardware device when backend initialization is completed.
Since
Series60 2.8

Parameters

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

MarhdoInitRecognizerFEComplete(TInt)

voidMarhdoInitRecognizerFEComplete(TIntaError)
Called by the hardware device when the InitializeL() method has completed.
Since
Series60 2.8

Parameters

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

MarhdoInitializationComplete(TInt)

voidMarhdoInitializationComplete(TIntaError)
Called by the hardware device when the InitializeL() method has completed.
Since
Series60 2.8

Parameters

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

MarhdoRecognitionComplete(TInt)

voidMarhdoRecognitionComplete(TIntaError)
Called by the hardware device when recognition result is available.
Since
Series60 2.8

Parameters

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

MarhdoRequestSpeechData()

voidMarhdoRequestSpeechData()
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)

voidReady(const TIntaStatus)[private]

Used to complete a request

Parameters

const TInt aStatus

RunL()

voidRunL()[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)

voidSendSpeechData(TPtrC8 &aBuffer,
TBoolaEnd
)

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

Since
2.8

Parameters

TPtrC8 & aBuffer
TBool aEnd

SetRejection(TUint32)

voidSetRejection(TUint32aRejection)

Sets rejection value

Parameters

TUint32 aRejection

StartRecSession(TRecognizerMode)

TInt StartRecSession(TRecognizerModeaMode)

Request to start a recognition session.

Since
2.0

Parameters

TRecognizerMode aMode

StartRecognitionL()

voidStartRecognitionL()

Starts recognition.

UnloadGrammarL(const CSIGrammar &)

voidUnloadGrammarL(const CSIGrammar &aGrammar)

Unloads the specified grammar from the recognizer.

Since
2.8

Parameters

const CSIGrammar & aGrammarA reference to a grammar.

UnloadGrammarL(const CSICompiledGrammar &)

voidUnloadGrammarL(const CSICompiledGrammar &aGrammar)

Parameters

const CSICompiledGrammar & aGrammar

UnloadRule(TSIGrammarID, TSIRuleID)

voidUnloadRule(TSIGrammarIDaGrammarID,
TSIRuleIDaRuleID
)

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]