View on GitHub

ModernMT Enterprise Edition

Neural Adaptive Machine Translation for professional translators

← Back to Home

API Translate

Quick Example

curl -X GET \
   -H 'MMT-ApiKey: <your_api_key>' \
  'https://api.modernmt.eu/translate?source=en&target=it&q=Hello=&context=Mr%20President' \
   | python -mjson.tool

{
    "data": {
        "contextVector": {
            "entries": [
                {"memory": {"id": 1, "name": "europarl"}, "score": 0.20658109},
                {"memory": {"id": 2, "name": "ibm"}, "score": 0.0017772929}
            ]
        },
        "translation": "Ciao"
    },
    "status": 200
}

Description

This method returns the translation of the provided text. The text is XML encoded and can contain XML Tags. Since one ModernMT Engine may supports multiple language pairs and directions, you need to specify the source and target languages.

Resource URL

https://api.modernmt.eu/translate

Parameters

source The language tag of the source language.

Example: en
target The language tag of the target language.

Example: it
q
The text to translate in XML format (XML tags accepted, text must be XML-encoded).

Example: This is an example
context_vector
optional
The context vector to use in the translation, as a series of comma-separated key-value pairs `id1:score1,id2:score2,...`.

Example: Example: 1:0.34,3:0.045
hints
optional
A list containing the Memories to use for this translation.

Example: 10
type
optional
The type of translation request. It can be either interactive or batch. Default value is interactive.

Result

translation The translation of the input sentence.
contextVector The Context Vector object calculated by analyzing the context text provided. For more details on the object format, please have a look at <a href=/apis/api-get-context-vector.md>API Get Context Vector.

← Back to Home