Creating a Word Dictionary

Function

This API is used to create a Poisson word dictionary. The name of the Poisson word dictionary can be used in the following configuration items of Poisson Analyzer: poisson_synonyms_dict_paths, poisson_dict_paths, and poisson_stopword_dict_paths.

URI

POST /v1.0/{project_id}/clusters/{cluster_id}/poisson_words
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining the Project ID and Account ID.

cluster_id

Yes

String

ID of the cluster where custom word dictionaries are to be configured.

Request

Table 2 describes the request parameters.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

name

Yes

String

Name of the word dictionary. The name can be used as the value of any of the following configuration items of Poisson Analyzer: poisson_synonyms_dict_paths, poisson_dict_paths, and poisson_stopword_dict_paths.

wordType

Yes

String

Type of the word dictionary. Currently, the following three types are supported:

  • MainWord: Indicates the main word dictionary.
  • StopWord: Indicates the stop word dictionary.
  • SynonymWord: Indicates the synonym word dictionary.
  • You can put the parameter setting in the related configuration item based on value of this parameter.

words

Yes

Array of strings

Content of the word dictionary. A main word or stop word is considered as a string, while a group of synonyms is considered as a string.

strategy

No

String

Available options are create and append. The default value is create, indicating to add words to the existing word dictionary. Value append indicates to append words to the existing word dictionary.

Response

None

Examples

Example request

POST /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters/ea244205-d641-45d9-9dcb-ab2236bcd07e/poisson_words 
{
     "name":"main.txt",
     "wordType":"MainWord",
     "words":["Keyword-1","Keyword-2"],
     "strategy":"create"
}

Status Code

Table 3 describes the status code.

Table 3 Status code

Status Code

Code

Description

200

OK

The request is processed successfully.

400

BadRequest

Invalid request.

The client should not repeat the request without modifications.

500

InternalServerError

The server is able to receive the request but it could not understand the request.