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 connectiongetServerConfig
to obtain information about the serverconfigure
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 sentencenumResults INT
how many results should be retrieved
Response parameters
source
echo of requestnbest
array of:target: STRING
n-best list of translationstargetSegmentation: SEGMENTATION
word to character alignmentelapsedTime: INT
author: STRING
system or person that generated the target resultalignments: ARRAY
dimensions: source * targetconfidences: [ FLOAT ]
word-confidence scoresquality: 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 boxcaretPos: INT
index position of caret cursornumResults: INT
how many results should be retrieved (default: 1)
Response parameters
source: STRING
Verified sourcesourceSegmentation: SEGMENTATION
Verified source segmentationelapsedTime: INT
msnbest
array of:target: STRING
n-best list of translationstargetSegmentation: SEGMENTATION
word to character alignmentauthor: STRING
system or person that generated the target resultalignments: ARRAY
dimensions: source * targetconfidences: [ FLOAT ]
word-confidence scoresquality: INT
quality (0-100) measure of overall hypothesispriorities: [ INT ]
rejectSuffix
endSession
getTokens
Request parameters
source: STRING
source sentencetarget: STRING
current translation in text box
Response parameters
source: STRING
source sentencesourceSegmentation: SEGMENTATION
source segmentationtarget: STRING
current translation in text boxtargetSegmentation: SEGMENTATION
source segmentationelapsedTime: INT
time to process (in ms)
Retrieves tokenization results for the current segment.