Overview

ALSpeechRecognition gives access to the embedded voice recognition system. It can be dynamically modified. This class allows user to load the current words list that should be recognized. The result of the recognition engine is located in the ALMemory's key: "WordRecognized" The structure of the result is an array : [ (string) word , (float) confidence ]

Methods

void setVisualExpression (const bool& setOrNot)

Enables or disables the leds animations showing the state of the recognition engine during the recognition process.

setOrNot

Enable (true) or disable it (false).

void setAudioExpression (const bool& setOrNot)

Enables or disables the playing of sounds indicating the state of the recognition engine.
If this option is enabled, a sound is played at the beginning of the recognition process (after a call to the subscribe method), and a sound is played when the user call the unsubscribe method

setOrNot

Enable (true) or disable it (false).

void setLanguage (const string& languageName)

Sets the language used by the speech recognition engine. The list of the available languages can be collected through the getAvailableLanguages method. If you want to set a language as the default language (loading automatically at module launch), please refer to the web page of the robot.

languageName

Name of the language in English.

string getLanguage ()

Returns the current language used by the speech recognition system.

Returns

Current language used by the speech recognition engine.

Example in python :

#gets the current language of the speech recognition system and displays it
currentLanguage=asr.getLanguage()
print currentLanguage

vector<string> getAvailableLanguages ()

Returns the list of the languages installed on the system.

Returns

Array of strings that contains the list of the installed languages.

Example in python :

#gets the list of the available languages and displays it
availableLanguages=asr.getAvailableLanguages()
print availableLanguages

void setWordListAsVocabulary (const vector<string>& vocabulary)

Sets the list of words (vocabulary) that should be recognized by the speech recognition engine.

vocabulary

List of words that should be recognized

Example in python :

#Sets the words to recognize
wordList=["yes","no","hello Nao","goodbye Nao"]
asr.setWordListAsVocabulary(wordList)

void loadVocabulary (const string& vocabularyFile)

Loads the vocabulary to recognized contained in a .lxd file. This method is not available with the ASR engine language set to Chinese. For more informations see the red documentation

vocabularyFile

Name of the lxd file containing the vocabulary

void setParameter (const string& paramName, const float& paramValue)

Sets a parameter of the speech recognition engine. Note that when the ASR engine language is set to Chinese, no parameter can be set. The parameters that can be set and the corresponding values are: "EarUseSpeechDetector" - Values : 0 (No), 1 (Regular), or 2 (Cepstral) : type of speech detector used by the ASR engine - default value is 2. "EarSpeed" - Values : 0 to 3 - 0 is slowest and most accurate. 3 is the fastest but may add some recognition errors, especially if you talk fast because some parts of the audio data is not processed. - default value is 2. "EarUseFilter" : Values : 0 (no) or 1 (yes) - Applies a High-Pass filter on the input signal - default value is 0.

paramName

Name of the parameter.

paramValue

Value of the parameter.

Example in python :

#Sets the EarSpeed parameter to 3 
asr.setParameter("EarSpeed", 3.0)

float getParameter (const string& paramName)

Gets a parameter of the speech recognition engine. Note that when the ASR engine language is set to Chinese, no parameter can be retrieved

paramName

Name of the parameter.

Returns

Value of the parameter.

vector<string> getPhoneticTranscription (const string& word)

This function allows you to get the phonetic transcription(s) used by the speech recognition engine when it is asked to recognize a word. Note that when the ASR engine language is set to Chinese, no phonetic transcription can be retrieved.

word

Word to phoneticize.

Returns

Phonetic transcription(s) of the word


Methods inherited from ALModule

void exit ()

Exits and unregisters the module.

string version ()

Returns the version of the module.

Returns

A string containing the version of the module.

bool ping ()

Just a ping. Always returns true

Returns

returns true

vector<string> getMethodList ()

Retrieves the module's method list.

Returns

An array of method names.

AL::ALValue getMethodHelp (const string& methodName)

Retrieves a method's description.

methodName

The name of the method.

Returns

A structure containing the method's description.

AL::ALValue getModuleHelp ()

Retrieves the module's description.

Returns

A structure describing the module.

string getBrokerName ()

Gets the name of the parent broker.

Returns

The name of the parent broker.

string getUsage (const string& name)

Gets the method usage string. This summarise how to use the method.

name

The name of the method.

Returns

A string that summarises the usage of the method.


Methods inherited from ALExtractor

void subscribe (const string& name, const int& period, const float& precision)

Subscribes to the extractor. This causes the extractor to start writing information to memory using the keys described by getOutputNames(). These can be accessed in memory using ALMemory.getData("keyName"). In many cases you can avoid calling subscribe on the extractor by just calling ALMemory.subscribeToEvent() supplying a callback method. This will automatically subscribe to the extractor for you.

name

Name of the module which subscribes.

period

Refresh period (in milliseconds) if relevant.

precision

Precision of the extractor if relevant.

void subscribe (const string& name)

Subscribes to the extractor. This causes the extractor to start writing information to memory using the keys described by getOutputNames(). These can be accessed in memory using ALMemory.getData("keyName"). In many cases you can avoid calling subscribe on the extractor by just calling ALMemory.subscribeToEvent() supplying a callback method. This will automatically subscribe to the extractor for you.

name

Name of the module which subscribes.

void unsubscribe (const string& name)

Unsubscribes from the extractor.

name

Name of the module which had subscribed.

void updatePeriod (const string& name, const int& period)

Updates the period if relevant.

name

Name of the module which has subscribed.

period

Refresh period (in milliseconds).

void updatePrecision (const string& name, const float& precision)

Updates the precision if relevant.

name

Name of the module which has subscribed.

precision

Precision of the extractor.

int getCurrentPeriod ()

Gets the current period.

Returns

Refresh period (in milliseconds).

float getCurrentPrecision ()

Gets the current precision.

Returns

Precision of the extractor.

int getMyPeriod (const string& name)

Gets the period for a specific subscription.

name

Name of the module which has subscribed.

Returns

Refresh period (in milliseconds).

float getMyPrecision (const string& name)

Gets the precision for a specific subscription.

name

name of the module which has subscribed

Returns

precision of the extractor

AL::ALValue getSubscribersInfo ()

Gets the parameters given by the module.

Returns

Array of names and parameters of all subscribers.

vector<string> getOutputNames ()

Get the list of values updated in ALMemory.

Returns

Array of values updated by this extractor in ALMemory


Methods inherited from ALSoundExtractor

void setDebugMode (const bool& bSetOrUnset)

enable/disable the printing of some debug information

bSetOrUnset

enable the functionnality when true.


Copyright © 2010 Aldebaran Robotics - All rights reserved