CAT Server API

The CAT server is connected with the user interface via a web socket. In the specification below, the user interface is called the client. Currently, in CASMACAT, its only manifestation is implemented in JavaScript running in the Internet browser.

A requests from the client will trigger computation on the CAT server, whose result is communicated back asynchronously with a response code that is the request name with an added Result. For instance, the ping request triggers a pingResult response.

Protocol

The interaction between client and server starts with the client opening the connection. It then makes the following requests:

  • ping to check if there is a successful connection
  • getServerConfig to obtain information about the server
  • configure to pass on client side configuration information

Interactive translation prediction starts its dialogue with

  • decode to obtain the machine translation of the source sentence (and initialize the CAT server for interaction)
  • startSession

Requests

ping

Request parameters

  • ms INT: timestamp (in milliseconds)

Response parameters

  • ms INT: echo of received time stamp

Simple check if server is alive and responsive.

configure

Request parameters

  • prioritizer "confidence"
  • useAlignments BOOL
  • highlightPrefix BOOL
  • limitSuffixLength BOOL
  • useConfidences BOOL
  • displayMouseAlign BOOL
  • displayCaretAlign BOOL
  • highlightValidated BOOL
  • priorityLength INT
  • highlightLastValidated BOOL
  • mode "ITP"
  • useSuggestions BOOL
  • confidenceThresholds { bad: FLOAT, doubt: FLOAT }
  • displayConfidences BOOL'

Response parameters

  • ???

Sets configuration how this sentence will be handled.

decode

Request parameters

  • source STRING input sentence
  • numResults INT how many results should be retrieved

Response parameters

  • source echo of request
  • nbest array of:
    • target: STRING n-best list of translations
    • targetSegmentation: SEGMENTATION word to character alignment
    • elapsedTime: INT
    • author: STRING system or person that generated the target result
    • alignments: ARRAY dimensions: source * target
    • confidences: [ FLOAT ] word-confidence scores
    • quality: INT quality (0-100) measure of overall hypothesis

Initiates the translation of the sentence. The server will call the MT server to translate the sentence, keep intermediate data structures (such as the search graph) in state, and respond .... somehow.

startSession

Request parameters

  • source STRING input sentence

Response parameters

  • elapsedTime: INT timestamp (in milliseconds)

Starts interactive prediction session.

setPrefix

Request parameters

  • target: STRING current translation in text box
  • caretPos: INT index position of caret cursor
  • numResults: INT how many results should be retrieved (default: 1)

Response parameters

  • source: STRING Verified source
  • sourceSegmentation: SEGMENTATION Verified source segmentation
  • elapsedTime: INT ms
  • nbest array of:
    • target: STRING n-best list of translations
    • targetSegmentation: SEGMENTATION word to character alignment
    • author: STRING system or person that generated the target result
    • alignments: ARRAY dimensions: source * target
    • confidences: [ FLOAT ] word-confidence scores
    • quality: INT quality (0-100) measure of overall hypothesis
    • priorities: [ INT ]

rejectSuffix

endSession

getTokens

Request parameters

  • source: STRING source sentence
  • target: STRING current translation in text box

Response parameters

  • source: STRING source sentence
  • sourceSegmentation: SEGMENTATION source segmentation
  • target: STRING current translation in text box
  • targetSegmentation: SEGMENTATION source segmentation
  • elapsedTime: INT time to process (in ms)

Retrieves tokenization results for the current segment.