Conversation modules

The conversation modules interpret the recognized speech result and take the appropriate action. There are many conversation modules; each handles a specific type of result. When a new intent result is available, io-asr passes it to all the conversation modules to provide a rating.

ASR selects the module that provides the highest rating and passes it the current result for processing. The module can optionally set itself as exclusive by calling the asrm_set_exclusive() function so that it will receive all future results in the current speech session (i.e., io-asr won't evaluate the ratings of other conversation modules). The module releases its exclusive status when ASR transitions to the ASR_STEP_SESSION_CLOSED state.

Each module has one or more configuration files that describe the grammar it uses to interpret the recognition result, and then maps the outcomes to specific actions (for example, play a named track, dial a contact phone number, and so on). The modules load these configuration files into memory as configuration trees (cfg_item_t).

The configuration files are found in the asr/conversation/locale/context directory. For example, the English configuration files for the search module are found in the asr/conversation/en-US/search directory.

All conversation modules must implement the select_result() callback function of the conversation module interface, asr_conversation_if. This callback evaluates the results obtained from the recognizer and selects the result that's most relevant. It assigns a score to the result, allowing io-asr to determine which module should be used to handle the result. This function requires three arguments:

If a relevant result is found, the function assigns it to the selected_result argument and then returns the module's confidence that the selected result is relevant. If a competing module matches a result with a higher confidence, io-asr selects that module rather than the current one.

If this function doesn't select a result, it returns a confidence score of zero.

It's possible that the command uttered by the user only approximately matches a known command. For this reason, ASR assigns a confidence score to each of the pending actions. This allows the module to request clarification from the user when the uncertainty of the command is too high (i.e., the confidence score is less than the confidence threshold). In this case, the module ignores the pending action and io-asr prompts the user to repeat their last command.

Instead of using the globally set confidence threshold to determine the relevance of a result, the conversation module may optionally use a per-module confidence threshold.

The conversation modules can output log information to the system logger at varying verbosity levels. The modules use the asrm_slog() function to output log information, allowing the verbosity to be set via the ASR configuration file. In addition, if you compile a module with the DEBUG preprocessor symbol defined, the logging information will include the filename, line number, and function name for all messages issued by the module.