Overview
This topic describes how to manage hotwords using APIs. If Tongyi Tingwu's default speech-to-text service does not accurately recognize certain words in your business domain, you can use the hotword feature. You can add these words to a hotword vocabulary to improve recognition accuracy.
Usage notes
Currently, only Chinese and English hotwords are supported.
By default, each user can create a maximum of 10 hotword vocabularies.
Each vocabulary can contain up to 300 hotwords. Each hotword can be up to 10 characters long.
Hotwords must be UTF-8 encoded and cannot contain punctuation or special characters.
The weight for a hotword must be an integer from -6 to 5.
Numbers must be written out as words based on their pronunciation. For example, "58.9" must be written as "fifty-eight point nine".
A value greater than 0 increases the probability that the word will be recognized. A value less than 0 decreases the probability.
A value of -6 indicates that the system should avoid recognizing the word.
A value of 2 is a common setting.
If the effect is not significant, you can increase the weight. However, an excessively high weight might have a negative impact and cause other words to be recognized incorrectly.
Interaction flow

Prerequisites
Set AccessKey environment variables
Replace YOUR_ACCESS_KEY_ID and YOUR_ACCESS_KEY_SECRET in the following command with your AccessKey ID and AccessKey secret.
export ALIBABA_CLOUD_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID &&
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=YOUR_ACCESS_KEY_SECRETIntegration steps
The client submits a request to create a hotword vocabulary.
If the request is successful, the server-side returns the PhraseId of the created hotword vocabulary. This ID is used for subsequent speech recognition tasks.
If the call fails, the response message contains an error message and a RequestId. You can use this information to troubleshoot the call parameters. You can also submit a ticket with the response message for further investigation.
Use a hotword vocabulary
When you submit a request for an offline transcription of audio and video files or a real-time recording, you can pass the PhraseId of the created hotword vocabulary. Add the PhraseId to the Transcription parameter of the Tongyi Tingwu task to improve speech recognition accuracy.
Parameter name | Type | Required | Description |
Transcription.PhraseId | String | No | The ID of the hotword vocabulary. |
You can retrieve the detailed hotwords and their corresponding weights from a vocabulary based on its PhraseId.
You can update the information of a vocabulary based on its PhraseId. This includes the vocabulary name, description, hotwords, and their weights.
You can delete a vocabulary based on its PhraseId.
You can list all hotword vocabularies for a user based on the user's UID. The list includes the vocabulary PhraseId, name, and description.