単語登録 API
Create Hotwords Dictionary
Basic Information
Endpoint: /hotwords
Method: POST
API Description: Submit a list of hotwords to create a hotword dictionary. A total of 200 dictionaries can be created. Each hotword must not exceed 10 characters, and a single dictionary must not exceed 10,000 entries.
Request Parameters
Body (json)
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
| name | string | No | Name of the hotword dictionary | None |
| lang_type | string | Yes | Language code | Required |
| sample_rate | int | Yes | Sampling rate (Hz) | Required |
| words | list<string> | Yes | List of hotwords | Required |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | string | Hotword dictionary ID |
Request Example
Each element in the list is a hotword entry.
curl -X POST '127.0.0.1:7100/hotwords' \
-H 'Content-Type: application/json' \
-d '{
"name":"name",
"lang_type":"ja-JP",
"sample_rate":16000,
"words":["桃太朗","ドルフィンボイス"]
}'Response Example
{
"status": "00000",
"message": "success",
"data": "HW50D67839" // data is the Hotwords ID
}Delete Hotword Dictionary
Basic Information
Endpoint: /hotwords/{hotwords_id}
Method: DELETE
API Description: To delete the hotword dictionary with the specified ID. Only dictionaries that are not currently being used in Speech-to-Text requests can be deleted.
Request Example
curl -X DELETE '127.0.0.1:7100/hotwords/HW50D67839'Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | None |
Response Example
{
"status": "00000",
"message": "success",
"data": null
}Retrieve Hotword Dictionary Information List
Basic Information
Endpoint: /hotwords
Method: GET
API Description: Retrieve information about all hotwords dictionaries.
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object[] | Data |
| ├─ id | string | Hotword dictionary ID |
| ├─ name | string | name of the hotword dictionary |
| ├─ lang_type | string | Language code |
| ├─ status | int | Status: -1 for training failed, 0 for training in progress, 1 for training completed |
| ├─ sample_rate | int | Sampling rate |
| ├─ update_time | string | Last update time |
Request Example
curl -X GET '127.0.0.1:7100/hotwords'Response Example
{
"status": "00000",
"message": "success",
"data": [
{
"id": "HW50D67839",
"name": "name",
"lang_type": "ja-JP",
"status": 1,
"sample_rate": 16000,
"update_time": "2023-10-09 13:14:15"
}
]
}Retrieve Hotword Dictionary Information
Basic Information
Endpoint: /hotwords/{hotwords_id}
Method: GET
API Description: Retrieve information about the hotword dictionary with the specified ID.
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | object | Data |
| ├─ id | string | Hotword dictionary ID |
| ├─ name | string | name of the hotword dictionary |
| ├─ lang_type | string | Language code |
| ├─ status | int | Status: -1 for training failed, 0 for training in progress, 1 for training completed |
| ├─ sample_rate | int | Sampling rate |
| ├─ update_time | string | Last modification time |
| ├─ words | list<string> | List of hotwords |
| ├─ amount | int | Number of words contained |
Request Example
curl -X GET '127.0.0.1:7100/hotwords/HW50D67839'Response Example
{
"status": "00000",
"message": "success",
"data": {
"id": "HW50D67839",
"name": "name",
"lang_type": "ja-JP",
"status": 1,
"sample_rate": 16000,
"update_time": "2021-11-29 13:14:15",
"words": ["桃太朗","ドルフィンボイス"],
"amount": 2
}
}Update Hotword Dictionary Information
Basic Information
Endpoint: /hotwords/{hotwords_id}
Method: PUT
API Description: Update the name or hotword list of an existing hotword dictionary. Note: When modifying the hotword list, all hotwords in the dictionary will be replaced by the new list. To append hotwords, please use the Add Hotword Entries API.
Request Parameters
Body (json)
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
| name | string | No | Name of the hotword dictionary | None |
| words | list<string> | No | List of hotwords | None |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | string | Hotword dictionary ID |
Request Example
curl -X PUT '127.0.0.1:7100/hotwords/HW50D67839' \
-d '{
"name":"name",
"words":["桃太郎","ドルフィンボイス","ドルフィンエイアイ"]
}'In the above example, both the name of the dictionary and the hotword list were updated. If you only need to modify the dictionary name, there is no need to pass the words parameter; likewise, if you only want to update the hotword list, there is no need to pass the name parameter.
Response Example
{
"status": "00000",
"message": "success",
"data": "HW50D67839"
}Add Hotword Entries
Basic Information
Ednpoint: /hotwords/{hotwords_id}
Method: POST
API Description: Append hotword entries to an existing hotword dictionary. Each entry must not exceed 10 characters, and a single dictionary must not exceed 10,000 entries.
Request Parameters
Body (json)
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
| words | list<string> | Yes | List of hotwords | Required |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | int | Number of hotwords in the current dictionary |
Request Example
curl -X POST '127.0.0.1:7100/hotwords/HW50D67839' \
-H 'Content-Type: application/json' \
-d '{
"words":["豊臣秀吉","織田信長"]
}'Response Example
{
"status": "00000",
"message": "success",
"data": 6
}Delete Hotword Entries
Basic Information
Endpoint: /hotwords/{hotwords_id}
Method: DELETE
API Description: Delete specified hotword entries from the hotword dictionary with the given ID. Note: When the request does not contain a request body, the entire hotword dictionary will be deleted.
Request Parameters
Body (json)
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
| words | list<string> | Yes | List of hotwords to be deleted | Required |
Response Parameters
| Name | Type | Description |
|---|---|---|
| status | string | Status code |
| message | string | Status code description |
| data | int | Number of hotwords in the current dictionary |
Request Example
curl -X DELETE '127.0.0.1:7100/hotwords/HW50D67839' \
-H 'Content-Type: application/json' \
-d '{
"words":["豊臣秀吉","織田信長"]
}'Response Example
{
"status": "00000",
"message": "success",
"data": 4
}