mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
docs: Update multinet API docs
This commit is contained in:
parent
d138019b55
commit
0e2c76c190
@ -103,28 +103,6 @@ Customize Speech Commands Via API calls
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Alternatively, speech commands can be modified via API calls, this method works for both MultiNet5 and MultiNet6.
|
||||
|
||||
- Print active speech commands, this function will print out all speech commands that are active.
|
||||
|
||||
::
|
||||
|
||||
/**
|
||||
* @brief Update the speech commands of MultiNet
|
||||
*
|
||||
* @Warning: Must be used after [add/remove/modify/clear] function,
|
||||
* otherwise the language model of multinet can not be updated.
|
||||
*
|
||||
* @param multinet The multinet handle
|
||||
* @param model_data The model object to query
|
||||
*
|
||||
* @return
|
||||
* - NULL Success
|
||||
* - others The list of error phrase which can not be parsed by multinet.
|
||||
*/
|
||||
esp_mn_error_t *esp_mn_commands_update();
|
||||
|
||||
.. note::
|
||||
The modifications will not be applied, thus not printed out, until you call ``esp_mn_commands_update()``.
|
||||
|
||||
- Apply new changes, the add/remove/modify/clear actions will not take effect util this function is called.
|
||||
|
||||
::
|
||||
@ -141,6 +119,8 @@ Alternatively, speech commands can be modified via API calls, this method works
|
||||
*/
|
||||
esp_mn_error_t *esp_mn_commands_update();
|
||||
|
||||
.. note::
|
||||
The modifications will not be applied, thus not printed out, until you call ``esp_mn_commands_update()``.
|
||||
|
||||
- Add a new speech command, will return ``ESP_ERR_INVALID_STATE`` if the input string is not in the correct format.
|
||||
|
||||
@ -202,6 +182,24 @@ Alternatively, speech commands can be modified via API calls, this method works
|
||||
*/
|
||||
esp_err_t esp_mn_commands_clear(void);
|
||||
|
||||
- Print cached speech commands, this function will print out all cached speech commands. Cached speech commands will be applied after ``esp_mn_commands_update()`` is called.
|
||||
|
||||
::
|
||||
|
||||
/**
|
||||
* @brief Print all commands in linked list.
|
||||
*/
|
||||
void esp_mn_commands_print(void);
|
||||
|
||||
- Print active speech commands, this function will print out all active speech commands.
|
||||
|
||||
::
|
||||
|
||||
/**
|
||||
* @brief Print all commands in linked list.
|
||||
*/
|
||||
void print_active_speech_commands(void);
|
||||
|
||||
Use MultiNet
|
||||
------------
|
||||
|
||||
|
||||
@ -114,28 +114,6 @@ MultiNet5 定义方法:
|
||||
~~~~~~~~~~~~~~~~~
|
||||
指令还可以通过调用 API 修改,这种方法对于 MultiNet5 和 MultiNet6 都适用。
|
||||
|
||||
- 打印现有指令。
|
||||
|
||||
::
|
||||
|
||||
/**
|
||||
* @brief Update the speech commands of MultiNet
|
||||
*
|
||||
* @Warning: Must be used after [add/remove/modify/clear] function,
|
||||
* otherwise the language model of multinet can not be updated.
|
||||
*
|
||||
* @param multinet The multinet handle
|
||||
* @param model_data The model object to query
|
||||
*
|
||||
* @return
|
||||
* - NULL Success
|
||||
* - others The list of error phrase which can not be parsed by multinet.
|
||||
*/
|
||||
esp_mn_error_t *esp_mn_commands_update();
|
||||
|
||||
.. note::
|
||||
所有修改操作在调用 ``esp_mn_commands_update()`` 后才会被打印出来。
|
||||
|
||||
- 应用新的修改操作,所有添加、移除、修改及清空操作在调用后才会被应用。
|
||||
|
||||
::
|
||||
@ -212,6 +190,25 @@ MultiNet5 定义方法:
|
||||
* - ESP_ERR_INVALID_STATE Fail
|
||||
*/
|
||||
esp_err_t esp_mn_commands_clear(void);
|
||||
|
||||
|
||||
- 打印缓存的指令, 只有当调用 ``esp_mn_commands_update()`` 缓存指令才会被应用.
|
||||
|
||||
::
|
||||
|
||||
/**
|
||||
* @brief Print all commands in linked list.
|
||||
*/
|
||||
void esp_mn_commands_print(void);
|
||||
|
||||
- 打印当前已经被应用的指令.
|
||||
|
||||
::
|
||||
|
||||
/**
|
||||
* @brief Print all commands in linked list.
|
||||
*/
|
||||
void print_active_speech_commands(void);
|
||||
|
||||
MultiNet 的使用
|
||||
----------------
|
||||
|
||||
@ -267,6 +267,13 @@ void esp_mn_commands_print(void)
|
||||
ESP_LOGI(TAG, "---------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
void print_active_speech_commands(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "---------------------ACTIVE SPEECH COMMANDS---------------------");
|
||||
esp_mn_model_handle->print_active_speech_commands(esp_mn_model_data);
|
||||
ESP_LOGI(TAG, "---------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
void *_esp_mn_calloc_(int n, int size)
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
@ -163,6 +163,11 @@ esp_mn_node_t *esp_mn_node_alloc(esp_mn_phrase_t *phrase);
|
||||
void esp_mn_node_free(esp_mn_node_t *node);
|
||||
|
||||
/**
|
||||
* @brief Print phrase linked list.
|
||||
* @brief Print all commands in linked list.
|
||||
*/
|
||||
void esp_mn_commands_print(void);
|
||||
void esp_mn_commands_print(void);
|
||||
|
||||
/**
|
||||
* @brief Print all active commands.
|
||||
*/
|
||||
void print_active_speech_commands(void);
|
||||
@ -173,6 +173,7 @@ TEST_CASE("multinet set commands", "[mn]")
|
||||
} else {
|
||||
printf("Invalid language\n");
|
||||
}
|
||||
print_active_speech_commands();
|
||||
|
||||
multinet->destroy(model_data);
|
||||
esp_srmodel_deinit(models);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user