Skip to content

The ELG Translation API

Ulrich Germann edited this page Feb 7, 2020 · 2 revisions

The ELG Translation API Version 1.0

This is the API defined and used by the European Language Grid.

All requests have to be sent as JSON blobs via the POST method to the path /api/elg/v1.

Request format

Simple Requests (single string)

{
  "type":"text",
  "params": { "inputFormat": ... }, 
  "content": "The text to be translated, as a string inline",
  "mimeType":"text/plain",
  }
}

Note: Valid values for the inputFormat parameter are:

  • "sentence": one sentence per line; no sentence splitting is performed by the server
  • "paragraph": each line is a paragraph; sentences will be split but end-of-line counts as end-of-sentence
  • "wrappedText": paragraphs are separated by a blank line; end-of-line (except for blank lines) is replaced by whitespace, then paragraphs are split into sentences.

Currently, the return format is the same as the input format.

Structured Text Requests

These allow you to send multiple translation requests in one single HTTP request.

{
  "type":"structuredText",
  "params":{ "inputFormat": ... },
  "texts":[
    {
      "content":"The content, as a string inline", // either this
      "texts":[/* same structure, recursive */],   // or this
      "mimeType":"text/plain"
    }
  ]
}

Response format (when successful)

{
  "response":{
    "type":"texts",
    "texts":[
      {
        "content":"string of translated/transcribed text", // either
        "texts":[/* same structure, recursive */],         // or
      }
    ]
  }
}

Error responses:

{
  "failure":{
    "errors":[array of status messages]
  }
}

ELG status messages are described at the bottom of [this page](https://gitlab.com/european-language-grid/platform/elg-apis/-/blob/master/doc/T2.5-api-design.md)
Clone this wiki locally