Logo
Other APIs

Forced Correction API

Create Forced Correction Dictionary

Basic Information

Endpoint: /correction_words

Method: POST

API Description: Upload a forced correction list file to create a forced correction dictionary.

Forced Correction List File Format

A UTF-8 encoded text file with each line containing a forced correction word pair. The original word and the target word should be separated by a tab. Each line should not exceed 100 characters, with a maximum of 10,000 lines. A total of 200 forced correction dictionaries can be created.

File Example:

#Please separate the original and replacement forced correction words with a tab.
#元と目的の強制置換文字の間にはタブ(TAB)で区切ってください。
元の文字 目的の文字
グーグル Google
#Multiple forced correction words can be replaced with one, separated by "|". 
#複数の強制置換文字を1つに置換することができ、「|」で区切ります。
5時|後日|ご示威 5G
#If there are no characters after the tab, it means the replacement is empty.
#タブの後に文字がない場合は、置換が空であることを意味します。
強制削除	

Request Parameters

Body (form-data)

NameTypeRequiredDescriptionDefault Value
namestringNoName of the forced correction dictionaryNone
filefileYesForced correction list file (UTF-8 encoded TXT format)Required
lang_typestringYesLanguage codeRequired

Response Parameters

NameTypeDescription
statusstringStatus code
messagestringStatus code description
dataobjectData

Request Example

curl -X POST '127.0.0.1:7100/correction_words' \
-F 'name=人物' \
-F 'file=@name.txt' \
-F 'lang_type=ja-JP'

Response Example

{
    "status": "00000",
    "message": "success",
    "data": "CW43DA3B90" // data is the forced correction dictionary ID
}

Retrieve Forced Correction Dictionary List

Basic Information

Endpoint: /correction_words

Method: GET

API Description: Retrieve information for all forced correction dictionaries.

Response Parameters

NameTypeDescription
statusstringStatus code
messagestringStatus code description
dataobject[]Data
├─ idstringForced correction dictionary ID
├─ namestringForced correction dictionary name
├─ lang_typestringLanguage code
├─ amountintNumber of forced correction pairs
├─ update_timestringLast update time

Request Example

curl -X GET '127.0.0.1:7100/correction_words'

Response Example

{
    "status": "00000",
    "message": "success",
    "data": [
        {
            "id": "CW43DA3B90",
            "name": "人物",
            "lang_type": "ja-JP",
            "amount": 12,
            "update_time": "2022-01-19 13:14:15"
        }
    ]
}

Delete Forced Correction Dictionary

Basic Information

Endpoint: /correction_words/{correction_words_id}

Method: DELETE

API Description: Delete the forced correction dictionary with the specified ID.

Response Parameters

NameTypeDescription
statusstringStatus code
messagestringStatus code description
dataobjectData

Request Example

curl -X DELETE '127.0.0.1:7100/correction_words/CW43DA3B90'

Response Example

{
    "status": "00000",
    "message": "success",
    "data": null
}

Update Forced Correction Dictionary

Basic Information

Endpoint: /correction_words/{correction_words_id}

Method: PUT

API Description: Modify the name or list of forced correction words in the dictionary.

Request Parameters

Body (form-data)

NameTypeRequiredDescriptionDefault Value
namestringNoName of the forced correction dictionaryNone
filefileNoForced correction list fileNone

Response Parameters

NameTypeDescription
statusstringStatus code
messagestringStatus code description
dataobjectData

Request Example

  1. To modify the name of the forced correction dictionary.
curl -X PUT '127.0.0.1:7100/correction_words/CW43DA3B90' \
-F 'name=NewName'
  1. To modify the forced correction list file.
curl -X PUT '127.0.0.1:7100/correction_words/CW43DA3B90' \
-F 'file=@new.txt'

Response Example

{
    "status": "00000",
    "message": "success",
    "data": "CW43DA3B90"
}

Retrieve Forced Correction Dictionary Information

Basic Information

Endpoint: /correction_words/{correction_words_id}

Method: GET

API Description: Retrieve information for the specified forced correction dictionary ID.

Response Parameters

NameTypeDescription
statusstringStatus code
messagestringStatus code description
dataobjectData
├─ idstringForced correction dictionary ID
├─ namestringForced correction dictionary name
├─ lang_typestringLanguage code
├─ filestringBase64-encoded forced correction file (UTF-8 encoded TXT format)
├─ amountintNumber of forced correction pairs
├─ update_timestringLast update time

Response Example

curl -X GET '127.0.0.1:7100/correction_words/CW43DA3B90'

Response Example

{
    "status": "00000",
    "message": "success",
    "data": {
            "id": "CW43DA3B90",
            "name": "人物",
            "lang_type": "ja-JP",
            "file": "<Base64 encoded content>",
            "amount": 12,
            "update_time": "2021-11-29 13:14:15"
        }
}