API Add Memory Content
Quick Example
Adding a TMX file to an already existing memory
curl -X POST \
-H "Content-Type: multipart/form-data" \
-H "MMT-ApiKey: <your_api_key>" \
-F "tmx=@<absolute_path_to_your_tmx>" \
https://api.modernmt.eu/memories/5/content \
| python -mjson.tool
{
"data": {
"begin": 76692,
"dataChannel": 0,
"end": 76699,
"id": "00000000-0000-0000-0000-000000000004",
"memory": 5,
"progress": 0,
"size": 8
},
"status": 200
}
Adding a single contribution to an already existing memory
curl -X POST \
-H "MMT-ApiKey: <your_api_key" \
-d "source=en" \
-d "target=it" \
-d "sentence=Hello Mike!" \
-d "translation=Ciao Mike!" \
https://api.modernmt.eu/memories/5/content \
| python -mjson.tool
{
"data": {
"begin": 16,
"dataChannel": 1,
"end": 16,
"id": "80000001-0000-0000-0000-000000000010",
"memory": 0,
"progress": 0,
"size": 1
},
"status": 200
}
Description
This method appends parallel text to the content of a Memory.
It is possible to append either a single translation unit (source/translation pair), or an entire TMX file.
Adding more data to a Memory can improve the quality of the translation of ModernMT; appending post-edited segments for example is the best way to let MMT learn from corrections made by professional translators and be also able to adapt translation output to the translator’s taste.
To add a TMX to a Memory, the user must be linked to that Memory. To add a single contribution to a Memory, the user can be either linked or not linked to it (it must have a valid MMT-apiKey anyway).
Resource URL
https://api.modernmt.eu/memories/:id/content
Parameters
source oprional |
The source language of the content to add, in the form of a language tag. Mandatory if the content to add is a single contribution.
Example: en |
target optional |
The target language of the content to add, in the form of a language tag. Mandatory if the content to add is a single contribution.
Example: it |
</tr>
sentence optional |
The source part of a translation unit. Mandatory if the content to add is a single contribution.
Example: Hello Mike! |
translation optional |
The target part of a translation unit. Mandatory if the content to add is a single contribution.
Example: Ciao Mike! |
tmx optional |
This parameter represents a TMX file to import into a memory.
To import a tmx, the Content-Type: multipart/form-data` header must be specified.
|
compression optional |
If you are sending a compressed TMX file, you also need to specify the compression type.
NOTE: at the moment the only supported compression type is GZIP. Example: gzip |
Note: The Memory identifier must be specified in the URL. It can be:
- the id of the MMT Memory that this ServiceApi Memory refers to (example: 5);
- the MMT Memory Key (example: mk_f4932hg205vh7h20h05g72);
Response Fields
The response object is an ImportJob, for more details please have a look at the API Get Import Job documentation.