View on GitHub

ModernMT Enterprise Edition

Neural Adaptive Machine Translation for professional translators

← Back to Home

API Get Context Vector

Quick example

curl -X GET \
     -H "MMT-ApiKey: <your_api_key>" \
     "https://api.modernmt.eu/context-vector?source=en&targets=it&text=Hello" \
     | python -mjson.tool

{
    "status": 200,
    "data": {
        "source": "en",
        "vectors": {
            "it": "4:1,5:0.042476345"
        }
    }
}

Description

This method returns the Context Vector containing the best-matching domains and their scores for the provided content. The score is the cosine similarity between the given context, and that domain.

Resource URL

https://api.modernmt.eu/context-vector

Parameters

source The language tag of the source language

Example: en
targets The target languages, as a series of comma-separated language tags

Example: it,es
text
optional
The context text to be analyzed.

Example: Mr President
content
optional
This parameter can be used to upload and calculate the Context Vector of a large file. In order to do that, Content-Type: multipart/form-data` and X-HTTP-Method-Override: GET headers must be specified and a POST request must be used instead of GET.
compression
optional
While using the "content" parameter, if the content file is compressed you need to specify the compression type. So far only GZIP compression is supported.

Example: gzip
hints
optional
A list containing the Memories to force the use of in this translation.

Example: 1,4

Response Fields

source The source language
vectors An object containing, for each supported target language, the corresponding Context Vector

← Back to Home