Adaptation Management
This set of API calls are used to upload data used for manual and auto adaptations.
Create Adapted Language Pair
This call starts a new language pair adaptation process using the uploaded data.
Note
In order to use this feature language pair adaptation needs to be enabled on your account.
Note
In order to initiate an adaptation, an adaptable language pair should be used. In order to check if a language pair has manual adaptation enabled please use the Get all active language pairs from all active subscriptions API.
Linux
curl -XPOST \
-H "Content-Type:multipart/form-data" \
-H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" \
-H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" \
-F "baselineLpName="engfra_generic" \
-F "modelName=TstEngFra" \
-F "displayName=Test"^ \
-F "comments=some comment" \
-F "adaptationMode=GENERIC"^ \
-F "adaptationData=@training.tmx" \
-F "testData=@test.zip"
'https://api.languageweaver.com/v4/accounts/2/adapted-language-pairs'
Windows
curl -XPOST^
-H "Content-Type:multipart/form-data"^
-H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI"^
-H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555"^
-F "baselineLpName="engfra_generic"^
-F "modelName=TstEngFra"^
-F "displayName=Test"^
-F "comments=some comment"^
-F "adaptationMode=GENERIC"^
-F "adaptationData=@\"training.tmx\""^
-F "testData=@\"test.zip\""^
https://api.languageweaver.com/v4/accounts/2/adapted-language-pairs
Access token type
User credentials - Allowed User Roles: Admin
HTTP Request
POST /v4/accounts/{accountId}/adapted-language-pairs
Headers
| Name | Value (example) | Description |
|---|---|---|
| Authorization | Bearer asd0eXAi... | Bearer token |
| Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | Optional unique request identifier (UUID) provided by client |
Request Body:
(Request Body)
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="adaptationData"; filename="training.tmx"
Content-Type: multipart/form-data
Content-Length: 11
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="testData"; filename="test.zip"
Content-Type: multipart/form-data
Content-Length: 11
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="baselineLpName"
Content-Type: text/plain;charset=UTF-8
Content-Length: 3
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="modelName"
Content-Type: text/plain;charset=UTF-8
Content-Length: 7
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="displayName"
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="comments"
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="adaptationMode"
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj--
Request Parameters
Format
multipart/form-data
| Name | Type | Mandatory | Default value | Description |
|---|---|---|---|---|
baselineLpName |
string | yes | Language pair being adapted in the format srctgt_model | |
modelName |
string | yes | Alphanumeric and unique name of adapted language pair. (between 1 and 8 characters) | |
displayName |
string | yes | Display name of the language pair | |
comments |
string | no | Optional comments to add to the adapted language pair | |
adaptationMode |
string | no | GENERIC | String representing the adaptation mode. Supported values: "GENERIC", "BALANCED and "DOMAIN_SPECIFIC". |
adaptationData |
file | yes | A single TMX document, a zip or a gz archive containing multiple TMX documents to use during adaptation. The size of the input file must be less than 3 GB | |
testData |
file | no | A single TMX document, a zip or a gz archive which will be used when testing the baseline and the adapted language pair in order to measure the BLEU scores. |
Response JSON:
{
"adaptationId": "7c65206d-7354-4c82-9d19-ea06f61c2e57",
"baselineLpName": "engfra_generic",
"lpName": "EngFra_Adapted-TstEngFra",
"displayName": "TestEngFra",
"adaptationMode": "GENERIC"
}
Response
Headers
| Name | Value (example) | Description |
|---|---|---|
| BeGlobal-Request-ID | dbbbc062-88a7-4783-8d52-dea795e517f4 | Unique request identifier (UUID) |
| Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | The identifier provided in the request (UUID) |
Format
JSON
| Name | Type | Description |
|---|---|---|
adaptationId |
string | A unique identifier for the created adaptation |
baselineLpName |
string | The language pair identifier for which the adaptation was created |
lpName |
string | Unique identifier for the adapted language pair |
displayName |
string | Display name of the language pair |
adaptationMode |
string | String representing the adaptation mode. Supported values: "GENERIC", "BALANCED and "DOMAIN_SPECIFIC". |
{
"errors": [
{
"code": 61,
"description": "name parameter size must be between 1 and 8"
}
]
}
Error Response
Format
JSON
| Name | Type | Description |
|---|---|---|
errors |
list | A list with the errors that occurred |
code |
integer | The code of the error |
description |
string | The description of the error |
Returned HTTP Codes:
| Http Code | Description |
|---|---|
| 202 | The language pair adaptation was successfully submitted and accepted |
| 400 | The input data is not valid |
| 401 | When the authentication process failed or the access token is not valid |
| 403 | Forbidden to access resource |
| 500 | Application internal error |
Add TMX data for Auto Adaptation
This call is used to upload a tmx file, a zip or a gz archive containing multiple tmx files which will be used for auto adaptation.
Note
In order to use this feature auto adaptation needs to be enabled on your account.
Note
The data should be uploaded for an auto adaptive language pair. In order to check if a language pair is adaptive please use the Get all active language pairs from all active subscriptions API.
Linux
curl -XPOST \
-H "Content-Type:multipart/form-data" \
-H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" \
-H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" \
-F "lpName="engfra_generic" \
-F "adaptationData=@\"./adaptation-data.zip\" \
'https://api.languageweaver.com/v4/accounts/2/adaptation-data'
Windows
curl -XPOST^
-H "Content-Type:multipart/form-data"^
-H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI"^
-H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555"^
-F "lpName="engfra_generic"^
-F "adaptationData=@\"adaptation-data.zip\""^
https://api.languageweaver.com/v4/accounts/2/adaptation-data
Access token type
User credentials - Allowed User Roles: Admin
API credentials
HTTP Request
POST /v4/accounts/{accountId}/adaptation-data
Headers
| Name | Value (example) | Description |
|---|---|---|
| Authorization | Bearer asd0eXAi... | Bearer token |
| Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | Optional unique request identifier (UUID) provided by client |
Request Body:
(Request Body)
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="adaptationData"; filename="adaptation-data.zip"
Content-Type: multipart/form-data
Content-Length: 11
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="lpName"
Content-Type: text/plain;charset=UTF-8
Content-Length: 3
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj--
Request Parameters
Format
multipart/form-data
| Name | Type | Mandatory | Default value | Description |
|---|---|---|---|---|
lpName |
string | yes | Language pair being adapted in the format srctgt_model | |
adaptationData |
file | yes | A single TMX document, a zip or a gz archive containing multiple TMX documents to use during adaptation. The size of the input file must be less than 3 GB |
Response JSON:
{
"accountId": 2,
"savedFiles": [
{
"id": "9ac0391d-dbad-481f-9fc9-2b69415b1731",
"fileName": "adaptation-data.tmx",
"lpName": "engfra_generic",
"sizeBytes": 1234567,
"segmentCount": 5,
"status": "DONE",
"statusMessageCode": 0,
"statusMessage": "Accepted",
"createdByAccountId": 2,
"createdByUserId": 2,
"createdByUserEmail": "joe.doe@email.com",
"creationDate": "2021/10/28",
"lastModifiedByAccountId": 2,
"lastModifiedByUserId": 2,
"lastModifiedByUserEmail": "joe.doe@email.com",
"lastModifyDate": "2021/10/28"
}
],
"totalCount": 1
}
Response
Headers
| Name | Value (example) | Description |
|---|---|---|
| BeGlobal-Request-ID | dbbbc062-88a7-4783-8d52-dea795e517f4 | Unique request identifier (UUID) |
| Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | The identifier provided in the request (UUID) |
Format
JSON
| Name | Type | Description |
|---|---|---|
accountId |
integer | The id of the account where the file was uploaded |
totalCount |
integer | The total number of uploaded files |
savedFiles |
list | A list containing details about each uploaded file |
id |
string | A unique identifier for the uploaded file |
fileName |
string | The filename of the uploaded file |
lpName |
string | The language pair for which the file was uploaded |
sizeBytes |
long | The total size of the file in bytes |
segmentCount |
long | The number of segments in the file |
status |
string | The processing status of the file |
statusMessageCode |
integer | The status code of the adaptation file |
statusMessage |
string | The status message of the adaptation file |
createdByAccountId |
integer | The id of the account which created the adaptation data |
createdByUserId |
integer | The id of the user who created the adaptation data |
createdByUserEmail |
string | The email of the user who created the adaptation data |
createdByClientId |
string | The client id which created the adaptation data |
creationDate |
string | Creation date of the adaptation data |
lastModifiedByAccountId |
integer | The id of the account which last modified the adaptation data |
lastModifiedByUserId |
integer | The id of the user who last modified the adaptation data |
lastModifiedByUserEmail |
string | The email of the user who last modified the adaptation data |
lastModifiedByClientId |
string | The client id which last modified the adaptation data |
lastModifyDate |
string | The date when the adaptation data was last modified |
{
"errors": [
{
"code": 1093,
"description": "adaptationData parameter invalid. Only TMX, zip or gz archives allowed"
}
]
}
Error Response
Format
JSON
| Name | Type | Description |
|---|---|---|
errors |
list | A list with the errors that occurred |
code |
integer | The code of the error |
description |
string | The description of the error |
Returned HTTP Codes:
| Http Code | Description |
|---|---|
| 202 | When the file upload is successfully |
| 400 | When the input data is not valid |
| 401 | When the authentication process failed or the access token is not valid |
| 403 | Forbidden to access resource |
| 500 | Application internal error |