Command Word Information Management Module (Command_Info)¶
1. Overview¶
Used to read information related to command words. That is to access the information stored in the resource file “[60000]{xxx}xxx.xls”.
2. Instructions for use¶
2.1. Module initialization¶
uint32_t cmd_info_init(
uint32_t cmd_file_addr_in_flash,
uint32_t voice_patition_addr,
uint8_t model_group_id);
This interface initialization must be called before calling all other interfaces of this module. You can refer to the SDK sample project.
2.2. Find command words¶
Here are three ways to find command words:
- Find by string:
cmd_handle_t cmd_info_find_command_by_string(const char * cmd_string);
- Search by command word ID:
cmd_handle_t cmd_info_find_command_by_id(uint16_t cmd_id);
- Search by command word semantic ID:
cmd_handle_t cmd_info_find_command_by_semantic_id(uint32_t semantic_id);
The above three interfaces return the handle pointing to the found command word, which is used for other interfaces of this module to obtain information related to the command word.
2.3. Obtain command word information¶
- Get the command word string:
char * cmd_info_get_command_string(cmd_handle_t cmd_handle);
- Get command word ID:
uint16_t cmd_info_get_command_id(cmd_handle_t cmd_handle);
- Get the command word semantic ID:
uint32_t cmd_info_get_semantic_id(cmd_handle_t cmd_handle);
- Get the command word minimum recognition confidence:
uint8_t cmd_info_get_cmd_score(cmd_handle_t cmd_handle);
This interface is generally called by the speech recognition module, and generally not used by users.
important note Confidence: It can be used to adjust the recognition sensitivity of command words. The smaller the value, the easier it is to be recognized, but the easier it is to be misrecognized.
- Query whether the command word is a special word:
uint32_t cmd_info_is_special_word(cmd_handle_t cmd_handle);
Special words are mainly used when some short command words are substrings of other long command words, which will affect the recognition effect of long command words. For example, there are two command words: “heating” and “heating for two minutes”. When the user says “heating for two minutes”, it will definitely recognize the previous “heating” first, causing misidentification. To solve this problem, we can set “heating” as a special word and set a waiting time. After the voice module recognizes “heating”, it will not output the result immediately, but wait for the set time. If longer command words are recognized during the waiting time, the previous special words are ignored. Only when no other command words are recognized beyond the set waiting time, the special word is output as a valid result.
- Query the waiting time of special words:
int32_t cmd_info_get_special_wait_count(cmd_handle_t cmd_handle);
- Query whether the command word is a wake-up word:
uint32_t cmd_info_is_wakeup_word(cmd_handle_t cmd_handle);
- Query whether the command word is a compound word:
uint32_t cmd_info_is_combo_word(cmd_handle_t cmd_handle);
The function of the combined word is that it can be spoken in conjunction with the wake-up word, and the user can say the wake-up word and the command word at one time, reducing waiting. For example, the interactive process of turning on the air conditioner of the smart housekeeper is as follows:
User: intelligent butler
Voice module: I am
User: turn on the air conditioner
Voice module: OK, turn on the air conditioner
If “turn on the air conditioner” is set as a compound word, the interaction process can be:
User: intelligent butler,turn on the air conditioner
Voice module: OK, turn on the air conditioner
notice: The current SDK has not yet implemented this function.
- Query the selection type of the prompt sound associated with the command word:
voice_select_type_t get_voice_select_type(cmd_handle_t cmd_handle);
Only useful for command words that have multiple selection beeps associated with them. There are only two possibilities for the result: “random selection” and “user selection”.
2.4. Multi model group switching¶
The CI130X SDK adds the concept of model grouping. A grouping can be an application scenario or a recognition mode, corresponding to a set of voice resources (acoustic model, language model, command vocabulary, prompt tone), which is a worksheet in the command word information file [60000] {xxx} xxx. xls. For example, in the two scenarios “English recognition” and “Chinese recognition”, the resources required for Chinese and English are different, so when switching scenarios, the response resources should be switched.
The switching interface is:
uint32_t cmd_info_change_cur_model_group(uint8_t model_group_id);