.. _alspeechrecognition-api: ALSpeechRecognition API ======================= :ref:`Overview ` | API Namespace : **AL** .. code-block:: cpp #include Method list ----------- .. cpp:class:: ALSpeechRecognitionProxy * Methods: * :cpp:func:`ALSpeechRecognitionProxy::getAvailableLanguages` * :cpp:func:`ALSpeechRecognitionProxy::getLanguage` * :cpp:func:`ALSpeechRecognitionProxy::getParameter` * :cpp:func:`ALSpeechRecognitionProxy::getPhoneticTranscription` * :cpp:func:`ALSpeechRecognitionProxy::loadVocabulary` * :cpp:func:`ALSpeechRecognitionProxy::setAudioExpression` * :cpp:func:`ALSpeechRecognitionProxy::setLanguage` * :cpp:func:`ALSpeechRecognitionProxy::setParameter` * :cpp:func:`ALSpeechRecognitionProxy::setVisualExpression` * :cpp:func:`ALSpeechRecognitionProxy::setVocabulary` * :cpp:func:`ALSpeechRecognitionProxy::setWordListAsVocabulary` * :cpp:func:`ALSpeechRecognitionProxy::subscribe` * :cpp:func:`ALSpeechRecognitionProxy::unsubscribe` .. seealso:: * :ref:`Methods inherited from ALModule ` Methods ------- .. cpp:function:: std::vector ALSpeechRecognitionProxy::getAvailableLanguages() Returns the list of the languages currently installed on the system. Each language is given in english. :return: Languages installed .. cpp:function:: std::string ALSpeechRecognitionProxy::getLanguage() Returns the language (english name) currently used by the speech recognition system. :return: Current language used by the speech recognition engine .. cpp:function:: float ALSpeechRecognitionProxy::getParameter(const std::string& parameter) Gets a parameter of the speech recognition engine. Note that when the ASR engine language is set to Chinese, no parameter can be retrieved. :param parameter: Name of the parameter :return: Value of the parameter .. cpp:function:: std::vector ALSpeechRecognitionProxy::getPhoneticTranscription(const std::string& word) .. deprecated:: 1.12 This method is not available on NAO V4 (ATOM). 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 or Japanese, no phonetic transcription can be retrieved. :param word: Word to phoneticize :return: Phonetic transcription(s) of the word .. cpp:function:: void ALSpeechRecognitionProxy::loadVocabulary(const std::string& vocabulary) .. deprecated:: 1.12 This method is not available on NAO V4 (ATOM). Loads the vocabulary to recognize contained in a .lxd file (ACAPELA grammar file format). This method is not available with the ASR engine language set to Chinese or Japanese. :param vocabulary: Name of the .lxd file containing the vocabulary .. note:: On NAO V3 (GEODE), in Japanese and Chinese this method is inactive. .. cpp:function:: void ALSpeechRecognitionProxy::setAudioExpression(const bool& setOrNot) When set to True, a "bip" is played at the beginning of the recognition process, and another "bip" is played at the end of the process. This is a useful indication to let the user know when it is appropriate to speak. :param setOrNot: Enable (true) or disable it (false) .. cpp:function:: void ALSpeechRecognitionProxy::setLanguage(const std::string& language) Sets the language (english name) currently used by the speech recognition system. Each NAOqi restart will however reset that setting to the default language that can be set on NAO's web page. :param language: Language (english name) .. cpp:function:: void ALSpeechRecognitionProxy::setParameter(const std::string& parameter, const float& value) Sets parameters of the speech recognition engine. For now the only parameter that can be set is the sensitivity [0 - 1] of the voice activity detector used by the engine. :param parameter: Name of the parameter. :param value: Value of the parameter. .. note:: On NAO V3 (GEODE), the "sensitivity" parameter is not available. .. cpp:function:: void ALSpeechRecognitionProxy::setVisualExpression(const bool& setOrNot) Enables or disables the leds animations showing the state of the recognition engine during the recognition process. :param setOrNot: Enable (true) or disable it (false). .. cpp:function:: void ALSpeechRecognitionProxy::setVocabulary(const std::vector& vocabulary, const bool& enableWordSpotting) Sets the list of words/phrases (vocabulary) that should be recognized by the speech recognition engine. If word spotting is disabled (default), the engine expects to hear one of the specified words, nothing more, nothing less. If enabled, the specified words can be pronounced in the middle of a whole speech stream, the engine will try to spot them. :param vocabulary: List of words that should be recognized :param enableWordSpotting: Enable (true) or disable it (false) .. note:: On NAO V3 (GEODE) the following differences apply: - the "word spotting" option is inactive - In Japanese, only single words are recognized (and not phrases) .. cpp:function:: void ALSpeechRecognitionProxy::setWordListAsVocabulary(const std::vector& vocabulary) Sets the list of words/phrases (vocabulary) that should be recognized by the speech recognition engine. To enable "word spotting", please use :cpp:func:`ALSpeechRecognitionProxy::setVocabulary` instead. :param vocabulary: List of words that should be recognized .. cpp:function:: void ALSpeechRecognitionProxy::subscribe(const std::string& name) Subscribes to *ALSpeechRecognition*. This causes the module to start writing information to *ALMemory* in *"WordRecognized"*. This can be accessed in *ALMemory* using :cpp:func:`ALMemoryProxy::getData`. :param name: Name to identify the subscriber .. cpp:function:: void ALSpeechRecognitionProxy::unsubscribe(const std::string& name) Unsubscribes to *ALSpeechRecognition*. This causes the module to stop writing information to *ALMemory* in *"WordRecognized"*. :param name: Name to identify the subscriber (as used in :cpp:func:`ALSpeechRecognitionProxy::subscribe`).