CSpeechRecognitionUtility Class Reference

#include <speechrecognitionutility.h>

Link against: speechrecognitionutility.lib

class CSpeechRecognitionUtility : public CBase

Inherits from

  • CSpeechRecognitionUtility

Nested Classes and Structures

  • CSpeechRecognitionUtility::CBody
Public Member Functions
~CSpeechRecognitionUtility()
IMPORT_C TIntAddPronunciation(TLexiconID, TModelBankID, TModelID, TPronunciationID &)
IMPORT_C TIntAddRule(TGrammarID, TLexiconID, TPronunciationID, TRuleID &)
IMPORT_C voidCancel()
IMPORT_C TIntCommitChanges()
IMPORT_C TIntCreateGrammar(TGrammarID &)
IMPORT_C TIntCreateLexicon(TLexiconID &)
IMPORT_C TIntCreateModelBank(TModelBankID &)
IMPORT_C TIntEndRecSession()
IMPORT_C TIntGetAllClientGrammarIDs(RArray< TGrammarID > &)
IMPORT_C TIntGetAllClientLexiconIDs(RArray< TLexiconID > &)
IMPORT_C TIntGetAllClientModelBankIDs(RArray< TModelBankID > &)
IMPORT_C TIntGetAllGrammarIDs(RArray< TGrammarID > &)
IMPORT_C TIntGetAllLexiconIDs(RArray< TLexiconID > &)
IMPORT_C TIntGetAllModelBankIDs(RArray< TModelBankID > &)
IMPORT_C TIntGetAllModelIDs(TModelBankID, RArray< TModelID > &)
IMPORT_C TIntGetAllPronunciationIDs(TLexiconID, RArray< TPronunciationID > &)
IMPORT_C TIntGetAllRuleIDs(TGrammarID, RArray< TRuleID > &)
IMPORT_C TIntGetAvailableStorage(TInt &)
IMPORT_C TIntGetEngineProperties(const RArray< TInt > &, RArray< TInt > &)
IMPORT_C TIntGetModelCount(TModelBankID, TInt &)
IMPORT_C TIntGetRuleValidity(TGrammarID, TRuleID, TBool &)
IMPORT_C TIntGetUtteranceDuration(TModelBankID, TModelID, TTimeIntervalMicroSeconds32 &)
IMPORT_C TIntLoadEngineParameters(const RArray< TInt > &, const RArray< TInt > &)
IMPORT_C TIntLoadGrammar(TGrammarID)
IMPORT_C TIntLoadLexicon(TLexiconID)
IMPORT_C TIntLoadModels(TModelBankID)
IMPORT_C CSpeechRecognitionUtility *NewL(MSpeechRecognitionUtilityObserver &, TUid)
IMPORT_C CSpeechRecognitionUtility *NewLC(MSpeechRecognitionUtilityObserver &, TUid)
IMPORT_C TIntPlayUtterance(TModelBankID, TModelID)
IMPORT_C TIntRecognize(CSDClientResultSet &)
IMPORT_C TIntRecord(TTimeIntervalMicroSeconds32)
IMPORT_C TIntRemoveGrammar(TGrammarID)
IMPORT_C TIntRemoveLexicon(TLexiconID)
IMPORT_C TIntRemoveModel(TModelBankID, TModelID)
IMPORT_C TIntRemoveModelBank(TModelBankID)
IMPORT_C TIntRemovePronunciation(TLexiconID, TPronunciationID)
IMPORT_C TIntRemoveRule(TGrammarID, TRuleID)
IMPORT_C TIntSetAudioPriority(TInt, TInt, TInt, TInt)
IMPORT_C voidSetEventHandler(MSpeechRecognitionUtilityObserver *)
IMPORT_C TIntStartRecSession(TRecognitionMode)
IMPORT_C TIntTrain(TModelBankID, TModelID &)
IMPORT_C TIntUnloadRule(TGrammarID, TRuleID)
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()

Detailed Description

This is the main class of Speech Recognition Utility.

Since
8.0

Constructor & Destructor Documentation

~CSpeechRecognitionUtility ( )

IMPORT_C~CSpeechRecognitionUtility()

Destructor.

Since
8.0

Member Function Documentation

AddPronunciation ( TLexiconID, TModelBankID, TModelID, TPronunciationID & )

IMPORT_C TIntAddPronunciation(TLexiconIDaLexiconID,
TModelBankIDaModelBankID,
TModelIDaModelID,
TPronunciationID &aPronunciationID
)

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

Since
8.0
Parameters
aLexiconIDThe lexicon ID, where the new pronunciation is added to.
aModelBankIDThe model bank ID.
aModelIDThe model ID.
aPronunciationIDA reference where the new pronunciation ID is assigned to.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

AddRule ( TGrammarID, TLexiconID, TPronunciationID, TRuleID & )

IMPORT_C TIntAddRule(TGrammarIDaGrammarID,
TLexiconIDaLexiconID,
TPronunciationIDaPronunciationID,
TRuleID &aRuleID
)

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

Since
8.0
Parameters
aGrammarIDThe grammar ID, where the new rule is added to.
aLexiconIDThe lexicon ID.
aPronunciationIDThe pronunciation ID.
aRuleIDA reference where the new rule ID is assigned to.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Cancel ( )

IMPORT_C voidCancel()

Cancels the current operation.

Since
8.0

CommitChanges ( )

IMPORT_C TIntCommitChanges()

Commit the current train operation to the database.

Since
8.0
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

CreateGrammar ( TGrammarID & )

IMPORT_C TIntCreateGrammar(TGrammarID &aGrammarID)

Creates a new grammar.

Since
8.0
Parameters
aGrammarIDA reference where grammar ID is stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

CreateLexicon ( TLexiconID & )

IMPORT_C TIntCreateLexicon(TLexiconID &aLexiconID)

Creates a new lexicon.

Since
8.0
Parameters
aLexiconIDA reference where lexicon ID is stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

CreateModelBank ( TModelBankID & )

IMPORT_C TIntCreateModelBank(TModelBankID &aModelBankID)

Creates a new model bank.

Since
8.0
Parameters
aModelBankIDA reference where a new model bank IF is assigned to.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

EndRecSession ( )

IMPORT_C TIntEndRecSession()

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

Since
8.0
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllClientGrammarIDs ( RArray< TGrammarID > & )

IMPORT_C TIntGetAllClientGrammarIDs(RArray< TGrammarID > &aGrammarIDs)

Returns all grammar IDs owned by the client.

Since
8.0
Parameters
aGrammarIDsA reference where rule IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllClientLexiconIDs ( RArray< TLexiconID > & )

IMPORT_C TIntGetAllClientLexiconIDs(RArray< TLexiconID > &aLexiconIDs)

Returns all lexicons owned by the client.

Since
8.0
Parameters
aLexiconIDsA reference where lexicon IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllClientModelBankIDs ( RArray< TModelBankID > & )

IMPORT_C TIntGetAllClientModelBankIDs(RArray< TModelBankID > &aModelBankIDs)

Returns all modelbank IDs owned by the client.

Since
8.0
Parameters
aModelBankIDsA reference where modelbank IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllGrammarIDs ( RArray< TGrammarID > & )

IMPORT_C TIntGetAllGrammarIDs(RArray< TGrammarID > &aGrammarIDs)

Returns all grammar IDs.

Since
8.0
Parameters
aGrammarIDsA reference where rule IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllLexiconIDs ( RArray< TLexiconID > & )

IMPORT_C TIntGetAllLexiconIDs(RArray< TLexiconID > &aLexiconIDs)

Returns all lexicons IDs.

Since
8.0
Parameters
aLexiconIDsA reference where lexicon IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllModelBankIDs ( RArray< TModelBankID > & )

IMPORT_C TIntGetAllModelBankIDs(RArray< TModelBankID > &aModelBankIDs)

Returns all modelbank IDs.

Since
8.0
Parameters
aModelBankIDsA reference where modelbank IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllModelIDs ( TModelBankID, RArray< TModelID > & )

IMPORT_C TIntGetAllModelIDs(TModelBankIDaModelBankID,
RArray< TModelID > &aModelIDs
)

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

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDsA reference where model IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllPronunciationIDs ( TLexiconID, RArray< TPronunciationID > & )

IMPORT_C TIntGetAllPronunciationIDs(TLexiconIDaLexiconID,
RArray< TPronunciationID > &aPronunciationIDs
)

Returns all pronunciation IDs that exist in the specified lexicon.

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
aPronunciationIDsA reference where pronunciation IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAllRuleIDs ( TGrammarID, RArray< TRuleID > & )

IMPORT_C TIntGetAllRuleIDs(TGrammarIDaGrammarID,
RArray< TRuleID > &aRuleIDs
)

Returns all rule IDs that exist in the specified grammar.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
aRuleIDsA reference where rule IDs are stored.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetAvailableStorage ( TInt & )

IMPORT_C TIntGetAvailableStorage(TInt &aAvailableStorage)

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

Since
8.0
Parameters
aAvailableStorageThe number of models that can be contained in available storage.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

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

IMPORT_C TIntGetEngineProperties(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
aPropertyIdA constant reference to an array of engine property ID's.
aPropertyValueA reference to an array of engine property values.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetModelCount ( TModelBankID, TInt & )

IMPORT_C TIntGetModelCount(TModelBankIDaModelBankID,
TInt &aModelCount
)

Returns the number of models in the specified model bank.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelCountThe reference where the number of models is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetRuleValidity ( TGrammarID, TRuleID, TBool & )

IMPORT_C TIntGetRuleValidity(TGrammarIDaGrammarID,
TRuleIDaRuleID,
TBool &aValid
)

Checks if the rule is valid or not.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
aRuleIDThe rule ID.
aValidA reference where the validity of the rule is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

GetUtteranceDuration ( TModelBankID, TModelID, TTimeIntervalMicroSeconds32 & )

IMPORT_C TIntGetUtteranceDuration(TModelBankIDaModelBankID,
TModelIDaModelID,
TTimeIntervalMicroSeconds32 &aDuration
)

Returns the duration of the utterance for the specified model.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDThe model ID.
aDurationThe reference where the duration of utterance is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

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

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

Loads the specified parameters into the recognition engine.

Since
8.0
Parameters
aParameterIdThe array of parameter IDs.
aParameterValueThe array of parameter values.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

LoadGrammar ( TGrammarID )

IMPORT_C TIntLoadGrammar(TGrammarIDaGrammarID)

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

Since
8.0
Parameters
aGrammarIDThe grammar ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

LoadLexicon ( TLexiconID )

IMPORT_C TIntLoadLexicon(TLexiconIDaLexiconID)

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

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

LoadModels ( TModelBankID )

IMPORT_C TIntLoadModels(TModelBankIDaModelBankID)

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

Since
8.0
Parameters
aModelBankIDThe Model bank ID
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

NewL ( MSpeechRecognitionUtilityObserver &, TUid )

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

Factory function for creating this class.

Since
8.0
Parameters
aSpeechRecognitionUtilityObserverA reference to the event observer class.
aClientUidThe UID of the client.
Return Value
A pointer to CSpeechRecognitionUtility object

NewLC ( MSpeechRecognitionUtilityObserver &, TUid )

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

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

Since
8.0
Parameters
aSpeechRecognitionUtilityObserverA reference to the event observer class.
aClientUidA client UID for data ownership.
Return Value
A pointer to a CSpeechRecognitionUtility object.

PlayUtterance ( TModelBankID, TModelID )

IMPORT_C TIntPlayUtterance(TModelBankIDaModelBankID,
TModelIDaModelID
)

Plays the previously trained utterance.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDThe model ID, whose utterance is played.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Recognize ( CSDClientResultSet & )

IMPORT_C TIntRecognize(CSDClientResultSet &aResultSet)

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

Since
8.0
Parameters
aResultSetA reference where the recognition result is set.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Record ( TTimeIntervalMicroSeconds32 )

IMPORT_C TIntRecord(TTimeIntervalMicroSeconds32aRecordTime)

Records user utterance for training and recognition.

Since
8.0
Parameters
aRecordTimeThe recording time in microseconds.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveGrammar ( TGrammarID )

IMPORT_C TIntRemoveGrammar(TGrammarIDaGrammarID)

Removes the specified grammar from the permanent storage.

Removing a grammar will remove all rules within the grammar.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveLexicon ( TLexiconID )

IMPORT_C TIntRemoveLexicon(TLexiconIDaLexiconID)

Removes the specified lexicon from the permanent storage.

Removing a lexicon will remove all pronunciations within the lexicon.

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveModel ( TModelBankID, TModelID )

IMPORT_C TIntRemoveModel(TModelBankIDaModelBankID,
TModelIDaModelID
)

Removes the specified model from the specified model bank permanently.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDThe model ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveModelBank ( TModelBankID )

IMPORT_C TIntRemoveModelBank(TModelBankIDaModelBankID)

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
aModelBankIDThe model bank ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemovePronunciation ( TLexiconID, TPronunciationID )

IMPORT_C TIntRemovePronunciation(TLexiconIDaLexiconID,
TPronunciationIDaPronunciationID
)

Removes the specified pronunciation from the specified lexicon permanently.

Since
8.0
Parameters
aLexiconIDThe lexicon ID.
aPronunciationIDThe pronunciation ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

RemoveRule ( TGrammarID, TRuleID )

IMPORT_C TIntRemoveRule(TGrammarIDaGrammarID,
TRuleIDaRuleID
)

Removes the specified rule from the specified grammar permanently.

Since
8.0
Parameters
aGrammarIDThe grammar ID.
aRuleIDThe rule ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

SetAudioPriority ( TInt, TInt, TInt, TInt )

IMPORT_C TIntSetAudioPriority(TIntaPriority,
TIntaTrainPreference,
TIntaPlaybackPreference,
TIntaRecognitionPreference
)

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

Since
8.0
Parameters
aPriorityThe priority for voice recognition.
aTrainPreferenceThe preference for training.
aPlaybackPreferenceThe preference for playback.
aRecognitionPreferenceThe preference for recognition.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

SetEventHandler ( MSpeechRecognitionUtilityObserver * )

IMPORT_C voidSetEventHandler(MSpeechRecognitionUtilityObserver *aSpeechRecognitionUtilityObserver)

Sets the event handler for asynchronous events.

Since
8.0
Parameters
aSpeechRecognitionUtilityObserverA pointer to an observer.

StartRecSession ( TRecognitionMode )

IMPORT_C TIntStartRecSession(TRecognitionModeaMode)

Starts a new recognition session.

Since
8.0
Parameters
aModeThe recognition mode.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

Train ( TModelBankID, TModelID & )

IMPORT_C TIntTrain(TModelBankIDaModelBankID,
TModelID &aModelID
)

Trains a new model into the specified model bank.

Since
8.0
Parameters
aModelBankIDThe model bank ID.
aModelIDA reference where a new model ID is assigned to.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

UnloadRule ( TGrammarID, TRuleID )

IMPORT_C TIntUnloadRule(TGrammarIDaGrammarID,
TRuleIDaRuleID
)

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
aGrammarIDThe grammar ID.
aRuleIDThe rule ID.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.