Updated on 2025-08-26 GMT+08:00

Creating a Hot Word Table

In Short Sentence Recognition and RASR services, if there are unique terms in your business domain with suboptimal default recognition performance, consider using hot word management to add these terms to the vocabulary table to enhance recognition accuracy.

Hot words can include names, company names, or domain-specific proper nouns such as HUAWEI CLOUD. It is advisable that hot words should not be excessively lengthy nor contain punctuation marks or special symbols. For constraints, see Creating a Hot Word Table.

Function

This API is used to create a hot word table. Upon successful creation, an ID will be returned. Each user is limited to creating up to 100 hot word tables.

When calling hot words, ensure that the region from which they are called matches the region where they were created. As illustrated below, you can check the region associated with the creation of hot words:
Figure 1 Check the region where hot words are created

Notes and Constraints

  • All hot words that contain English letters must be capitalized, for example: Eiffel Tower (correct example: EIFFEL TOWER).
  • All numbers should be represented by their corresponding spoken words, avoiding the use of Arabic numerals, such as Huawei Mate 50 (correct example: HUAWEI MATE FIFTY).
  • Hot word content must consist only of English and Chinese characters. Do not use punctuation marks, spaces, or the following special characters: ,?.*
  • Do not use monosyllabic English words, for example, MAY and TEE, to prevent incorrect recalls.
  • When using hot word tables, the same project ID can share a hot word table, while different project IDs cannot share a hot word table.

URI

POST /v1/{project_id}/asr/vocabularies

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It is used to obtain the permission to call APIs. For details about how to obtain a user token, see Authentication. The token is the value of X-Subject-Token in the response header.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Hot word table name, which must be unique. The name can contain a maximum of 32 characters. Only letters, digits, underscores (_), hyphens (-), and pounds (#) are allowed.

description

No

String

Description of the hot word table. The value can contain a maximum of 255 characters.

language

Yes

String

Language type of the hot word table.

Value: chinese_mandarin, indicating Mandarin Chinese.

contents

Yes

Array of strings

Chinese-English hybrid hot words are supported. A hot word can contain only English letters and Chinese characters encoded in Unicode mode. Other symbols, including spaces, are not allowed.

Arabic numerals are written in English (such as one).

A single hot word table supports up to 10,000 hot words.

A single hot word can contain a maximum of 32 characters in Chinese and 64 characters in English.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Mandatory

Type

Description

vocabulary_id

Yes

String

If the API is successfully called, the hot word table ID is returned. If it fails, this field is not included.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code when the API call fails. This parameter is not returned for a successful call.

error_msg

String

Error message when the API call fails. This parameter is not returned for a successful call.

Example Requests

The endpoint is the request URL for calling an API. Endpoints vary according to services and regions. For details, see Endpoints.

Create a hot word table.
POST https://{endpoint}/v1/{project_id}/asr/vocabularies

Request header:
Content-Type: application/json
X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...   

Request body:
{ 
  "name": "telepower",
  "description": "telepower descriptiondescription",
  "language": "chinese_mandarin", 
  "contents": ["example"]
} 

Example Responses

Status code: 200

Example response for a successful request

{ 
  "vocabulary_id": "CFD08A32-6176-4ad7-92F9-11ED015C8109", 
}

Status code: 400

Example response for a failed request

{ 
    "error_code":"SIS.0201", 
    "error_msg":"***" 
}

Status Codes

See Status Codes.

Error Codes

See Error Codes.