CSpeechRecognitionUtility Class Reference

class CSpeechRecognitionUtility : public CBase

This is the main class of Speech Recognition Utility.

Since
8.0

Inherits from

Nested Classes and Structures

Public Member Functions
~CSpeechRecognitionUtility ()
IMPORT_C TInt AddPronunciation ( TLexiconID , TModelBankID , TModelID , TPronunciationID &)
IMPORT_C TInt AddRule ( TGrammarID , TLexiconID , TPronunciationID , TRuleID &)
IMPORT_C void Cancel ()
IMPORT_C TInt CommitChanges ()
IMPORT_C TInt CreateGrammar ( TGrammarID &)
IMPORT_C TInt CreateLexicon ( TLexiconID &)
IMPORT_C TInt CreateModelBank ( TModelBankID &)
IMPORT_C TInt EndRecSession ()
IMPORT_C TInt GetAllClientGrammarIDs ( RArray < TGrammarID > &)
IMPORT_C TInt GetAllClientLexiconIDs ( RArray < TLexiconID > &)
IMPORT_C TInt GetAllClientModelBankIDs ( RArray < TModelBankID > &)
IMPORT_C TInt GetAllGrammarIDs ( RArray < TGrammarID > &)
IMPORT_C TInt GetAllLexiconIDs ( RArray < TLexiconID > &)
IMPORT_C TInt GetAllModelBankIDs ( RArray < TModelBankID > &)
IMPORT_C TInt GetAllModelIDs ( TModelBankID , RArray < TModelID > &)
IMPORT_C TInt GetAllPronunciationIDs ( TLexiconID , RArray < TPronunciationID > &)
IMPORT_C TInt GetAllRuleIDs ( TGrammarID , RArray < TRuleID > &)
IMPORT_C TInt GetAvailableStorage ( TInt &)
IMPORT_C TInt GetEngineProperties (const RArray < TInt > &, RArray < TInt > &)
IMPORT_C TInt GetModelCount ( TModelBankID , TInt &)
IMPORT_C TInt GetRuleValidity ( TGrammarID , TRuleID , TBool &)
IMPORT_C TInt GetUtteranceDuration ( TModelBankID , TModelID , TTimeIntervalMicroSeconds32 &)
IMPORT_C TInt LoadEngineParameters (const RArray < TInt > &, const RArray < TInt > &)
IMPORT_C TInt LoadGrammar ( TGrammarID )
IMPORT_C TInt LoadLexicon ( TLexiconID )
IMPORT_C TInt LoadModels ( TModelBankID )
IMPORT_C CSpeechRecognitionUtility * NewL ( MSpeechRecognitionUtilityObserver &, TUid )
IMPORT_C CSpeechRecognitionUtility * NewLC ( MSpeechRecognitionUtilityObserver &, TUid )
IMPORT_C TInt PlayUtterance ( TModelBankID , TModelID )
IMPORT_C TInt Recognize ( CSDClientResultSet &)
IMPORT_C TInt Record ( TTimeIntervalMicroSeconds32 )
IMPORT_C TInt RemoveGrammar ( TGrammarID )
IMPORT_C TInt RemoveLexicon ( TLexiconID )
IMPORT_C TInt RemoveModel ( TModelBankID , TModelID )
IMPORT_C TInt RemoveModelBank ( TModelBankID )
IMPORT_C TInt RemovePronunciation ( TLexiconID , TPronunciationID )
IMPORT_C TInt RemoveRule ( TGrammarID , TRuleID )
IMPORT_C TInt SetAudioPriority ( TInt , TInt , TInt , TInt )
IMPORT_C void SetEventHandler ( MSpeechRecognitionUtilityObserver *)
IMPORT_C TInt StartRecSession ( TRecognitionMode )
IMPORT_C TInt Train ( TModelBankID , TModelID &)
IMPORT_C TInt UnloadRule ( TGrammarID , TRuleID )
Private Member Functions
CSpeechRecognitionUtility ()
void ConstructL ( MSpeechRecognitionUtilityObserver &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
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 Attributes
CBody * iBody

Constructor & Destructor Documentation

CSpeechRecognitionUtility()

CSpeechRecognitionUtility ( ) [private]

Private C++ constructor for this class.

Since
8.0

~CSpeechRecognitionUtility()

IMPORT_C ~CSpeechRecognitionUtility ( )

Destructor.

Since
8.0

Member Functions Documentation

AddPronunciation(TLexiconID, TModelBankID, TModelID, TPronunciationID &)

IMPORT_C TInt AddPronunciation ( TLexiconID aLexiconID,
TModelBankID aModelBankID,
TModelID aModelID,
TPronunciationID & aPronunciationID
)

Adds a new pronunciation for the given model into the specified lexicon.

Since
8.0

Parameters

TLexiconID aLexiconID The lexicon ID, where the new pronunciation is added to.
TModelBankID aModelBankID The model bank ID.
TModelID aModelID The model ID.
TPronunciationID & aPronunciationID A reference where the new pronunciation ID is assigned to.

AddRule(TGrammarID, TLexiconID, TPronunciationID, TRuleID &)

IMPORT_C TInt AddRule ( TGrammarID aGrammarID,
TLexiconID aLexiconID,
TPronunciationID aPronunciationID,
TRuleID & aRuleID
)

Adds a new rule for the given pronunciation into the specified grammar.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID, where the new rule is added to.
TLexiconID aLexiconID The lexicon ID.
TPronunciationID aPronunciationID The pronunciation ID.
TRuleID & aRuleID A reference where the new rule ID is assigned to.

Cancel()

IMPORT_C void Cancel ( )

Cancels the current operation.

Since
8.0

CommitChanges()

IMPORT_C TInt CommitChanges ( )

Commit the current train operation to the database.

Since
8.0

ConstructL(MSpeechRecognitionUtilityObserver &)

void ConstructL ( MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserver ) [private]

Second phase constructor for this class.

Since
8.0

Parameters

MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserver A reference to the event observer class.

CreateGrammar(TGrammarID &)

IMPORT_C TInt CreateGrammar ( TGrammarID & aGrammarID )

Creates a new grammar.

Since
8.0

Parameters

TGrammarID & aGrammarID A reference where grammar ID is stored.

CreateLexicon(TLexiconID &)

IMPORT_C TInt CreateLexicon ( TLexiconID & aLexiconID )

Creates a new lexicon.

Since
8.0

Parameters

TLexiconID & aLexiconID A reference where lexicon ID is stored.

CreateModelBank(TModelBankID &)

IMPORT_C TInt CreateModelBank ( TModelBankID & aModelBankID )

Creates a new model bank.

Since
8.0

Parameters

TModelBankID & aModelBankID A reference where a new model bank IF is assigned to.

EndRecSession()

IMPORT_C TInt EndRecSession ( )

Ends the current recognition session. Resources allocated for recognition are freed.

Since
8.0

GetAllClientGrammarIDs(RArray< TGrammarID > &)

IMPORT_C TInt GetAllClientGrammarIDs ( RArray < TGrammarID > & aGrammarIDs )

Returns all grammar IDs owned by the client.

Since
8.0

Parameters

RArray < TGrammarID > & aGrammarIDs A reference where rule IDs are stored.

GetAllClientLexiconIDs(RArray< TLexiconID > &)

IMPORT_C TInt GetAllClientLexiconIDs ( RArray < TLexiconID > & aLexiconIDs )

Returns all lexicons owned by the client.

Since
8.0

Parameters

RArray < TLexiconID > & aLexiconIDs A reference where lexicon IDs are stored.

GetAllClientModelBankIDs(RArray< TModelBankID > &)

IMPORT_C TInt GetAllClientModelBankIDs ( RArray < TModelBankID > & aModelBankIDs )

Returns all modelbank IDs owned by the client.

Since
8.0

Parameters

RArray < TModelBankID > & aModelBankIDs A reference where modelbank IDs are stored.

GetAllGrammarIDs(RArray< TGrammarID > &)

IMPORT_C TInt GetAllGrammarIDs ( RArray < TGrammarID > & aGrammarIDs )

Returns all grammar IDs.

Since
8.0

Parameters

RArray < TGrammarID > & aGrammarIDs A reference where rule IDs are stored.

GetAllLexiconIDs(RArray< TLexiconID > &)

IMPORT_C TInt GetAllLexiconIDs ( RArray < TLexiconID > & aLexiconIDs )

Returns all lexicons IDs.

Since
8.0

Parameters

RArray < TLexiconID > & aLexiconIDs A reference where lexicon IDs are stored.

GetAllModelBankIDs(RArray< TModelBankID > &)

IMPORT_C TInt GetAllModelBankIDs ( RArray < TModelBankID > & aModelBankIDs )

Returns all modelbank IDs.

Since
8.0

Parameters

RArray < TModelBankID > & aModelBankIDs A reference where modelbank IDs are stored.

GetAllModelIDs(TModelBankID, RArray< TModelID > &)

IMPORT_C TInt GetAllModelIDs ( TModelBankID aModelBankID,
RArray < TModelID > & aModelIDs
)

Returns all model IDs that exist in the specified model bank.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.
RArray < TModelID > & aModelIDs A reference where model IDs are stored.

GetAllPronunciationIDs(TLexiconID, RArray< TPronunciationID > &)

IMPORT_C TInt GetAllPronunciationIDs ( TLexiconID aLexiconID,
RArray < TPronunciationID > & aPronunciationIDs
)

Returns all pronunciation IDs that exist in the specified lexicon.

Since
8.0

Parameters

TLexiconID aLexiconID The lexicon ID.
RArray < TPronunciationID > & aPronunciationIDs A reference where pronunciation IDs are stored.

GetAllRuleIDs(TGrammarID, RArray< TRuleID > &)

IMPORT_C TInt GetAllRuleIDs ( TGrammarID aGrammarID,
RArray < TRuleID > & aRuleIDs
)

Returns all rule IDs that exist in the specified grammar.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID.
RArray < TRuleID > & aRuleIDs A reference where rule IDs are stored.

GetAvailableStorage(TInt &)

IMPORT_C TInt GetAvailableStorage ( TInt & aAvailableStorage )

Returns the number of models available for training system model storage, based on available disk space.

Since
8.0

Parameters

TInt & aAvailableStorage The number of models that can be contained in available storage.

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

IMPORT_C TInt GetEngineProperties ( const RArray < TInt > & aPropertyId,
RArray < TInt > & aPropertyValue
)

Returns the engine properties specified by the engine property ID array. On return aPropertyValue contains an array of engine properties.

Since
8.0

Parameters

const RArray < TInt > & aPropertyId A constant reference to an array of engine property ID's.
RArray < TInt > & aPropertyValue A reference to an array of engine property values.

GetModelCount(TModelBankID, TInt &)

IMPORT_C TInt GetModelCount ( TModelBankID aModelBankID,
TInt & aModelCount
)

Returns the number of models in the specified model bank.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.
TInt & aModelCount The reference where the number of models is set.

GetRuleValidity(TGrammarID, TRuleID, TBool &)

IMPORT_C TInt GetRuleValidity ( TGrammarID aGrammarID,
TRuleID aRuleID,
TBool & aValid
)

Checks if the rule is valid or not.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID.
TRuleID aRuleID The rule ID.
TBool & aValid A reference where the validity of the rule is set.

GetUtteranceDuration(TModelBankID, TModelID, TTimeIntervalMicroSeconds32 &)

IMPORT_C TInt GetUtteranceDuration ( TModelBankID aModelBankID,
TModelID aModelID,
TTimeIntervalMicroSeconds32 & aDuration
)

Returns the duration of the utterance for the specified model.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.
TModelID aModelID The model ID.
TTimeIntervalMicroSeconds32 & aDuration The reference where the duration of utterance is set.

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

IMPORT_C TInt LoadEngineParameters ( const RArray < TInt > & aParameterId,
const RArray < TInt > & aParameterValue
)

Loads the specified parameters into the recognition engine.

Since
8.0

Parameters

const RArray < TInt > & aParameterId The array of parameter IDs.
const RArray < TInt > & aParameterValue The array of parameter values.

LoadGrammar(TGrammarID)

IMPORT_C TInt LoadGrammar ( TGrammarID aGrammarID )

Loads the specified grammar into the recognizer; done prior to recognition.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID.

LoadLexicon(TLexiconID)

IMPORT_C TInt LoadLexicon ( TLexiconID aLexiconID )

Loads the specified lexicon into the recognizer; done prior to recognition.

Since
8.0

Parameters

TLexiconID aLexiconID The lexicon ID.

LoadModels(TModelBankID)

IMPORT_C TInt LoadModels ( TModelBankID aModelBankID )

Loads the specified model bank into the recognizer; done prior to recognition.

Since
8.0

Parameters

TModelBankID aModelBankID The Model bank ID

NewL(MSpeechRecognitionUtilityObserver &, TUid)

IMPORT_C CSpeechRecognitionUtility * NewL ( MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserver,
TUid aClientUid
) [static]

Factory function for creating this class.

Since
8.0

Parameters

MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserver A reference to the event observer class.
TUid aClientUid The UID of the client.

NewLC(MSpeechRecognitionUtilityObserver &, TUid)

IMPORT_C CSpeechRecognitionUtility * NewLC ( MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserver,
TUid aClientUid
) [static]

Factory function for creating this class. Leaves a pointer on the cleanup stack.

Since
8.0

Parameters

MSpeechRecognitionUtilityObserver & aSpeechRecognitionUtilityObserver A reference to the event observer class.
TUid aClientUid A client UID for data ownership.

PlayUtterance(TModelBankID, TModelID)

IMPORT_C TInt PlayUtterance ( TModelBankID aModelBankID,
TModelID aModelID
)

Plays the previously trained utterance.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.
TModelID aModelID The model ID, whose utterance is played.

Recognize(CSDClientResultSet &)

IMPORT_C TInt Recognize ( CSDClientResultSet & aResultSet )

Initiates recognition; performed following loading of model bank, lexicon, and grammar.

Since
8.0

Parameters

CSDClientResultSet & aResultSet A reference where the recognition result is set.

Record(TTimeIntervalMicroSeconds32)

IMPORT_C TInt Record ( TTimeIntervalMicroSeconds32 aRecordTime )

Records user utterance for training and recognition.

Since
8.0

Parameters

TTimeIntervalMicroSeconds32 aRecordTime The recording time in microseconds.

RemoveGrammar(TGrammarID)

IMPORT_C TInt RemoveGrammar ( TGrammarID aGrammarID )

Removes the specified grammar from the permanent storage.

Removing a grammar will remove all rules within the grammar.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID.

RemoveLexicon(TLexiconID)

IMPORT_C TInt RemoveLexicon ( TLexiconID aLexiconID )

Removes the specified lexicon from the permanent storage.

Removing a lexicon will remove all pronunciations within the lexicon.

Since
8.0

Parameters

TLexiconID aLexiconID The lexicon ID.

RemoveModel(TModelBankID, TModelID)

IMPORT_C TInt RemoveModel ( TModelBankID aModelBankID,
TModelID aModelID
)

Removes the specified model from the specified model bank permanently.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.
TModelID aModelID The model ID.

RemoveModelBank(TModelBankID)

IMPORT_C TInt RemoveModelBank ( TModelBankID aModelBankID )

Removes the specified model bank from the permanent storage.

Removing a model bank will remove all models within the model bank.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.

RemovePronunciation(TLexiconID, TPronunciationID)

IMPORT_C TInt RemovePronunciation ( TLexiconID aLexiconID,
TPronunciationID aPronunciationID
)

Removes the specified pronunciation from the specified lexicon permanently.

Since
8.0

Parameters

TLexiconID aLexiconID The lexicon ID.
TPronunciationID aPronunciationID The pronunciation ID.

RemoveRule(TGrammarID, TRuleID)

IMPORT_C TInt RemoveRule ( TGrammarID aGrammarID,
TRuleID aRuleID
)

Removes the specified rule from the specified grammar permanently.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID.
TRuleID aRuleID The rule ID.

SetAudioPriority(TInt, TInt, TInt, TInt)

IMPORT_C TInt SetAudioPriority ( TInt aPriority,
TInt aTrainPreference,
TInt aPlaybackPreference,
TInt aRecognitionPreference
)

Sets the audio priority and preference for train, playback and recognition.

Since
8.0

Parameters

TInt aPriority The priority for voice recognition.
TInt aTrainPreference The preference for training.
TInt aPlaybackPreference The preference for playback.
TInt aRecognitionPreference The preference for recognition.

SetEventHandler(MSpeechRecognitionUtilityObserver *)

IMPORT_C void SetEventHandler ( MSpeechRecognitionUtilityObserver * aSpeechRecognitionUtilityObserver )

Sets the event handler for asynchronous events.

Since
8.0

Parameters

MSpeechRecognitionUtilityObserver * aSpeechRecognitionUtilityObserver A pointer to an observer.

StartRecSession(TRecognitionMode)

IMPORT_C TInt StartRecSession ( TRecognitionMode aMode )

Starts a new recognition session.

Since
8.0

Parameters

TRecognitionMode aMode The recognition mode.

Train(TModelBankID, TModelID &)

IMPORT_C TInt Train ( TModelBankID aModelBankID,
TModelID & aModelID
)

Trains a new model into the specified model bank.

Since
8.0

Parameters

TModelBankID aModelBankID The model bank ID.
TModelID & aModelID A reference where a new model ID is assigned to.

UnloadRule(TGrammarID, TRuleID)

IMPORT_C TInt UnloadRule ( TGrammarID aGrammarID,
TRuleID aRuleID
)

Unloads the specified rule from the specified grammar in temporary memory, previously loaded with LoadGrammarL.

The rule in the permanent storage remains intact.

Since
8.0

Parameters

TGrammarID aGrammarID The grammar ID.
TRuleID aRuleID The rule ID.

Member Data Documentation

CBody * iBody

CBody * iBody [private]