The search module

The search module allows the user to perform various searches and to launch other applications.

The search module, like all other modules, provides an initialization callback function. After io-asr has loaded all modules, it invokes the initialization callback to set up the private data structures managed by the module.

The initialization callback loads the search-specific configuration tree to make it available to the module. This configuration data is assumed to be in the module/search path of the global configuration tree. The search module has two locale-specific configuration files that are used to customize its behavior:

When io-asr shuts down, it releases all modules that it has dynamically loaded. The search module provides the destroy() callback, which releases resources allocated during the initialization phase before the module is deleted from the ASR subsystem.


The search conversation module can:

In addition to these actions, the search module also provides a general help prompt that tells the user what voice commands are supported.

Conversation flow

The search module can handle a number of different states that update the result action (result_action_e). If a search command is successful, the result action is set to ASR_RECOGNITION_COMPLETE. If insufficient information was provided in the utterance, the result action is set to ASR_RECOGNITION_RESTART to reprompt the user. The search module's states are as follows:

ASR state transitions

The search module keeps track of the current ASR state. This state affects what actions are taken by the module when a callback function is invoked (the result handler in particular). To keep track of the current ASR step, the search module defines a step() callback function that io-asr invokes to inform the module of the current state in the speech-recognition process. This function takes the current step ID and a pointer to the module data as arguments.

The step() function handles the following transitions:

The step() function ignores all other state transitions.

Result handling

The on_result() callback function of the conversation module interface, asr_conversation_if, processes speech-to-text results that the select_result() callback function has determined are relevant to the current module. The on_result() function is responsible for handling the selected result according to the conversation flow, as described earlier in this section. If the speech-to-text result doesn't provide enough information to complete the action, the on_result() function forces a restart of the speech-recognition routine to obtain further information.


The search module provides two types of grammars that define its behaviour. One type of grammar affects how the intents of an utterance are extracted from a speech-to-text result. The other type is supplied to a third-party recognizer to build a context for performing the actual speech-to-text conversion.

The mapping from speech to search actions is defined by a grammar that is specified in a localized configuration file. This file is loaded by the ASR subsystem at execution time and parsed into a configuration tree. The subtree that is relevant to the search module is then copied to its private data structure.

The search module also provides localized BNF grammars that are used to compile recognizer contexts that control speech-to-text transformations. These grammars describe the key phrases that can be used to interact with the search module and that provide a list of applications that are present on the system. The default context grammars are defined in <recognizer>/en-US/search/car-search.bnf and <recognizer>/en-US/search/car-applications.bnf.