Merge branch 'docs/update_docs' into 'master'

Docs/update docs

See merge request speech-recognition-framework/esp-sr!52
This commit is contained in:
Sun Xiang Yu 2023-08-18 14:02:57 +08:00
commit 4353eb20f2
7 changed files with 58 additions and 48 deletions

View File

@ -1,6 +1,6 @@
# ESP-SR Speech Recognition Framework # ESP-SR Speech Recognition Framework
[![Documentation Status](https://readthedocs.com/projects/espressif-esp-adf/badge/?version=latest)](https://docs.espressif.com/projects/esp-sr/en/latest/esp32s3/index.html) [![Documentation Status](./docs/_static/sr_doc_latest.svg)](https://docs.espressif.com/projects/esp-sr/en/latest/esp32s3/index.html)
[![Component Registry](https://components.espressif.com/components/espressif/esp-sr/badge.svg)](https://components.espressif.com/components/espressif/esp-sr) [![Component Registry](https://components.espressif.com/components/espressif/esp-sr/badge.svg)](https://components.espressif.com/components/espressif/esp-sr)
Espressif [ESP-SR](https://github.com/espressif/esp-sr) helps users build AI speech solutions based on ESP32 or ESP32-S3 chips. Espressif [ESP-SR](https://github.com/espressif/esp-sr) helps users build AI speech solutions based on ESP32 or ESP32-S3 chips.
@ -42,4 +42,4 @@ Our two-mic Audio Front-End (AFE) have been qualified as a “Software Audio Fro
**In order to achieve optimal performance:** **In order to achieve optimal performance:**
* Please refer to software design [esp-skainet](https://github.com/espressif/esp-skainet). * Please refer to software design [esp-skainet](https://github.com/espressif/esp-skainet).

2
docs/_static/sr_doc_latest.svg vendored Normal file
View File

@ -0,0 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="78" height="20" role="img" aria-label="docs: latest"><title>docs: latest</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="78" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="33" height="20" fill="#555"/><rect x="33" width="45" height="20" fill="#007ec6"/><rect width="78" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">docs</text><text x="175" y="140" transform="scale(.1)" fill="#fff" textLength="230">docs</text><text aria-hidden="true" x="545" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="350">latest</text><text x="545" y="140" transform="scale(.1)" fill="#fff" textLength="350">latest</text></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -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. 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. - 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(); 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. - 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); 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 Use MultiNet
------------ ------------

View File

@ -114,28 +114,6 @@ MultiNet5 定义方法:
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
指令还可以通过调用 API 修改,这种方法对于 MultiNet5 和 MultiNet6 都适用。 指令还可以通过调用 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_INVALID_STATE Fail
*/ */
esp_err_t esp_mn_commands_clear(void); 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 的使用 MultiNet 的使用
---------------- ----------------

View File

@ -267,6 +267,13 @@ void esp_mn_commands_print(void)
ESP_LOGI(TAG, "---------------------------------------------------------\n"); 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) void *_esp_mn_calloc_(int n, int size)
{ {
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM

View File

@ -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); 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);

View File

@ -173,6 +173,7 @@ TEST_CASE("multinet set commands", "[mn]")
} else { } else {
printf("Invalid language\n"); printf("Invalid language\n");
} }
print_active_speech_commands();
multinet->destroy(model_data); multinet->destroy(model_data);
esp_srmodel_deinit(models); esp_srmodel_deinit(models);