Updated on 2023-04-14 GMT+08:00

Loading Custom Word Dictionaries

Function

This API is used to load a custom word dictionary stored in OBS.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v1.0/{project_id}/clusters/{cluster_id}/thesaurus

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name.

cluster_id

Yes

String

ID of the cluster where a custom word dictionary you want to configure.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

bucketName

Yes

String

OBS bucket where the word dictionary file is stored. (The bucket type must be Standard or Infrequent Access. Archive is not supported).

mainObject

No

String

Main word dictionary file object, which must be a text file encoded in UTF-8 without BOM. Each line contains a word. The maximum file size is 100 MB. At least one of the mainObject, stopObject, and synonymObject parameters must be configured.

Only one main word dictionary can be loaded at a time.

stopObject

No

String

Stop word dictionary file object, which must be a text file encoded in UTF-8 without BOM. Each line contains a word. The maximum file size is 20 MB.

At least one of the mainObject, stopObject, and synonymObject parameters must be configured.

synonymObject

No

String

Synonym word dictionary file, which must be a text file encoded in UTF-8 without BOM. Each line contains a group of words. The maximum file size is 20 MB.

At least one of the mainObject, stopObject, and synonymObject parameters must be configured.

Response Parameters

None

Example Requests

{
  "bucketName" : "test-bucket",
  "mainObject" : "word/main.txt",
  "stopObject" : "word/stop.txt",
  "synonymObject" : "word/synonym.txt"
}

Example Responses

None

Status Codes

Status Code

Description

200

Request succeeded.

403

Request rejected.The server has received and understood the request, but refused to respond to it. The client should modify the request before retry.

500

The server is able to receive the request but unable to understand the request.

Error Codes

See Error Codes.