Manage custom vocabularies through HTTP APIs, including creating, listing, getting, updating, and deleting vocabularies.
User guide: Improve recognition accuracy.
Endpoint
- Singapore
- China (Beijing)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/customizationReplace {WorkspaceId} with your actual Workspace ID.Request headers
Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token. Use the format |
Content-Type | string | Yes | Media type of the request body. Set to |
Create a vocabulary
Request bodymodelstring(Required)The custom vocabulary model. Set to speech-biasing.inputobject(Required)The input parameters.
Properties action string(Required)The operation type. Set to create_vocabulary.target_model string(Required)The speech recognition model that uses this vocabulary. This value must match the model you specify when calling the speech recognition API.prefix string(Required)A custom prefix for the vocabulary. Only lowercase letters and digits are allowed, with a maximum length of 10 characters.vocabulary array[object](Required)The vocabulary entries array.
Properties text string(Required)The vocabulary entry text.The text language must be supported by the selected model. Supported languages vary by model.Use actual words rather than arbitrary character combinations to improve recognition accuracy.Maximum length: 15 characters for text that includes non-ASCII characters, or 7 space-separated words for ASCII-only text.weight integer(Required)The vocabulary entry weight. Recommended value: 4.Valid values: 1 to 5.If recognition accuracy doesn't improve, increase the weight. An excessively high weight may reduce the recognition accuracy of other words.lang string(Optional)The language code of the audio to be recognized. When set, the system improves recognition of vocabulary entries in the specified language. If you can't determine the language in advance, leave this parameter unset. The model detects the language automatically.Valid values (vary by model):
| The following URL is for the Singapore region. Replace WorkspaceId with your actual workspace ID. The URLs vary by region.The API keys for the Singapore region and the Beijing region are different. For more information, see Obtain an API key. |
Response bodyrequest_idstringThe unique identifier of this request.outputobjectThe response data.
Properties vocabulary_id stringThe ID of the created vocabulary.objectThe usage information of this request.
Properties count integerThe number of vocabularies created. Always 1. |
List vocabularies
Request bodymodelstring(Required)The custom vocabulary model. Set to speech-biasing.inputobject(Required)The input parameters.
Properties action string(Required)The operation type. Set to list_vocabulary.prefix string(Optional)The custom prefix of the vocabulary. When specified, only vocabularies with this prefix are returned.page_index integerThe page number, starting from 0.Default value: 0.page_size integerThe number of entries per page.Default value: 10. | The following URL is for the Singapore region. Replace WorkspaceId with your actual workspace ID. The URLs vary by region.The API keys for the Singapore region and the Beijing region are different. For more information, see Obtain an API key. |
Response bodyrequest_idstringThe unique identifier of this request.outputobjectThe response data.
Properties vocabulary_list array[object]The queried vocabularies.
Properties vocabulary_id stringThe vocabulary ID.gmt_createstringThe creation time.gmt_modifiedstringThe last modification time.statusstringThe status:
objectThe usage information of this request.
Properties count integerAlways 1. |
Get a vocabulary
Request bodymodelstring(Required)The custom vocabulary model. Set to speech-biasing.inputobject(Required)The input parameters.
Properties action string(Required)The operation type. Set to query_vocabulary.vocabulary_id string(Required)The ID of the vocabulary to get. | The following URL is for the Singapore region. Replace WorkspaceId with your actual workspace ID. The URLs vary by region.The API keys for the Singapore region and the Beijing region are different. For more information, see Obtain an API key. |
Response bodyrequest_idstringThe unique identifier of this request.outputobjectThe response data.
Properties gmt_create stringThe creation time.gmt_modifiedstringThe last modification time.statusstringThe status:
stringThe speech recognition model that uses this vocabulary. This value must match the model you specify when calling the speech recognition API.vocabularyarray[object]The queried vocabulary.
Properties text stringThe vocabulary entry text.weight integerThe vocabulary entry weight.lang stringThe language of the audio to be recognized.objectThe usage information of this request.
Properties count integerAlways 1. |
Update a vocabulary
Request bodymodelstring(Required)The custom vocabulary model. Set to speech-biasing.inputobject(Required)The input parameters.
Properties action string(Required)The operation type. Set to update_vocabulary.vocabulary_id string(Required)The ID of the vocabulary to update.vocabulary array[object](Required)The new vocabulary. This completely replaces the existing entries.
Properties text string(Required)The vocabulary entry text.The text language must be supported by the selected model. Supported languages vary by model.Use actual words rather than arbitrary character combinations to improve recognition accuracy.Maximum length: 15 characters for text that includes non-ASCII characters, or 7 space-separated words for ASCII-only text.weight integer(Required)The vocabulary entry weight. Recommended value: 4.Valid values: 1 to 5.If recognition accuracy doesn't improve, increase the weight. An excessively high weight may reduce the recognition accuracy of other words.lang string(Optional)The language code of the audio to be recognized. When set, the system improves recognition of vocabulary entries in the specified language. If you can't determine the language in advance, leave this parameter unset. The model detects the language automatically.Valid values (vary by model):
| The following URL is for the Singapore region. Replace WorkspaceId with your actual workspace ID. The URLs vary by region.The API keys for the Singapore region and the Beijing region are different. For more information, see Obtain an API key. |
Response bodyrequest_idstringThe unique identifier of this request.outputobjectThe response data. Always empty.usageobjectThe usage information of this request.
Properties count integerThe number of vocabularies updated. Always 1. |
Delete a vocabulary
Request bodymodelstring(Required)The custom vocabulary model. Set to speech-biasing.inputobject(Required)The input parameters.
Properties action string(Required)The operation type. Set to delete_vocabulary.vocabulary_id string(Required)The ID of the vocabulary to delete. | The following URL is for the Singapore region. Replace WorkspaceId with your actual workspace ID. The URLs vary by region.The API keys for the Singapore region and the Beijing region are different. For more information, see Obtain an API key. |
Response bodyrequest_idstringThe unique identifier of this request.outputobjectThe response data. Always empty.usageobjectThe usage information of this request.
Properties count integerThe number of vocabularies deleted. Always 1. |