LINDAT Machine Translation API

Public REST API for neural machine translation operated by the Institute of Formal and Applied Linguistics (UFAL) at Charles University as part of the LINDAT/CLARIAH-CZ research infrastructure.

OpenAPI Specification

charles-lindat-translation.yaml Raw ↑
openapi: 3.0.3
info:
  title: LINDAT Translation API
  version: "2.0"
  description: >-
    Public REST API for neural machine translation operated by the Institute of
    Formal and Applied Linguistics (UFAL) at Charles University as part of the
    LINDAT/CLARIAH-CZ research infrastructure. Converted faithfully from the
    upstream Swagger 2.0 specification at
    https://lindat.mff.cuni.cz/services/translation/api/v2/swagger.json
servers:
  - url: https://lindat.mff.cuni.cz/services/translation/api/v2
tags:
  - name: root
    description: Root resource for navigation to languages/models
  - name: languages
    description: Operations with source and target languages
  - name: models
    description: Operations related to translation models
paths:
  /:
    get:
      operationId: get_root_resource
      tags: [root]
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RootResource"
  /languages/:
    get:
      operationId: get_language_collection
      summary: Returns a list of available languages
      tags: [languages]
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LanguagesResource"
    post:
      operationId: post_language_collection
      summary: Translate input from src lang to tgt lang
      description: >-
        It expects the text in variable called `input_text` and handles both
        "application/x-www-form-urlencoded" and "multipart/form-data" (for
        uploading text/plain files)
      tags: [languages]
      parameters:
        - name: src
          in: query
          description: src query param description
          schema:
            type: string
          example: en
        - name: tgt
          in: query
          description: tgt query param description
          schema:
            type: string
          example: cs
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                input_text:
                  type: string
                  description: text to translate
                  example: this is a sample text
          multipart/form-data:
            schema:
              type: object
              properties:
                input_text:
                  type: string
                  description: text to translate
                  example: this is a sample text
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: string
            text/plain:
              schema:
                type: string
        "415":
          description: You sent a file but it was not text/plain
  /languages/{language}:
    get:
      operationId: get_language_item
      summary: Returns a language resource object
      tags: [languages]
      parameters:
        - name: language
          in: path
          required: true
          description: Language code
          schema:
            type: string
          example: en
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LanguageResource"
  /models/:
    get:
      operationId: get_model_collection
      summary: Returns a list of available models
      tags: [models]
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ModelsResource"
  /models/{model}:
    parameters:
      - name: model
        in: path
        required: true
        description: model name
        schema:
          type: string
        example: en-cs
    get:
      operationId: get_model_item
      summary: Get model's details
      tags: [models]
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ModelResource"
    post:
      operationId: post_model_item
      summary: Send text to be processed by the selected model
      description: >-
        It expects the text in variable called `input_text` and handles both
        "application/x-www-form-urlencoded" and "multipart/form-data" (for
        uploading text/plain files). If you don't provide src or tgt some will
        be chosen for you!
      tags: [models]
      parameters:
        - name: src
          in: query
          description: src query param description
          schema:
            type: string
          example: en
        - name: tgt
          in: query
          description: tgt query param description
          schema:
            type: string
          example: cs
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                input_text:
                  type: string
                  description: text to translate
                  example: this is a sample text
          multipart/form-data:
            schema:
              type: object
              properties:
                input_text:
                  type: string
                  description: text to translate
                  example: this is a sample text
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: string
            text/plain:
              schema:
                type: string
        "415":
          description: You sent a file but it was not text/plain
components:
  schemas:
    Link:
      type: object
      properties:
        href:
          type: string
        name:
          type: string
        title:
          type: string
        type:
          type: string
        deprecation:
          type: string
        profile:
          type: string
        templated:
          type: boolean
        hreflang:
          type: string
    Links:
      type: object
      properties:
        self:
          $ref: "#/components/schemas/Link"
        models:
          $ref: "#/components/schemas/Link"
        languages:
          $ref: "#/components/schemas/Link"
    RootResource:
      type: object
      properties:
        _links:
          $ref: "#/components/schemas/Links"
    ModelLinks:
      type: object
      properties:
        item:
          type: array
          items:
            $ref: "#/components/schemas/Link"
        self:
          $ref: "#/components/schemas/Link"
    ModelResourceLinks:
      type: object
      properties:
        self:
          $ref: "#/components/schemas/Link"
        translate:
          $ref: "#/components/schemas/Link"
    ModelResource:
      type: object
      required: [model, supports]
      properties:
        _links:
          $ref: "#/components/schemas/ModelResourceLinks"
        default:
          type: boolean
          example: true
        domain:
          type: string
          example: Domain name is usually empty
        model:
          type: string
          example: en-cs
        supports:
          type: object
          example:
            en: [cs]
        title:
          type: string
          example: en-cs (English->Czech (CUBBITT))
    EmbeddedModels:
      type: object
      properties:
        item:
          type: array
          items:
            $ref: "#/components/schemas/ModelResource"
    ModelsResource:
      type: object
      properties:
        _links:
          $ref: "#/components/schemas/ModelLinks"
        _embedded:
          $ref: "#/components/schemas/EmbeddedModels"
    LanguageLinks:
      type: object
      properties:
        item:
          type: array
          items:
            $ref: "#/components/schemas/Link"
        self:
          $ref: "#/components/schemas/Link"
        translate:
          $ref: "#/components/schemas/Link"
    LanguageResourceLinks:
      type: object
      properties:
        translate:
          $ref: "#/components/schemas/Link"
        sources:
          type: array
          items:
            $ref: "#/components/schemas/Link"
        targets:
          type: array
          items:
            $ref: "#/components/schemas/Link"
        self:
          $ref: "#/components/schemas/Link"
    LanguageResource:
      type: object
      properties:
        _links:
          $ref: "#/components/schemas/LanguageResourceLinks"
        name:
          type: string
          example: cs
        title:
          type: string
          example: Czech
    EmbeddedLanguages:
      type: object
      properties:
        item:
          type: array
          items:
            $ref: "#/components/schemas/LanguageResource"
    LanguagesResource:
      type: object
      properties:
        _links:
          $ref: "#/components/schemas/LanguageLinks"
        _embedded:
          $ref: "#/components/schemas/EmbeddedLanguages"