Systran Pure Neural Server Rest API

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 171

SYSTRAN Pure Neural® Server REST API

v9.1.1

2019-01-11

SYSTRAN International SYSTRAN SA SYSTRAN Software, Inc.


14F. Taeseok Building 5 5 rue Feydeau 4445 Eastgate Mall
Mabangro10gil, Seocho-gu, 75002 Paris Suite 310
Seoul, Korea France San Diego, CA 92121
www.systran-software.co.kr www.systran.fr USA
www.systransoft.com
Table of Contents

1. Overview .....................................................................................................................................10
2. New in v9.1.1 ...............................................................................................................................10
SYSTRAN.io and Classic REST API Changes for SPNS versus SES ................................................................ 10
Multimodal Speech Recognition API ........................................................................................................... 10
3. REST API Basics ...........................................................................................................................10
Server ......................................................................................................................................................... 10
Translation Resource (TR) ........................................................................................................................... 11
API Version ................................................................................................................................................. 12
HTTP and HTTPS ........................................................................................................................................ 12
REST........................................................................................................................................................... 12
REST from JavaScript ................................................................................................................................. 12
Cross Domain (CORS) ................................................................................................................................. 12
Silverlight Client Access Policy File ............................................................................................................. 13
Adobe Flash Cross-domain Policy File ......................................................................................................... 13
SPNS Data Format...................................................................................................................................... 13
Input and Output Text ................................................................................................................................ 14
JSONP Support ........................................................................................................................................... 14
Profile Selection ......................................................................................................................................... 14
Provided Examples ..................................................................................................................................... 15
4. SPNS REST API ........................................................................................................................... 16
Translation API Version................................................................................................................................17
Translation API Version Calling Style ...................................................................................................... 18
Translation API Version Request Parameters.......................................................................................... 18
Request with Query String Parameters .................................................................................................. 18
Response................................................................................................................................................ 18
Examples ............................................................................................................................................... 18
Translation Text Translate .......................................................................................................................... 19
Translation Text Translate Calling Style ................................................................................................. 19
Translation Text Translate Request Parameters ..................................................................................... 19
Request with Query String Parameters .................................................................................................. 21
Response................................................................................................................................................ 21
Examples ............................................................................................................................................... 21
Translation File Translate ............................................................................................................................ 24
Translation File Translate Calling Style ................................................................................................... 25
Translation File Translate Request Parameters ....................................................................................... 25
Request with Query String Parameters .................................................................................................. 26
Response................................................................................................................................................ 27
Examples ............................................................................................................................................... 29
Translation File Status ................................................................................................................................ 30
Translation File Status Calling Style........................................................................................................ 30
Translation File Status Request Parameters ........................................................................................... 31
Request with Query String Parameters .................................................................................................. 31
Response................................................................................................................................................ 31
Examples ............................................................................................................................................... 32
Translation File Result................................................................................................................................. 33
Translation File Result Calling Style ........................................................................................................ 33
Translation File Result Request Parameters............................................................................................ 33

SYSTRAN Pure Neural® Server REST API 2


Request with Query String Parameters .................................................................................................. 33
Response................................................................................................................................................ 33
Examples ............................................................................................................................................... 34
Translation File Cancel ................................................................................................................................ 34
Translation File Cancel Calling Style ....................................................................................................... 34
Translation File Cancel Request Parameters ........................................................................................... 35
Request with Query String Parameters .................................................................................................. 35
Response................................................................................................................................................ 35
Examples ............................................................................................................................................... 35
Translation File Batch Create ...................................................................................................................... 36
Translation File Batch Create Calling Style ............................................................................................. 36
Translation File Batch Create Request Parameters ................................................................................. 36
Request with Query String Parameters .................................................................................................. 36
Response.................................................................................................................................................37
Examples ................................................................................................................................................37
Translation File Batch Status .......................................................................................................................37
Translation File Batch Status Calling Style .............................................................................................. 38
Translation File Batch Status Request Parameters ................................................................................. 38
Request with Query String Parameters .................................................................................................. 38
Response................................................................................................................................................ 38
Examples ............................................................................................................................................... 39
Translation File Batch Close ........................................................................................................................ 39
Translation File Batch Close Calling Style ............................................................................................... 39
Translation File Batch Close Request Parameters ................................................................................... 40
Request with Query String Parameters .................................................................................................. 40
Response................................................................................................................................................ 40
Examples ............................................................................................................................................... 40
Translation File Batch Cancel ...................................................................................................................... 41
Translation File Batch Cancel Calling Style ............................................................................................. 41
Translation File Batch Cancel Request Parameters ................................................................................. 41
Request with Query String Parameters .................................................................................................. 41
Response................................................................................................................................................ 42
Examples ............................................................................................................................................... 42
Translation Supported Languages .............................................................................................................. 42
Translation Supported Languages Calling Style...................................................................................... 43
Translation Supported Languages Request Parameters ......................................................................... 43
Request with Query String Parameters .................................................................................................. 43
Response................................................................................................................................................ 43
Examples ............................................................................................................................................... 44
Translation Supported Formats .................................................................................................................. 48
Translation Supported Format Status Calling Style ................................................................................ 48
Translation Supported Formats Request Parameters ............................................................................. 49
Request with Query String Parameters .................................................................................................. 49
Response................................................................................................................................................ 49
Examples ............................................................................................................................................... 49
Translation Profiles ..................................................................................................................................... 53
Translation Profiles Calling Style ............................................................................................................ 53
Translation Profiles Request Parameters ................................................................................................ 54
Request with Query String Parameters .................................................................................................. 54
Response................................................................................................................................................ 54
Examples ............................................................................................................................................... 55
Translation Feedback Add .......................................................................................................................... 61

SYSTRAN Pure Neural® Server REST API 3


Translation Feedback Add Calling Style.................................................................................................. 61
Translation Feedback Add Parameters ................................................................................................... 61
Request with Query String Parameters .................................................................................................. 62
Response................................................................................................................................................ 62
Examples ............................................................................................................................................... 62
Language Detection API Version ................................................................................................................ 63
Language Detection API Version Calling Style ........................................................................................ 63
Language Detection API Version Request Parameters ........................................................................... 63
Request with Query String Parameters .................................................................................................. 63
Response................................................................................................................................................ 63
Examples ............................................................................................................................................... 64
Language Detection Document .................................................................................................................. 64
Language Detection Calling Style........................................................................................................... 64
Language Detection Request Parameters .............................................................................................. 65
Request with Query String Parameters .................................................................................................. 65
Request with Query String Parameters and a JSON Body....................................................................... 65
Request with the document to analyze in body of the request (rawBody mode) ..................................... 66
Request with the document to analyze in body of the request (form data mode) ................................... 66
Restrictions ............................................................................................................................................ 66
Response................................................................................................................................................ 66
Examples ............................................................................................................................................... 67
Language Detection Supported Formats .................................................................................................... 68
Language Detection Supported Format Status Calling Style .................................................................. 68
Language Detection Supported Formats Request Parameters ............................................................... 69
Request with Query String Parameters .................................................................................................. 69
Response................................................................................................................................................ 69
Examples ............................................................................................................................................... 69
Resources Dictionary API Version ................................................................................................................71
Resources Dictionary API Version Calling Style........................................................................................71
Resources Dictionary API Version Request Parameters .......................................................................... 72
Request with Query String Parameters .................................................................................................. 72
Response................................................................................................................................................ 72
Examples ............................................................................................................................................... 72
Resources Dictionary List .............................................................................................................................73
Resources Dictionary List Calling Style ....................................................................................................73
Resources Dictionary List Request Parameters ........................................................................................73
Request with Query String Parameters .................................................................................................. 75
Response................................................................................................................................................ 75
Examples ............................................................................................................................................... 76
Resources Dictionary Add ........................................................................................................................... 78
Resources Dictionary Add Calling Style .................................................................................................. 78
Resources Dictionary Add Request Parameters ...................................................................................... 78
Request with Query String Parameters .................................................................................................. 79
Response................................................................................................................................................ 79
Examples ............................................................................................................................................... 79
Resources Dictionary Update ...................................................................................................................... 80
Resources Dictionary Update Calling Style ............................................................................................. 81
Resources Dictionary Update Request Parameters ................................................................................. 81
Request with Query String Parameters .................................................................................................. 81
Response................................................................................................................................................ 82
Examples ............................................................................................................................................... 82
Resources Dictionary Export ....................................................................................................................... 83

SYSTRAN Pure Neural® Server REST API 4


Resources Dictionary Export Calling Style .............................................................................................. 83
Resources Dictionary Export Request Parameters .................................................................................. 83
Request with Query String Parameters .................................................................................................. 84
Response................................................................................................................................................ 84
Examples ............................................................................................................................................... 84
Resources Dictionary Delete ....................................................................................................................... 85
Resources Dictionary Delete Calling Style .............................................................................................. 85
Resources Dictionary Delete Request Parameters .................................................................................. 85
Request with Query String Parameters .................................................................................................. 85
Response................................................................................................................................................ 85
Examples ............................................................................................................................................... 85
Resources Dictionary Supported Languages ............................................................................................... 86
Resources Dictionary Supported Languages Calling Style ...................................................................... 86
Resources Dictionary Supported Languages Request Parameters .......................................................... 86
Request with Query String Parameters .................................................................................................. 86
Response................................................................................................................................................ 86
Examples ............................................................................................................................................... 87
Resources Dictionary Lookup...................................................................................................................... 88
Resources Dictionary Lookup Calling Style ............................................................................................. 88
Resources Dictionary Lookup Request Parameters................................................................................. 89
Request with Query String Parameters .................................................................................................. 89
Response................................................................................................................................................ 89
Examples ............................................................................................................................................... 91
Resources Dictionary Lookup Supported Languages .................................................................................. 93
Resources Dictionary Lookup Supported Languages Calling Style .......................................................... 94
Resources Dictionary Lookup Supported Languages Parameters ........................................................... 94
Request with Query String Parameters .................................................................................................. 94
Response................................................................................................................................................ 94
Examples ............................................................................................................................................... 95
Resources Dictionary Entry List ................................................................................................................ 100
Resources Dictionary Entry List Calling Style ........................................................................................ 100
Resources Dictionary Entry List Request Parameters ........................................................................... 100
Request with Query String Parameters .................................................................................................103
Response.............................................................................................................................................. 104
Examples ............................................................................................................................................. 104
Resources Dictionary Entry Add ................................................................................................................ 105
Resources Dictionary Entry Add Calling Style ....................................................................................... 105
Resources Dictionary Entry Add Request Parameters ........................................................................... 105
Request with Query String Parameters ................................................................................................ 106
Response.............................................................................................................................................. 106
Examples ..............................................................................................................................................107
Resources Dictionary Entry Update........................................................................................................... 108
Resources Dictionary Entry Update Calling Style .................................................................................. 108
Resources Dictionary Entry Update Request Parameters...................................................................... 108
Request with Query String Parameters ................................................................................................ 109
Response.............................................................................................................................................. 109
Examples ............................................................................................................................................. 109
Resources Dictionary Entry Import ............................................................................................................110
Resources Dictionary Entry Import Calling Style .................................................................................... 111
Resources Dictionary Entry Import Request Parameters ....................................................................... 111
Request with Query String Parameters ................................................................................................. 111
Response...............................................................................................................................................112

SYSTRAN Pure Neural® Server REST API 5


Examples ..............................................................................................................................................112
Resources Dictionary Entry Delete ............................................................................................................. 113
Resources Dictionary Entry Delete Calling Style .................................................................................... 113
Resources Dictionary Entry Delete Request Parameters ........................................................................ 113
Request with Query String Parameters ................................................................................................. 113
Response...............................................................................................................................................114
Examples ..............................................................................................................................................114
Resources Corpus API Version ................................................................................................................... 115
Resources Corpus API Version Calling Style ........................................................................................... 115
Resources Corpus API Version Request Parameters .............................................................................. 115
Request with Query String Parameters ................................................................................................. 115
Response............................................................................................................................................... 115
Examples ............................................................................................................................................. 116
Resources Corpus List ............................................................................................................................... 116
Resources Corpus List Calling Style ...................................................................................................... 116
Resources Corpus List Request Parameters .......................................................................................... 116
Request with Query String Parameters ................................................................................................. 117
Response............................................................................................................................................... 117
Examples ..............................................................................................................................................118
Resources Corpus Update ..........................................................................................................................118
Resources Corpus Update .....................................................................................................................118
Resources Corpus Update Request Parameters .................................................................................... 119
Request with Query String Parameters ................................................................................................ 119
Response.............................................................................................................................................. 119
Examples ............................................................................................................................................. 119
Resources Corpus Details .......................................................................................................................... 120
Resource Corpus Details Calling Style .................................................................................................. 120
Resources Corpus Details Request Parameters ..................................................................................... 120
Request with Query String Parameters ................................................................................................ 120
Response...............................................................................................................................................121
Examples ..............................................................................................................................................121
Resources Corpus Exists............................................................................................................................ 122
Resources Corpus Exists Calling Style ................................................................................................... 122
Resources Corpus Exists Request Parameters....................................................................................... 122
Request with Query String Parameters ................................................................................................ 122
Response.............................................................................................................................................. 122
Examples ..............................................................................................................................................123
Resources Corpus Import ...........................................................................................................................123
Resources Corpus Import Calling Style ..................................................................................................123
Resources Corpus Import Request Parameters ..................................................................................... 124
Request with Query String Parameters ................................................................................................ 124
Response.............................................................................................................................................. 124
Examples ............................................................................................................................................. 124
Resources Corpus Export .......................................................................................................................... 125
Resources Corpus Export Calling Style ................................................................................................. 125
Resources Corpus Export Request Parameters ..................................................................................... 125
Request with Query String Parameters ................................................................................................ 126
Response.............................................................................................................................................. 126
Examples ............................................................................................................................................. 126
Resources Corpus Delete .......................................................................................................................... 128
Resources Corpus Delete Calling Style ................................................................................................. 128
Resources Corpus Delete Request Parameters ..................................................................................... 128

SYSTRAN Pure Neural® Server REST API 6


Request with Query String Parameters ................................................................................................ 128
Response.............................................................................................................................................. 128
Examples ............................................................................................................................................. 129
Resources Corpus Match ........................................................................................................................... 129
Resources Corpus Match Calling Style .................................................................................................. 129
Resources Corpus Match Request Parameters .......................................................................................130
Request with Query String Parameters .................................................................................................130
Response...............................................................................................................................................130
Examples .............................................................................................................................................. 131
Resources Corpus Segment List .................................................................................................................132
Resources Corpus Segment List Calling Style ........................................................................................132
Resources Corpus Segment List Request Parameters ............................................................................132
Request with Query String Parameters .................................................................................................132
Response...............................................................................................................................................132
Examples .............................................................................................................................................. 133
Resources Corpus Segment Add ................................................................................................................134
Resources Corpus Segment Add Calling Style .......................................................................................134
Resources Corpus Segment Add Request Parameters ........................................................................... 135
Request with Query String Parameters ................................................................................................ 136
Response.............................................................................................................................................. 136
Examples ............................................................................................................................................. 136
Resources Corpus Segment Delete ............................................................................................................138
Resources Corpus Segment Delete Calling Style ...................................................................................138
Resources Corpus Segment Delete Request Parameters .......................................................................138
Request with Query String Parameters .................................................................................................138
Response...............................................................................................................................................138
Examples ............................................................................................................................................. 139
Resources Corpus Segment Update .......................................................................................................... 139
Resources Corpus Segment Update Calling Style ................................................................................. 139
Resources Corpus Segment Update Request Parameters ..................................................................... 140
Request with Query String Parameters ................................................................................................ 140
Response.............................................................................................................................................. 140
Examples ............................................................................................................................................. 140
Resources Corpus Segment Target Add .....................................................................................................141
Resources Corpus Segment Target Add Calling Style ............................................................................141
Resources Corpus Segment Target Add Request Parameters ................................................................141
Request with Query String Parameters ................................................................................................ 142
Response.............................................................................................................................................. 142
Examples ..............................................................................................................................................143
Resources Corpus Segment Target Delete ................................................................................................ 144
Resources Corpus Segment Target Delete Calling Style ....................................................................... 144
Resources Corpus Segment Target Delete Request Parameters ........................................................... 144
Request with Query String Parameters ................................................................................................ 144
Response.............................................................................................................................................. 144
Examples ............................................................................................................................................. 145
Multimodal Speech API Version ................................................................................................................ 145
Multimodal Speech API Version Calling Style ....................................................................................... 145
Multimodal Speech API Version Request Parameters ........................................................................... 146
Request with Query String Parameters ................................................................................................ 146
Response.............................................................................................................................................. 146
Examples ............................................................................................................................................. 146
Multimodal Speech Transcribe...................................................................................................................147

SYSTRAN Pure Neural® Server REST API 7


Multimodal Speech Transcribe Calling Style ..........................................................................................147
Multimodal Speech Transcribe Request Parameters..............................................................................147
Request to analyze the audio file in body of the request (form data mode) ........................................... 148
Restrictions .......................................................................................................................................... 148
Response.............................................................................................................................................. 148
Examples ............................................................................................................................................. 149
Multimodal Speech Align .......................................................................................................................... 150
Multimodal Speech Align Calling Style ................................................................................................. 150
Multimodal Speech Align Request Parameters ...................................................................................... 151
Request to analyze the audio file in body of the request (form data mode) ............................................ 151
Restrictions .......................................................................................................................................... 152
Response.............................................................................................................................................. 152
Examples .............................................................................................................................................. 153
Multimodal Speech Segment .................................................................................................................... 154
Multimodal Speech Segment Calling Style ........................................................................................... 154
Multimodal Speech Segment Request Parameters ............................................................................... 154
Request to analyze the audio file in body of the request (form data mode) ............................................155
Restrictions ...........................................................................................................................................155
Response...............................................................................................................................................155
Examples ............................................................................................................................................. 156
Multimodal Speech Language Detection .................................................................................................. 156
Multimodal Speech Language Detection Calling Style ......................................................................... 156
Multimodal Speech Language Detection Request Parameters .............................................................. 157
Request to analyze the audio file in body of the request (form data mode) ............................................ 157
Restrictions ........................................................................................................................................... 157
Response............................................................................................................................................... 157
Examples ............................................................................................................................................. 158
Multimodal Speech Supported Languages................................................................................................ 158
Multimodal Speech Supported Languages Calling Style ....................................................................... 158
Multimodal Speech Supported Languages Request Parameters........................................................... 159
Request with Query String Parameters ................................................................................................ 159
Response.............................................................................................................................................. 159
Examples ............................................................................................................................................. 159
5. Usage Tips ................................................................................................................................. 160
General Guidance for Performing Translations ......................................................................................... 160
Customizing Translations with Dictionary and Corpus Entries ................................................................... 161
Adding Annotations to Translations .......................................................................................................... 161
Translating with Do-not-translate Tags .................................................................................................... 164
Translating with XLIFF Data ...................................................................................................................... 165
Examples ............................................................................................................................................. 165
6. Language Code Values................................................................................................................166
7. Domain Values ...........................................................................................................................168
8. Terminology ..............................................................................................................................168
9. References.................................................................................................................................169
10. Releases .................................................................................................................................... 170
SPNS REST API..........................................................................................................................................170
Translation REST API ............................................................................................................................170
2.1.1 ..................................................................................................................................................170
2.1.0 .................................................................................................................................................170
2.0.0 .................................................................................................................................................170
1.0.0 .................................................................................................................................................170
Resources Corpus REST API ..................................................................................................................170

SYSTRAN Pure Neural® Server REST API 8


1.0.0 .................................................................................................................................................170
Resources Dictionary REST API .............................................................................................................170
1.0.0 .................................................................................................................................................170
NLP LID REST API .................................................................................................................................170
1.0.0 .................................................................................................................................................170
Multimodal Speech REST API ................................................................................................................ 171
2.0.0 ................................................................................................................................................. 171
1.0.0 ................................................................................................................................................. 171
11. Technical Support ...................................................................................................................... 171
12. Copyright .................................................................................................................................. 171

SYSTRAN Pure Neural® Server REST API 9


1. Overview
The SYSTRAN Pure Neural® Server (SPNS) is the new name for the former SYSTRAN Enterprise Server (SES).
SPNS includes some significant enhancements including more extensive use of SYSTRAN’s Pure Neural®
translation capabilities. SPNS includes a sophisticated REST API to support translation, language detection,
dictionary management and use (dictionary listing, lookup and modification), as well as corpus management and
use (for TMs). This document is intended for developers that want to use this API for applications involving these
features.

2. New in v9.1.1
This describes the main REST API changes for this new release of SPNS.

SYSTRAN.io and Classic REST API Changes for SPNS versus SES
In SPNS 9.1.1, what was previously known as the SYSTRAN.io REST API is now known as the SPNS REST API. The
Classic REST API (also known a SYSTRAN REST V1 API) is still available for the present time, but is deprecated. It
is recommended that you consider updating your existing applications to use the SPNS REST API. For information
on the Classic REST API refer to the SES 8.6.2 REST API documentation.

Multimodal Speech Recognition API


Audio transcription using the Multimodal Speech Recognition REST APIs under /multimodal/speech now support
both Vocapia VoxSigma and Nuance Transcription Engine. This includes audio transcription, language detection
and audio/text alignment. This requires a license for the Vocapia VoxSigma or Nuance Transcription Engine
system. Contact SYSTRAN for details.

Important!
Nuance Transcription Engine does not support /multimodal/speech/segment or
/multimodal/speech/align services.

3. REST API Basics


Server
An app, application, or website must identify itself each time it sends a request to the SYSTRAN Pure Neural®
Server (SPNS) installation. It accomplishes this by referencing an SPNS Gateway URL and API key. Throughout
this document these are represented by <SPNS Gateway URL> and <API key> respectively. For example, <SPNS
Gateway URL> might be “https://myserver:8904” and <API key> might be “abcdef12-3456-789a-bcde-
f12345678910“. Determining the values for these expressions will depend on your installation, protocol selected
for the Gateway access and API key. To acquire a valid API Key, you must access the SPNS console, select
Personal Info and then find API Keys. For use with the REST API, it is recommended that you select “Android”,
“iOS” or “server”, depending on your application.

SYSTRAN Pure Neural® Server REST API 10


Figure: Selecting Personal Info in SPNS console.

Figure: Finding API Keys in SPNS console.

After obtaining an API key, your application can append the request parameter key=yourAPIKey to all request
URLs. The API key is safe for embedding in URLs and does not require any encoding.

Translation Resource (TR)


An SPNS Translation Resource (or TR) is an installable SPNS module that contains items related to translations.
The main TRs are “Filter” or language-pair translators. The Filter TR transforms incoming text or documents into
SPNS standard translation units, which are processed by language-pair translators. The Filter TR also transforms
the completed translation back into the format of the original text or documents. SPNS allows multiple instances

SYSTRAN Pure Neural® Server REST API 11


of TRs to run to achieve better performance, and TRs may be installed on the primary SPNS system or associated
computing nodes.

API Version
The SPNS REST API provides an API to query the version of an API. With SPNS, several API groups are supported:
Translation REST API (or /translation), Resources Corpus REST API (or /resources/corpus), Resources Dictionary
REST API (or /resources/dictionary), Language Detection REST API (or /nlp/lid) and Multimodal REST API (or
/multimodal). Each group has its own API version. Prior to SES 8.5, the API version was “1.0.0” for all. With the
release of SPNS 9.1.1, the version is now “2.1.1” for the Translation REST API, “2.0.0” for the Multimodal REST
API, and “1.0.0” for the other API groups.

HTTP and HTTPS


SPNS supports both the HTTP and the HTTPS protocol. By default, the URL port number for HTTP is 8903, and
for HTTPS is 8904.

REST
You can use the SPNS with the REST (see reference [1]) calling style. Access the SPNS REST API service endpoint
using the REST HTTP verb, and pass the details of all service requests as request parameters. The typical
response when the request succeeds is the HTTP status code “200”. The other status codes are as follows.

HTTP Status Codes


Status Code Description
200 Successful request. In some
cases, this is also used for
error results too.
400 Invalid parameters.
401 Unauthorized access. For
example, an invalid API key
403 Feature not available. May be
missing product license,
404 Not found. For example, an
invalid REST API route or
profile.
413 Translation request too large
due to file size limit or URI too
long.
415 Unsupported
encoding/charset.
500 An invalid source or target
language, or other errors.

REST from JavaScript


You can invoke SPNS using REST from JavaScript, using the callback request parameter and a callback function.
Please note that your API key will be viewable in the HTML source for your page. By default, an API key can be
used on any site. As such, we strongly recommend that you confine the use of your API key to only domains that
you administer in order to prevent their use on unauthorized site.

Cross Domain (CORS)


SPNS supports cross-domain requests through the JSONP [2] or the CORS [3] mechanism. The server will
correctly handle the OPTIONS requests used by CORS.

SYSTRAN Pure Neural® Server REST API 12


The following headers are set as follows:

Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE

Silverlight Client Access Policy File


SPNS REST API supports the Silverlight client access policy file (clientaccesspolicy.xml) to handle cross-domain
requests.

<?xml version="1.0" encoding="utf-8"?>


<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>

Adobe Flash Cross-domain Policy File


SPNS REST API supports the Adobe Flash cross-domain policy file (crossdomain.xml) to handle cross-domain
requests.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-
policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>

SPNS Data Format


The result of a request to the SPNS REST API is often a simple JSON object. JSON (JavaScript Object Notation)
(see references [4] and [5]) is a common Internet format that offers a simple method of representing arbitrary
data structures. According to json.org (see reference [5]), JSON is a text format that is completely language-
independent, but which employs conventions that are familiar to programmers of the C-family of languages,
including C, C++, C#, Java, JavaScript, Perl, Python, and many others.

SYSTRAN Pure Neural® Server REST API 13


Input and Output Text
The input text must be encoded in UTF-8 and passed as an URL parameter will be escaped with an equivalent of
the JavaScript encodeURIComponent function. The output text (translated text, error and warning strings) will be
encoded in UTF-8.

JSONP Support
All APIs support JSONP by providing a callback function name parameter. This will encapsulate the response body
this way:

callbackFunctionName(/* response body as defined in each API section */);

For example, for a /translation/supportedLanguages call with the callback set to supportedLanguagesCallback the
response body will be similar to the following:

supportedLanguagesCallback({
"warning": "", /* Warning at request level */
"error": "", /* Error at request level */
"languagePairs": [
{
"source": "en", /* source language */
"target": "fr", /* source language */
"profiles": [
{
"id": "2abed45f-5cd2-46fd-9962-11db4ac53309",
"private": true
}
]
}
]
});

Profile Selection
In SES 8.4.2 and prior releases, profiles were selected by an integer profile identifier or ID (0..n). The profile ID
was assigned by the user through the SES console and different translators for different language pairs could
share the same profile ID. With newer SES releases (SES 8.5 and later), translators are automatically assigned
unique profile IDs that are UUIDs (Universally Unique Identifiers are complex values, for example, “9321408e-
2574-4408-afa3-8f970131d57a”). A translator (TR) can be selected by its UUID, but the recommended method is
to choose a translator using “selectors”. The available selectors are “owner”, “domain” and “size”. The “owner” is
the profile creator and the “domain” is the main topic covered by the translator, such as “IT”, “Medical” or a
general-purpose domain such called “Generic”. The “size” refers to the computing resource required by a
translator in terms of disk space and memory, but is also related to the quality of the translation. A small size
(called “S”) uses less computing resources and translates quicker, while sacrificing some quality. A medium size
(called “M”) uses more computing resources though it translates slower, while generating better translations.
Those not frequently used, there is also a large size (called “L”). With the advent of SYSTRAN’s PNMT (neural
network-based translators), these typically are “M” size like SPE or SMT translators. When the SPNS translation
API services are provided with selectors, it will choose the closest matching translator based on the selector
values. The default size is “M” if none is specified and the default domain is “Generic”.

SYSTRAN Pure Neural® Server REST API 14


The available translators and associated selectors can be retrieved using the SPNS profile API service
(/translation/profiles).

Below are some examples illustrating how selectors work in identifying a TR.

Example 1:

• Wanted route: TR for EN/FR (English-to-French) owner: Self, domain: IT, size: L
• Order of checked routes (from first to last):
- TR for EN/FR, Self | IT | L
- TR for EN/FR, Self | IT | M
- TR for EN/FR, Self | IT | S
- TR for EN/FR, Self | Generic | L
- TR for EN/FR, Self | Generic | M
- TR for EN/FR, Self | Generic | S
- TR for EN/FR, Systran | IT | L
- TR for EN/FR, Systran | IT | M
- TR for EN/FR, Systran | IT | S
- TR for EN/FR, Systran | Generic | L
- TR for EN/FR, Systran | Generic | M
- TR for EN/FR, Systran | Generic | S

Example 2:

• Wanted route: TR for EN/FR (English-to-French) owner: Self, domain: IT, size: S
• Order of checked routes (from first to last):
- TR for EN/FR, Self | IT | S
- TR for EN/FR, Self | Generic | S
- TR for EN/FR, Systran | IT | S
- TR for EN/FR, Systran | Generic | S

Example 3:

• Wanted route: TR for EN/FR (English-to-French), no selectors


• Order of checked routes (from first to last):
- TR for EN/FR, Systran | Generic | M
- TR for EN/FR, Systran | Generic | S

Note that if none of the TRs for a language pair include a domain of “Generic” (must be exactly this term – the
match is case sensitive), then a TR may not be identified when using selectors that include a non-Generic domain.
In this case, SPNS will return an error regarding no matching routes (“Route not found” or “No Queue defined for
Route”).

Provided Examples
All the examples provided use httpie [6] for better readability. This tool requires Python (see
https://www.python.org) and pip (installation depends on the platform). These examples will work on Linux and
Windows platforms.

SYSTRAN Pure Neural® Server REST API 15


4. SPNS REST API
For the SPNS Global Edition, it supports the Translation, Resources, NLP/LID and Multimodal Speech REST APIs.
However, for the SPNS Standard Edition it only supports the Translation REST API. It is recommended that the
calling application use the API version information for each API to determine how it should work with the other
API services.

The REST API services supported by the SPNS REST API are listed in the table below.

SPNS REST API Services


Service Description
/multimodal/speech/align Align transcribed text by times (start/end) per word
with speech in audio files.
/multimodal/speech/apiVersion API version for the Multimodal Speech REST API.
/multimodal/speech/detectLanguage Detect speech language in audio files.
/multimodal/speech/segment Segment speech by speaker in audio files.
/multimodal/speech/supportedLanguages List the language pairs in which a lookup is supported
for a dictionary.
/multimodal/speech/transcribe Transcribe text from an audio file.
/nlp/lid/apiVersion API version for the NLP/LID REST API.
/nlp/lid/detectLanguage/document Identify or detect the language for provided text or
document.
/nlp/lid/supportedFormats Retrieve the list of support file formats for language
detection.
/resources/corpus/apiVersion API version for the Resources Corpus REST API.
/resources/corpus/delete Delete a corpus.
/resources/corpus/details Retrieve detailed information about a corpus.
/resources/corpus/exists Check if a corpus exists.
/resources/corpus/export Export a corpus using a specified format.
/resources/corpus/import Import a corpus using a specified format.
/resources/corpus/list List all available corpora.
/resources/corpus/match Find segments in the corpus that match provided
input text.
/resources/corpus/segment/add Add segments to a corpus.
/resources/corpus/segment/delete Delete segments from a corpus.
/resources/corpus/segment/list List segments in a corpus.
/resources/corpus/segment/target/add Add targets to a segment in a corpus.
/resources/corpus/segment/target/delete Delete targets from a segment in a corpus.
/resources/corpus/segment/update Update a segment in a corpus.
/resources/corpus/update Update properties of a corpus.
/resources/dictionary/add Add a dictionary.
/resources/dictionary/apiVersion API version for the Resources Dictionary REST API.
/resources/dictionary/delete Delete a dictionary.
/resources/dictionary/entry/add Add an entry to a dictionary.
/resources/dictionary/entry/delete Delete an entry from a dictionary.
/resources/dictionary/entry/import Import entries into a dictionary.
/resources/dictionary/entry/list List entries for a dictionary.
/resources/dictionary/entry/update Update an entry in a dictionary.
/resources/dictionary/export Export a dictionary.
/resources/dictionary/list Retrieve list of all dictionaries installed.
/resources/dictionary/lookup Look up a term or phrase in a dictionary.

SYSTRAN Pure Neural® Server REST API 16


Service Description
/resources/dictionary/lookup/supportedLanguages List the language pairs in which a lookup is supported
for a dictionary.
/resources/dictionary/supportedLanguages Retrieve supported languages for dictionaries.
/resources/dictionary/update Update a dictionary.
/translation/apiVersion API version for the Translation REST API.
/translation/feedback/add Add feedback for a specified translation.
/translation/file/batch/cancel Cancel a translation batch and all association
translation requests.
/translation/file/batch/close Close a translation batch to prevent new requests
being added.
/translation/file/batch/create Create a new translation batch, to which
asynchronous translate requests can be associated.
/translation/file/batch/status Check the status of translation requests for a
translation batch.
/translation/file/cancel Cancel an asynchronous file translation.
/translation/file/results Retrieve the file translation results for an
asynchronous translation.
/translation/file/status Check the file translation status for an asynchronous
translation.
/translation/file/translate Translate source file from specified language (or
automatically detected language) to specified target
language.
/translation/profile Retrieve the list of available profiles for translations.
/translation/supportedFormats Retrieve the list of support file formats for
translations.
/translation/supportedLanguages Retrieve the list of supported language pairs and
associated profiles for translations.
/translation/text/translate Translate source text from specified language (or
automatically detected language) to specified target
language.

The services share the following standards.

• All API services are executed using the HTTP GET and POST methods as noted.
• It is recommended that the API key should always be the “Android”, “iOS” or “server” – depending on the
application platform. Do not use the “Browser” or untyped API keys. For translations, add the parameter
“bundleId” (with your application bundle identifier) for iOS API keys, or add the parameters
“packageName” (with your application package name) and “certFingerprint” (with your application
certificate fingerprint) for Android API keys.
• Language codes are generally ISO 639-1 two-letter codes, with a few SYSTRAN-specific exceptions.
These are listed in Section 6. For the Multimodal Speech REST APIs, the language code returned are ISO
639-2/B three-letter codes also listed in Section 6. The language codes must be lower case.
• Parameter value case is important.
• Almost all service parameters are specified as query key/value data. The exceptions to this are noted.

Note
The JSON output in all the provided examples is formatted for readability.

Translation API Version


Retrieve the API version for the Translation REST API.

SYSTRAN Pure Neural® Server REST API 17


Translation API Version Calling Style
The specific format to return the API version is:

GET <SPNS Gateway URL>/translation/apiVersion?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Translation API Version Request Parameters


The Translation API Version request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation API Version Parameters


Parameter Mandatory Default Description
key yes API key for service.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/apiVersion?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"version": "2.1.1"
}

Examples
Get API version for Translation REST API
http -v GET <SES Gateway URL>/translation/apiVersion key==<API key>

GET /translation/apiVersion?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>

SYSTRAN Pure Neural® Server REST API 18


User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 19
Content-Type: application/json; charset=utf-8
Date: Fri, 16 Nov 2018 22:41:23 GMT
Vary: Accept-Encoding

{
"version": "2.1.1"
}

Translation Text Translate


One of the core features of the SPNS REST API is the translation of text data from one language to another. This
includes the ability to automatically detect the source language and include detailed annotations.

Translation Text Translate Calling Style


The specific format to translate text is:

POST <SPNS Gateway URL>/translation/text/translate?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• input
• target

All other request parameters are optional.

Translation Text Translate Request Parameters


The Translation Text Translate request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation Text Translate Parameters


Parameter Mandatory Default Description
key yes API key for service.
input yes Text to translate. Multiple input parameters can be
specified.
source no auto Language code of the source text; when the value is auto
the language will be automatically detected, and returned
in the output.
target yes Language code into which to translate the source text.

SYSTRAN Pure Neural® Server REST API 19


Parameter Mandatory Default Description
format no auto Format of the source text. Valid values are text for plain
text, html for HTML pages, and auto for automatic
detection. The MIME type of file format supported by
SYSTRAN can also be used
(application/vnd.openxmlformats,
application/vnd.oasis.opendocument, ...).
owner no Owner of the translation resource (TR). For example,
“Systran”.
domain no general Domain of the corpus to use for translation.
size no Size describes the size (both in disk space and computing
resource usage) the translation resource (TR). It can be “S”
(for small) or “M” (for medium). Usually ”S” TRs are using
rule based translators, which are fast, but less accurate.
“M” TRs are more likely to be statistical translators, which
are slower, but more accurate.
profile no Profile identifier (or “ID”) when relevant.
rawBody no false The text to translate can be sent in body of the requests, all
the other parameters can be sent as query string
parameters. In the latter, the translated text will be sent
back in the body of the response message.
withSource no false With this parameter, the source will also be sent back in the
response message. It can be useful when used with the
withAnnotations option to have the alignment between
the source document and the translated document.
withAnnotations no false With this parameter, different annotations will be provided
in the translated document. If the parameter withSource is
used, the annotations will also be provided in the source
document. The segments, tokens, not found words and
other annotations will be provided.
withInfo no false With this parameter, information regarding the translation
is returned including routes selected, processing statistics
and language detection (if source not provided). Note that
withInfo is case sensitive and need to be specified as
shown.
withCorpus no Corpus to be applied to the translation result. Each corpus
identifier must be separated by a comma with a maximum
of 5 corpora. If an exact match is found in one of the corpora
selected during translation, then the translation from the
corpus will be applied instead of the automatic translation.
This parameter must to be used in combination with
/resources/corpus services in the Resources REST API.
options no An option can be a JSON object containing a set of
key/value generic options supported by the translator. It
can also be a string with the syntax “<key>:<value>” to pass
a key/value generic option to the translator. Specific
options are documented elsewhere. Contact SYSTRAN
support for details.
encoding no utf-8 Encodings can be base64 or utf-8. base64 can be useful to
send binary document in the JSON body. Please note that
another alternative is to use the rawBody parameter.

SYSTRAN Pure Neural® Server REST API 20


Parameter Mandatory Default Description
backtranslation no false Valid values are true or false. If selected, the translated text
will be translated in source language.
callback no JavaScript callback function for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format or pass part of the data in
JSON object.

POST <SPNS Gateway URL>/translation/text/translate?key=<API key>&source=<source


language>&target=<target language>&input=<source text>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "An error occurred",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
},
"requestId": "55b753d87f2d682a607b8be1",
"outputs": [
{
"error": "Internal error",
"detectedLanguage": "en",
"detectedLanguageConfidence": 0.9260174036026001,
"output": "le chien",
"backTranslation": "the dog",
"source": "the dog"
}
]
}

Examples
Text translation with information
http -v POST <SPNS Gateway URL>/translation/text/translate key==<API key> target==fr
withInfo==true input=="Hello and have a good day"

POST /translation/text/translate?key=<API
key>&target=fr&withInfo=true&input=Hello+and+have+a+good+day HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0

SYSTRAN Pure Neural® Server REST API 21


Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 20 Dec 2018 00:09:04 GMT
Transfer-Encoding: chunked
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"outputs": [
{
"info": {
"lid": {
"confidence": 0.788307785987854,
"language": "en"
},
"selected_routes": [
{
"routes": [
{
"profileId": "e00bfc3c-b36c-453c-ad34-43f0b191ea1d",
"queue": "575cec93-7581-4fee-a315-6808e77ef99c",
"service": "Filter",
"version": "2.0"
}
],
"stepName": "filter-import"
},
{
"routes": [
{
"profileId": "12450906-5560-4bb1-aed6-1d938a8f3c26",
"queue": "flow",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "M",
"tech": {
"name": "Docker-OpenNMT-ctranslate",
"type": "NMT"
}
},
"service": "Translate_en_fr",
"version": "2.0"
},
{
"profileId": "b5cabe50-43d5-4cc9-8bf7-06ecb63f38d2",
"queue": "b8efe929-c7ab-48bb-a5e2-98075ef99031",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "M",
"tech": {

SYSTRAN Pure Neural® Server REST API 22


"name": "Docker-OpenNMT-ctranslate",
"type": "NMT"
}
},
"service": "Translate_en_fr",
"version": "2.0"
}
],
"stepName": "translate-with-filter"
},
{
"routes": [
{
"profileId": "e00bfc3c-b36c-453c-ad34-43f0b191ea1d",
"queue": "575cec93-7581-4fee-a315-6808e77ef99c",
"service": "Filter",
"version": "2.0"
}
],
"stepName": "filter-export"
}
],
"stats": {
"elapsed_time": 101,
"nb_characters": 25,
"nb_tokens": 0,
"nb_tus": 1,
"nb_tus_failed": 0
}
},
"output": "Bonjour et bonne journée"
}
]
}

Text translation with JSON object


more example.json
{ "key": "<API key>", "input": [ "Hello and have a good!", "Once in a blue moon" ] }

http -v POST <SPNS Gateway URL>/translation/text/translate source==en target==fr @example.json

POST /translation/text/translate?source=en&target=fr HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 112
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"input": [
"Hello and have a good!",
"Once in a blue moon"
],
"key": "<API key>"
}

HTTP/1.1 200 OK

SYSTRAN Pure Neural® Server REST API 23


Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 85
Content-Type: application/json; charset=utf-8
Date: Thu, 20 Dec 2018 00:12:59 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"outputs": [
{
"output": "Bonjour et bon !"
},
{
"output": "Une fois dans une lune bleue"
}
]
}

Translation File Translate


One of the core features of the SPNS REST API is the translation of text data from one language to another. This
includes the ability to automatically detect the source language and include detailed annotations. Supported
document types are listed below.

• Plain text
• HTML
• TMX
• XLIFF
• Microsoft Word DOC and DOCX
• Microsoft PowerPoint PPTX
• Microsoft Excel XLSX
• Adobe PDF (translated to DOCX format)
• Rich Text Format (RTF)
• OpenDocument Text ODT
• OpenDocument Spreadsheet ODS
• OpenDocument Presentation ODP

This supports translation synchronously or asynchronously. When a synchronous translation request is made, the
calling application waits until the translation is complete. When an asynchronous translation request is made, the
call is immediately returned with a request identifier (ID). The calling application must follow up or poll with
status checks providing the request ID. Upon completion of the translation, the translation results are retrieved.

Important!
It is generally recommended to use the asynchronous pattern for performing file translations.
Since translations may be quick or lengthy (depending on the quantity of text to translate and
the language pair translator selected), this provides better use of the calling application
resources as well as those of SPNS.

SYSTRAN Pure Neural® Server REST API 24


Note!
Asynchronous translation requests may be associated with a “batch” by including the batch
identifier parameter. The The batch is created with the the Translation File Batch Create
request, and monitored with the Translation File Batch Status request.

Translation File Translate Calling Style


The specific format to translate documents is:

POST <SPNS Gateway URL>/translation/file/translate?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• input
• target

All other request parameters are optional.

Translation File Translate Request Parameters


The Translation File Translate request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Translate Parameters


Parameter Mandatory Default Description
key yes API key for service.
input yes Text to translate. Multiple input parameters can be
specified.
source no auto Language code of the source text; when the value is auto
the language will be automatically detected, and returned
in the output.
target yes Language code into which to translate the source text.
async no false With this parameter, the translation is done
asynchronously. The /translation/file/status service must
be used to wait for the completion of the request and the
/translation/file/result service must be used to get the final
result. The /translation/file/cancel service can be used to
cancel the request. The rawBody must also be used when
the asynchronous mode is activated.
format no auto Format of the source text. Valid values are text for plain
text, html for HTML pages, and auto for automatic
detection. The MIME type of file format supported by
SYSTRAN can also be used
(application/vnd.openxmlformats,
application/vnd.oasis.opendocument, ...).
owner no Owner of the translation resource (TR). For example,
“Systran”.
domain no general Domain of the corpus to use for translation.

SYSTRAN Pure Neural® Server REST API 25


Parameter Mandatory Default Description
size no Size describes the size (both in disk space and computing
resource usage) the translation resource (TR). It can be “S”
(for small) or “M” (for medium). Usually ”S” TRs are using
rule based translators, which are fast, but less accurate.
“M” TRS are more likely to be PNMT or statistical
translators, which are slower, but more accurate.
profile no Profile identifier (or “ID”) when relevant.
rawBody no false The text to translate can be sent in body of the requests, all
the other parameters can be sent as query string
parameters. In the latter, the translated text will be sent
back in the body of the response message.
withSource no false With this parameter, the source will also be sent back in the
response message. It can be useful when used with the
withAnnotations option to have the alignment between
the source document and the translated document.
withAnnotations no false With this parameter, different annotations will be provided
in the translated document. If the parameter withSource is
used, the annotations will also be provided in the source
document. The segments, tokens, not found words and
other annotations will be provided.
withInfo no false With this parameter, information regarding the translation
is returned including routes selected, processing statistics
and language detection (if source not provided). Note that
withInfo is case sensitive and need to be specified as
shown.
withCorpus no Corpus to be applied to the translation result. Each corpus
identifier must be separated by a comma with a maximum
of 5 corpora. If an exact match is found in one of the corpora
selected during translation, then the translation from the
corpus will be applied instead of the automatic translation.
This parameter must to be used in combination with
/resources/corpus services in the Resources REST API.
batchID no Identifier of the batch to which the translation request will
be associated. Only asynchronous requests (those with
async is “true”) can be associated to a batch.
options no An option can be a JSON object containing a set of
key/value generic options supported by the translator. It
can also be a string with the syntax “<key>:<value>” to pass
a key/value generic option to the translator. Specific
options are documented elsewhere. Contact SYSTRAN
support for details.
encoding no utf-8 Encodings can be base64 or utf-8. base64 can be useful to
send binary document in the JSON body. Please note that
another alternative is to use the rawBody parameter.
callback no JavaScript callback function for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing the file content in input as part of the request body, and the
remaining parameters in the query string format.

SYSTRAN Pure Neural® Server REST API 26


POST <SPNS Gateway URL>/translation/file/translate?key=<API key>&source=<source
language>&target=<target language>&rawBody=true

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object in asynchronous mode. In synchronous mode, the response will be
either the translated document directly, or if the withSource is or withInfo parameter is specified a multipart
response.

For asynchronous:

{
"requestId": "54a3d860e62ea467b136eddb" /* Request identifier to use to get the status,
the result of the request and to cancel it */
"error": {
"message": "" /* Error at request level */
"info": {}
}
}

For synchronous with no withSource or withInfo parameter:


more example.html
<html>This is a <b>black</b> dog.</html>

http -v POST <SPNS Gateway URL>/translation/file/translate key==<API key> source==en


target==fr rawBody==true @example.html

POST /translation/file/translate?key=<API key>&source=en&target=fr&withInfo=true&rawBody=true


HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: text/html
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

<html>This is a <b>black</b> dog.</html>

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 1294
Content-Type: multipart/mixed; boundary="1b28b5eb13ca11dc3238ef1f0a46d90a5a13fdd5"
Date: Thu, 20 Dec 2018 00:28:06 GMT
Vary: X-HTTP-Method-Override

--1b28b5eb13ca11dc3238ef1f0a46d90a5a13fdd5
part-name: info

SYSTRAN Pure Neural® Server REST API 27


{"selected_routes":[{"routes":[{"profileId":"e00bfc3c-b36c-453c-ad34-
43f0b191ea1d","queue":"575cec93-7581-4fee-a315-
6808e77ef99c","service":"Filter","version":"2.0"}],"stepName":"filter-
import"},{"routes":[{"profileId":"12450906-5560-4bb1-aed6-
1d938a8f3c26","queue":"flow","selectors":{"domain":"Generic","owner":"Systran","size":"M","tec
h":{"name":"Docker-OpenNMT-
ctranslate","type":"NMT"}},"service":"Translate_en_fr","version":"2.0"},{"profileId":"b5cabe50
-43d5-4cc9-8bf7-06ecb63f38d2","queue":"b8efe929-c7ab-48bb-a5e2-
98075ef99031","selectors":{"domain":"Generic","owner":"Systran","size":"M","tech":{"name":"Doc
ker-OpenNMT-
ctranslate","type":"NMT"}},"service":"Translate_en_fr","version":"2.0"}],"stepName":"translate
-with-filter"},{"routes":[{"profileId":"e00bfc3c-b36c-453c-ad34-
43f0b191ea1d","queue":"575cec93-7581-4fee-a315-
6808e77ef99c","service":"Filter","version":"2.0"}],"stepName":"filter-
export"}],"stats":{"elapsed_time":113,"nb_characters":20,"nb_tokens":0,"nb_tus":1,"nb_tus_fail
ed":0}}
--1b28b5eb13ca11dc3238ef1f0a46d90a5a13fdd5
part-name: output

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
C'est un chien <b>noir</b>.</html>

--1b28b5eb13ca11dc3238ef1f0a46d90a5a13fdd5--

For synchronous with either withSource or withInfo parameter:


more example.html
<html>This is a <b>black</b> dog.</html>

http -v POST <SPNS Gateway URL>/translation/file/translate key==<API key> source==en


target==fr withInfo==true rawBody==true @example.html

POST /translation/file/translate?key=<API key>&target=fr&withInfo=true&rawBody=true HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: text/html
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

<html>This is a <b>black</b> dog.</html>

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 1350
Content-Type: multipart/mixed; boundary="c4840f2ba76f8d1afa0d82dab194fedc0a212461"
Date: Thu, 20 Dec 2018 00:18:07 GMT
Vary: X-HTTP-Method-Override

--c4840f2ba76f8d1afa0d82dab194fedc0a212461
part-name: info

{"lid":{"confidence":0.7557401657104492,"language":"en"},"selected_routes":[{"routes":[{"profi
leId":"e00bfc3c-b36c-453c-ad34-43f0b191ea1d","queue":"575cec93-7581-4fee-a315-

SYSTRAN Pure Neural® Server REST API 28


6808e77ef99c","service":"Filter","version":"2.0"}],"stepName":"filter-
import"},{"routes":[{"profileId":"12450906-5560-4bb1-aed6-
1d938a8f3c26","queue":"flow","selectors":{"domain":"Generic","owner":"Systran","size":"M","tec
h":{"name":"Docker-OpenNMT-
ctranslate","type":"NMT"}},"service":"Translate_en_fr","version":"2.0"},{"profileId":"b5cabe50
-43d5-4cc9-8bf7-06ecb63f38d2","queue":"b8efe929-c7ab-48bb-a5e2-
98075ef99031","selectors":{"domain":"Generic","owner":"Systran","size":"M","tech":{"name":"Doc
ker-OpenNMT-
ctranslate","type":"NMT"}},"service":"Translate_en_fr","version":"2.0"}],"stepName":"translate
-with-filter"},{"routes":[{"profileId":"e00bfc3c-b36c-453c-ad34-
43f0b191ea1d","queue":"575cec93-7581-4fee-a315-
6808e77ef99c","service":"Filter","version":"2.0"}],"stepName":"filter-
export"}],"stats":{"elapsed_time":117,"nb_characters":20,"nb_tokens":0,"nb_tus":1,"nb_tus_fail
ed":0}}
--c4840f2ba76f8d1afa0d82dab194fedc0a212461
part-name: output

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
C'est un chien <b>noir</b>.</html>

--c4840f2ba76f8d1afa0d82dab194fedc0a212461--

Examples
Synchronous HTML file translation (auto->French) with information
more example.html
<html>This is a <b>black</b> dog.</html>

http -v POST <SPNS Gateway URL>/translation/file/translate key==<API key> target==fr


withInfo==true rawBody==true @example.html

POST /translation/file/translate?key=<API key>&target=fr&withInfo=true&rawBody=true HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: text/html
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

<html>This is a <b>black</b> dog.</html>

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 1350
Content-Type: multipart/mixed; boundary="184b3cd7fd5e3640f8f3e00cf76e1039199203d5"
Date: Thu, 20 Dec 2018 00:30:07 GMT
Vary: X-HTTP-Method-Override

--184b3cd7fd5e3640f8f3e00cf76e1039199203d5
part-name: info

{"lid":{"confidence":0.7557401657104492,"language":"en"},"selected_routes":[{"routes":[{"profi
leId":"e00bfc3c-b36c-453c-ad34-43f0b191ea1d","queue":"575cec93-7581-4fee-a315-
6808e77ef99c","service":"Filter","version":"2.0"}],"stepName":"filter-

SYSTRAN Pure Neural® Server REST API 29


import"},{"routes":[{"profileId":"12450906-5560-4bb1-aed6-
1d938a8f3c26","queue":"flow","selectors":{"domain":"Generic","owner":"Systran","size":"M","tec
h":{"name":"Docker-OpenNMT-
ctranslate","type":"NMT"}},"service":"Translate_en_fr","version":"2.0"},{"profileId":"b5cabe50
-43d5-4cc9-8bf7-06ecb63f38d2","queue":"b8efe929-c7ab-48bb-a5e2-
98075ef99031","selectors":{"domain":"Generic","owner":"Systran","size":"M","tech":{"name":"Doc
ker-OpenNMT-
ctranslate","type":"NMT"}},"service":"Translate_en_fr","version":"2.0"}],"stepName":"translate
-with-filter"},{"routes":[{"profileId":"e00bfc3c-b36c-453c-ad34-
43f0b191ea1d","queue":"575cec93-7581-4fee-a315-
6808e77ef99c","service":"Filter","version":"2.0"}],"stepName":"filter-
export"}],"stats":{"elapsed_time":115,"nb_characters":20,"nb_tokens":0,"nb_tus":1,"nb_tus_fail
ed":0}}
--184b3cd7fd5e3640f8f3e00cf76e1039199203d5
part-name: output

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
C'est un chien <b>noir</b>.</html>

--184b3cd7fd5e3640f8f3e00cf76e1039199203d5--

Asynchronous HTML file translation from auto to French


more example.html
<html>This is a <b>black</b> dog.</html>

http -v POST <SPNS Gateway URL>/translation/file/translate key==<API key> target==fr


async==true rawBody==true @example.html

POST /translation/file/translate?key=<API key>&target=fr&async=true&rawBody=true HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: text/html
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

<html>This is a <b>black</b> dog.</html>

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 41
Date: Thu, 20 Dec 2018 18:23:18 GMT
Vary: X-HTTP-Method-Override

{"requestId":"5c1bde165d634ab2e5c331ea"}

Translation File Status


Check the file translation status for an asynchronous translation.

Translation File Status Calling Style


The specific format to get the status of an asynchronous file translation request is:

SYSTRAN Pure Neural® Server REST API 30


GET <SPNS Gateway URL>/translation/file/status?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• requestId

All other request parameters are optional.

Translation File Status Request Parameters


The Translation File Status request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Status Parameters


Parameter Mandatory Default Description
key yes API key for service.
requestId yes Request identifier provided by initial translation request.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/file/status?key=<API key>&requestId=<request identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "An error occured",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
},
"batchId": "54a3d860e62ea467b136eddb",
"cancelled": true,
"createdAt": 1242234432,
"description": "success",
"expireAt": 1242234900,
"finishedAt": 0,
"finishedSteps": 3,

SYSTRAN Pure Neural® Server REST API 31


"status": "registered",
"totalSteps": 6
}

The status can be one of the following values.

• registered
• import
• started
• export
• finished
• error

The import status refers to the initial processing within the Filter translator resource (TR) to put the incoming text
or document in a standardized form (a specialized XML format). The started status refers to the translation by a
language-pair-specific TR (for example, RU/EN). The export status refers to the post-translation step of
converting the translate results from the intermediate standardized form (XML), back to the original source form
(Word DOCX, Excel XLSX, HTML, plain text, and so forth). The translation result is available when the value of the
status field is finished. The translation request is unsuccessful when the value of the status field is error.

Examples
Check asynchronous file translation status
http -v GET <SPNS Gateway URL>/translation/file/status key==<API key> requestId==<request
identifier>

GET /translation/file/status?key=<API key> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"requestId": "5c1bde165d634ab2e5c331ea"
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 278
Content-Type: application/json; charset=utf-8
Date: Thu, 20 Dec 2018 18:31:43 GMT
Vary: Accept-Encoding

{
"cancelled": false,
"createdAt": 1545330198944,
"description": "",
"expireAt": 1545348199096,
"failedSteps": 0,
"finishedAt": 1545330199096,
"finishedSteps": 1,

SYSTRAN Pure Neural® Server REST API 32


"paused": false,
"status": "finished",
"statusHistory": [
"pending",
"registered",
"import",
"started",
"export",
"finished"
],
"totalSteps": 1
}

Translation File Result


Retrieve the file translation results for an asynchronous translation.

Translation File Result Calling Style


The specific format to get the results of an asynchronous file translation request is:

GET <SPNS Gateway URL>/translation/file/result?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• requestId

All other request parameters are optional.

Translation File Result Request Parameters


The Translation File Result request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Result Parameters


Parameter Mandatory Default Description
key yes API key for service.
requestId yes Request identifier provided by initial translation request.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/file/result?key=<API key>&requestId=<request identifier>

Response
HTTP Status Code

SYSTRAN Pure Neural® Server REST API 33


If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be the translated document directly:

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
C'est un chien <b>noir</b>.</html>

Examples
Retrieve asynchronous file translation results
http -v GET <SPNS Gateway URL>/translation/file/result key==<API key> requestId==<request
identifier>

GET /translation/file/result?key=<API key> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"requestId": "5c1bde165d634ab2e5c331ea"
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 110
Date: Thu, 20 Dec 2018 18:32:56 GMT

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
C'est un chien <b>noir</b>.</html>

Translation File Cancel


Cancel an asynchronous translation.

Translation File Cancel Calling Style


The specific format to cancel an asynchronous file translation request is:

GET <SPNS Gateway URL>/translation/file/cancel?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

SYSTRAN Pure Neural® Server REST API 34


• key
• requestId

All other request parameters are optional.

Translation File Cancel Request Parameters


The Translation File Cancel request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Cancel Parameters


Parameter Mandatory Default Description
key yes API key for service.
requestId yes Request identifier provided by initial translation request.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/file/cancel?key=<API key>&requestId=<request identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "An error occured",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
}
}

Examples
Cancel asynchronous file translation
http -v GET <SPNS Gateway URL>}/translation/file/cancel key==<API key> requestId==<request
identifier>

GET /translation/file/cancel?key=<API key> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

SYSTRAN Pure Neural® Server REST API 35


{
"requestId": "5c1bde165d634ab2e5c331ea"
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 15
Content-Type: application/json; charset=utf-8
Date: Thu, 20 Dec 2018 18:37:05 GMT
Vary: Accept-Encoding

{
"cancel": true
}

Translation File Batch Create


Create a new translation batch, to which asynchronous Translation File Translate requests (those where the
async parameter is true) can be associated. A batch is useful to follow up simultaneously on several translation
requests.

Translation File Batch Create Calling Style


The specific format to create a batch of file translation requests is:

POST <SPNS Gateway URL>/translation/file/batch/create?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Translation File Batch Create Request Parameters


The Translation File Batch Create request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Batch Create Parameters


Parameter Mandatory Default Description
key yes API key for service.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

SYSTRAN Pure Neural® Server REST API 36


POST <SPNS Gateway URL>/translation/file/batch/create?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"batchId": "54a3d860e62ea467b136eddb",
"error": {
"message": "An error occured",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
}
}

Examples
Create translation batch
http -v POST <SPNS Gateway URL>/translation/file/batch/create key==<API key>

POST /translation/file/batch/create?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 39
Content-Type: application/json; charset=utf-8
Date: Thu, 20 Dec 2018 18:52:32 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"batchId": "5c1be4f05d634ab2e5c331ee"
}

Translation File Batch Status


Check the status of the translation requests for a translation batch.

SYSTRAN Pure Neural® Server REST API 37


Translation File Batch Status Calling Style
The specific format to return the status of a translation file batch request is:

GET <SPNS Gateway URL>/translation/file/batch/status?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• batchId

All other request parameters are optional.

Translation File Batch Status Request Parameters


The Translation File Batch Status request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Batch Status Parameters


Parameter Mandatory Default Description
key yes API key for service.
batchId yes Batch identifier provided by initial batch creation request.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/file/batch/status?key=<API key>&batchId=<batch identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"cancelled": false,
"closed": false,
"createdAt": 1242234432,
"expireAt": 1242234900,
"finishedAt": 1242234700,
"requests": [
{
"id": "54a3d860e62ea467b136eddb",
"status": "pending"
}
],

SYSTRAN Pure Neural® Server REST API 38


"error": {
"message": "An error occurred",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
}
}

Examples
Check file batch status after associating asynchronous file translation
http -v GET <SPNS Gateway URL>/translation/file/batch/status key==<API key>
batchId==5c1be4f05d634ab2e5c331ee

GET /translation/file/batch/status?key=<API key>&batchId=5c1be4f05d634ab2e5c331ee HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 111
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 18:12:37 GMT
Vary: Accept-Encoding

{
"cancelled": false,
"closed": false,
"createdAt": 1545331952442.0,
"expireAt": null,
"finishedAt": null,
"requests": []
}

Translation File Batch Close


Check the file translation status for an asynchronous translation.

Translation File Batch Close Calling Style


The specific format to close a translation file batch is:

POST <SPNS Gateway URL>/translation/file/status?<parameters>

where <parameters> are any parameters to apply to the query.

SYSTRAN Pure Neural® Server REST API 39


The following parameters are required for each request:

• key
• batchId

All other request parameters are optional.

Translation File Batch Close Request Parameters


The Translation File Batch Close request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Batch Close Parameters


Parameter Mandatory Default Description
key yes API key for service.
batchId yes Batch identifier provided by initial batch creation request.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/translation/file/batch/close?key=<API key>&batchId=<batch identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"status": "finished",
"error": {
"message": "An error occurred",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
}
}

Examples
Close translation file batch
http -v GET <SPNS Gateway URL>/translation/file/batch/close key==<API key>
batchId==5c1be4f05d634ab2e5c331ee

GET /translation/file/batch/close?key=<API key>&batchId=5c1be4f05d634ab2e5c331ee HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive

SYSTRAN Pure Neural® Server REST API 40


Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 16
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 18:13:31 GMT
Vary: Accept-Encoding

{
"status": "ok"
}

Translation File Batch Cancel


Cancel an asynchronous translation batch, which includes all ongoing translation requests.

Translation File Batch Cancel Calling Style


The specific format to cancel a translation file batch is:

POST <SPNS Gateway URL>/translation/file/batch/cancel?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• batchId

All other request parameters are optional.

Translation File Batch Cancel Request Parameters


The Translation File Batch Cancel request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Batch Cancel Parameters


Parameter Mandatory Default Description
key yes API key for service.
batchId yes Batch identifier provided by initial batch creation request.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

SYSTRAN Pure Neural® Server REST API 41


POST <SPNS Gateway URL>/translation/file/batch/cancel?key=<API key>&batchId=<batch identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"status": "cancelled",
"error": {
"message": "An error occurred",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
}
}

Examples
Cancel translation file batch
http -v POST <SPNS Gateway URL>/translation/file/batch/cancel key==<API key>
batchId==5c2668387fdd33aa3c943c1c

POST /translation/file/batch/cancel?key=<API key>&batchId=5c2668387fdd33aa3c943c1c HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 16
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 18:15:41 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"status": "ok"
}

Translation Supported Languages


Check the file translation status for an asynchronous translation.

SYSTRAN Pure Neural® Server REST API 42


Translation Supported Languages Calling Style
The specific format to return the list of translation language codes is:

GET <SPNS Gateway URL>/translation/supportedLanguages?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Translation Supported Languages Request Parameters


The Translation Supported Languages request parameters you can use with the SPNS REST API are summarized
in the following table.

Translation Supported Languages Parameters


Parameter Mandatory Default Description
key yes API key for service.
source no Language code of the source.
target no Language code of the target.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/supportedLanguages?key=<API key>&source=<source language>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "An error occurred",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
},
"languagePairs": [
{
"source": "en",
"target": "fr",

SYSTRAN Pure Neural® Server REST API 43


"profiles": [
{
"id": 4,
"private": true
}
]
}
]
}

Examples
List all supported languages
http -v GET <SPNS Gateway URL>/translation/supportedLanguages key==<API key>

GET /translation/supportedLanguages?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:19:12 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"languagePairs": [
{
"profiles": [
{
"id": "470179ac-fec2-4f1e-8572-2ee0724bd517",
"private": false
}
],
"source": "zh-Hant",
"target": "en"
},
{
"profiles": [
{
"id": "18822479-2691-44e2-8936-b5e93f1f69c5",
"private": false
}
],
"source": "ko",
"target": "en"
},
{
"profiles": [

SYSTRAN Pure Neural® Server REST API 44


{
"id": "4f465e8f-b54f-4ed1-a428-21f05fc5f101",
"private": false
}
],
"source": "it",
"target": "en"
},
{
"profiles": [
{
"id": "48bf08ff-339b-4bd8-aede-100ae8ef306a",
"private": false
}
],
"source": "ja",
"target": "en"
},
{
"profiles": [
{
"id": "925f5cfa-2238-4431-835c-572dc6249e62",
"private": false
},
{
"id": "3f842316-17a2-43c8-8951-091236a21c19",
"private": false
}
],
"source": "fr",
"target": "en"
},
{
"profiles": [
{
"id": "d9fb63e9-e363-462f-9508-c18b6cd08e52",
"private": false
}
],
"source": "es",
"target": "en"
},
{
"profiles": [
{
"id": "59f003f5-28fe-43f9-8d31-56de7b5e9837",
"private": false
}
],
"source": "en",
"target": "ru"
},
{
"profiles": [
{
"id": "25d93f69-3b1c-4a7e-9a09-2150d8816b9b",
"private": false
}
],
"source": "en",
"target": "zh-Hans"

SYSTRAN Pure Neural® Server REST API 45


},
{
"profiles": [
{
"id": "3b3ba5ff-e7ed-4f83-b73c-74bc3b973152",
"private": false
}
],
"source": "pl",
"target": "en"
},
{
"profiles": [
{
"id": "0240310b-a657-4ca0-8916-a6bd779de7c5",
"private": false
}
],
"source": "de",
"target": "en"
},
{
"profiles": [
{
"id": "ad2edbc3-e512-4605-9629-11c14b64da64",
"private": false
}
],
"source": "ar",
"target": "en"
},
{
"profiles": [
{
"id": "6020f26a-f2f0-4f7e-8c3a-cf78ae26d9d3",
"private": false
}
],
"source": "pt",
"target": "en"
},
{
"profiles": [
{
"id": "4ceb0c13-0ee6-4439-b72a-a1c98ca8381f",
"private": false
}
],
"source": "en",
"target": "ja"
},
{
"profiles": [
{
"id": "207425a5-3cb3-4c12-80e7-541558a0cfcd",
"private": false
}
],
"source": "zh-Hans",
"target": "en"
},

SYSTRAN Pure Neural® Server REST API 46


{
"profiles": [
{
"id": "49ff6960-7c47-414f-a9d8-29234086c81c",
"private": false
}
],
"source": "en",
"target": "de"
},
{
"profiles": [
{
"id": "aae0e03a-041f-47a0-a88b-85e137ecc7a5",
"private": false
},
{
"id": "12450906-5560-4bb1-aed6-1d938a8f3c26",
"private": false
},
{
"id": "da3d5335-8c22-40c1-9434-cb69252285e1",
"private": false
}
],
"source": "en",
"target": "fr"
},
{
"profiles": [
{
"id": "7d99baca-e0bf-49b2-b2e3-30676f18f3ac",
"private": false
}
],
"source": "ru",
"target": "en"
},
{
"profiles": [
{
"id": "8c6e57ca-000a-4ab1-9954-cbb0ae58773e",
"private": false
}
],
"source": "en",
"target": "zh-Hant"
},
{
"profiles": [
{
"id": "7e292a51-7660-4856-b44f-9027883eca98",
"private": false
}
],
"source": "ja",
"target": "ko"
}
]
}

SYSTRAN Pure Neural® Server REST API 47


List supported languages with French source
http -v GET <SPNS Gateway URL>/translation/supportedLanguages key==<API key> source==fr

GET /translation/supportedLanguages?key=<API key>&source=fr HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 186
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:22:24 GMT
Vary: Accept-Encoding

{
"languagePairs": [
{
"profiles": [
{
"id": "925f5cfa-2238-4431-835c-572dc6249e62",
"private": false
},
{
"id": "3f842316-17a2-43c8-8951-091236a21c19",
"private": false
}
],
"source": "fr",
"target": "en"
}
]
}

Translation Supported Formats


Retrieve the list of supported file formats for translations. The listing includes input format and output format. In
almost all cases the input and output formats are the same. The main exception is “PDF” input format, which is
provided in “DOCX” output. Some of the formats are internal to SYSTRAN, and may be ignored.

Translation Supported Format Status Calling Style


The specific format to return the list of translation document formats is:

GET <SPNS Gateway URL>/translation/supportedFormats?<parameters>

where <parameters> are any parameters to apply to the query.

SYSTRAN Pure Neural® Server REST API 48


The following parameter is required for each request:

• key

All other request parameters are optional.

Translation Supported Formats Request Parameters


The Translation Supported Formats request parameters you can use with the SPNS REST API are summarized in
the following table.

Translation Supported Formats Parameters


Parameter Mandatory Default Description
key yes API key for service.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/supportedFormats?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"formats": [
{
"mimetypes": {
"input": "text/bitext",
"output": "text/bitext"
},
"name": "bitext"
}
]
}

Examples
List supported formats
http -v GET <SPNS Gateway URL>/translation/supportedFormats key==<API key>

GET /translation/supportedFormats?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

SYSTRAN Pure Neural® Server REST API 49


HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:23:09 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"formats": [
{
"mimetypes": {
"input": "application/vnd.android.string-resource+xml",
"output": "application/vnd.android.string-resource+xml"
},
"name": "android"
},
{
"mimetypes": {
"input": "text/bitext",
"output": "text/bitext"
},
"name": "bitext"
},
{
"mimetypes": {
"input": "application/vnd.systran.document+boost",
"output": "application/vnd.systran.document+boost"
},
"name": "systran document (serialized boost)"
},
{
"mimetypes": {
"input": "text/html-old",
"output": "text/html-old"
},
"name": "old html"
},
{
"mimetypes": {
"input": "text/html",
"output": "text/html"
},
"name": "html"
},
{
"mimetypes": {
"input": "application/xhtml+xml",
"output": "application/xhtml+xml"
},
"name": "xhtml"
},
{
"mimetypes": {
"input": "application/vnd.jquery.globalize+json",
"output": "application/vnd.jquery.globalize+json"

SYSTRAN Pure Neural® Server REST API 50


},
"name": "jquery globalize"
},
{
"mimetypes": {
"input": "application/vnd.systran.document+json",
"output": "application/vnd.systran.document+json"
},
"name": "systran document (json)"
},
{
"mimetypes": {
"input": "application/vnd.systran.i18n+json",
"output": "application/vnd.systran.i18n+json"
},
"name": "json i18n"
},
{
"mimetypes": {
"input": "application/x-gettext",
"output": "application/x-gettext"
},
"name": "gettext po"
},
{
"mimetypes": {
"input": "text/x-java-properties",
"output": "text/x-java-properties"
},
"name": "java properties"
},
{
"mimetypes": {
"input": "application/vnd.microsoft.net.resx+xml",
"output": "application/vnd.microsoft.net.resx+xml"
},
"name": "resx"
},
{
"mimetypes": {
"input": "text/rtf",
"output": "text/rtf"
},
"name": "rtf"
},
{
"mimetypes": {
"input": "application/x-tmx+xml",
"output": "application/x-tmx+xml"
},
"name": "tmx"
},
{
"mimetypes": {
"input": "application/vnd.qt.ts+xml",
"output": "application/vnd.qt.ts+xml"
},
"name": "qt ts"
},
{
"mimetypes": {

SYSTRAN Pure Neural® Server REST API 51


"input": "text/plain",
"output": "text/plain"
},
"name": "text"
},
{
"mimetypes": {
"input": "xml/xliff",
"output": "xml/xliff"
},
"name": "internal xliff"
},
{
"mimetypes": {
"input": "xml/xliff2",
"output": "xml/xliff2"
},
"name": "systran document (xliff 2)"
},
{
"mimetypes": {
"input": "application/x-systran-internal+xml",
"output": "application/x-systran-internal+xml"
},
"name": "systran document (internal xml)"
},
{
"mimetypes": {
"input": "application/x-systran-exchange+xml",
"output": "application/x-systran-exchange+xml"
},
"name": "systran document (external xml)"
},
{
"mimetypes": {
"input": "application/x-tmx+xml",
"output": "application/x-tmx+xml"
},
"name": "tmx"
},
{
"mimetypes": {
"input": "application/vnd.openxmlformats",
"output": "application/vnd.openxmlformats"
},
"name": "office 2007"
},
{
"mimetypes": {
"input": "application/vnd.oasis.opendocument",
"output": "application/vnd.oasis.opendocument"
},
"name": "open document"
},
{
"mimetypes": {
"input": "application/pdf",
"output": "application/vnd.openxmlformats"
},
"name": "pdf"
},

SYSTRAN Pure Neural® Server REST API 52


{
"mimetypes": {
"input": "application/msword",
"output": "application/msword"
},
"name": "doc"
},
{
"mimetypes": {
"input": "image/bmp",
"output": "application/vnd.openxmlformats"
},
"name": "bmp"
},
{
"mimetypes": {
"input": "image/jpeg",
"output": "application/vnd.openxmlformats"
},
"name": "jpg"
},
{
"mimetypes": {
"input": "image/jpeg",
"output": "application/vnd.openxmlformats"
},
"name": "jpeg"
},
{
"mimetypes": {
"input": "image/png",
"output": "application/vnd.openxmlformats"
},
"name": "png"
},
{
"mimetypes": {
"input": "image/tiff",
"output": "application/vnd.openxmlformats"
},
"name": "tif"
},
{
"mimetypes": {
"input": "image/tiff",
"output": "application/vnd.openxmlformats"
},
"name": "tiff"
}
]
}

Translation Profiles
Profiles are settings for translation that specify language pairs (source and target languages), domains and other
translation settings.

Translation Profiles Calling Style


The specific format to return the list of translation profiles is:

SYSTRAN Pure Neural® Server REST API 53


GET <SPNS Gateway URL>/translation/profiles?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Translation Profiles Request Parameters


The Translation Profiles request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation Profiles Parameters


Parameter Mandatory Default Description
key yes API key for service.
source no Language code of the source.
target no Language code of the target.
id no Profile identifier.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/translation/profiles?key=<API key>&source=<source language>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "An error occurred",
"info": {
"statusCode": 500,
"message": "Internal Error"
}
},
"profiles": [
{
"id": 4,
"localization": {},
"name": "My Profile",
"source": "en",

SYSTRAN Pure Neural® Server REST API 54


"target": "fr"
}
]
}

Examples
List all translation profiles
http -v GET <SPNS Gateway URL>/translation/profiles key==<API key>

GET /translation/profiles?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:24:14 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"profiles": [
{
"deactivated": false,
"id": "0240310b-a657-4ca0-8916-a6bd779de7c5",
"localization": {},
"name": "Translator DEEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "de",
"target": "en"
},
{
"deactivated": false,
"id": "12450906-5560-4bb1-aed6-1d938a8f3c26",
"localization": {},
"name": "Translator NMT Generic (M) - ENFR",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "M"
},
"source": "en",
"target": "fr"
},
{

SYSTRAN Pure Neural® Server REST API 55


"deactivated": false,
"id": "18822479-2691-44e2-8936-b5e93f1f69c5",
"localization": {},
"name": "Translator KOEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "ko",
"target": "en"
},
{
"deactivated": false,
"id": "207425a5-3cb3-4c12-80e7-541558a0cfcd",
"localization": {},
"name": "Translator ZHEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "zh-Hans",
"target": "en"
},
{
"deactivated": false,
"id": "25d93f69-3b1c-4a7e-9a09-2150d8816b9b",
"localization": {},
"name": "Translator ENZH Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "zh-Hans"
},
{
"deactivated": false,
"id": "3b3ba5ff-e7ed-4f83-b73c-74bc3b973152",
"localization": {},
"name": "Translator PLEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "pl",
"target": "en"
},
{
"deactivated": false,
"id": "3f842316-17a2-43c8-8951-091236a21c19",
"localization": {},
"name": "Translator NMT Generic (M) - FREN",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "M"
},

SYSTRAN Pure Neural® Server REST API 56


"source": "fr",
"target": "en"
},
{
"deactivated": false,
"id": "470179ac-fec2-4f1e-8572-2ee0724bd517",
"localization": {},
"name": "Translator ZTEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "zh-Hant",
"target": "en"
},
{
"deactivated": false,
"id": "48bf08ff-339b-4bd8-aede-100ae8ef306a",
"localization": {},
"name": "Translator JAEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "ja",
"target": "en"
},
{
"deactivated": false,
"id": "49ff6960-7c47-414f-a9d8-29234086c81c",
"localization": {},
"name": "Translator ENDE Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "de"
},
{
"deactivated": false,
"id": "4ceb0c13-0ee6-4439-b72a-a1c98ca8381f",
"localization": {},
"name": "Translator ENJA Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "ja"
},
{
"deactivated": false,
"id": "4f465e8f-b54f-4ed1-a428-21f05fc5f101",
"localization": {},
"name": "Translator ITEN Generic (S)",
"selectors": {

SYSTRAN Pure Neural® Server REST API 57


"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "it",
"target": "en"
},
{
"deactivated": false,
"id": "59f003f5-28fe-43f9-8d31-56de7b5e9837",
"localization": {},
"name": "Translator ENRU Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "ru"
},
{
"deactivated": false,
"id": "6020f26a-f2f0-4f7e-8c3a-cf78ae26d9d3",
"localization": {},
"name": "Translator PTEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "pt",
"target": "en"
},
{
"deactivated": false,
"id": "7d99baca-e0bf-49b2-b2e3-30676f18f3ac",
"localization": {},
"name": "Translator RUEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "ru",
"target": "en"
},
{
"deactivated": false,
"id": "7e292a51-7660-4856-b44f-9027883eca98",
"localization": {},
"name": "Translator JAKO Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "ja",
"target": "ko"
},
{
"deactivated": false,

SYSTRAN Pure Neural® Server REST API 58


"id": "8c6e57ca-000a-4ab1-9954-cbb0ae58773e",
"localization": {},
"name": "Translator ENZT Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "zh-Hant"
},
{
"deactivated": false,
"id": "925f5cfa-2238-4431-835c-572dc6249e62",
"localization": {},
"name": "Translator FREN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "fr",
"target": "en"
},
{
"deactivated": false,
"id": "aae0e03a-041f-47a0-a88b-85e137ecc7a5",
"localization": {},
"name": "Translator ENFR Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "fr"
},
{
"deactivated": false,
"id": "ad2edbc3-e512-4605-9629-11c14b64da64",
"localization": {},
"name": "Translator AREN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "ar",
"target": "en"
},
{
"deactivated": false,
"id": "d9fb63e9-e363-462f-9508-c18b6cd08e52",
"localization": {},
"name": "Translator ESEN Generic (S)",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "es",

SYSTRAN Pure Neural® Server REST API 59


"target": "en"
},
{
"deactivated": false,
"id": "da3d5335-8c22-40c1-9434-cb69252285e1",
"localization": {},
"name": "Translator ENFR ZH-CN",
"selectors": {
"domain": "ZH-CN",
"owner": "Systran",
"size": "S"
},
"source": "en",
"target": "fr"
}
]
}

List all translation profiles with French source


http -v GET <SPNS Gateway URL>/translation/profiles key==<API key> source==fr

GET /translation/profiles?key=<API key>&source=fr HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 442
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:25:05 GMT
Vary: Accept-Encoding

{
"profiles": [
{
"deactivated": false,
"id": "3f842316-17a2-43c8-8951-091236a21c19",
"localization": {},
"name": "Translator NMT Generic (M) - FREN",
"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "M"
},
"source": "fr",
"target": "en"
},
{
"deactivated": false,
"id": "925f5cfa-2238-4431-835c-572dc6249e62",
"localization": {},
"name": "Translator FREN Generic (S)",

SYSTRAN Pure Neural® Server REST API 60


"selectors": {
"domain": "Generic",
"owner": "Systran",
"size": "S"
},
"source": "fr",
"target": "en"
}
]
}

Translation Feedback Add


Add translation feedback, which includes the source text, actual and recommended translation with optional
severity and comments. The feedback appears in the SPNS console under the Feedback feature.

Translation Feedback Add Calling Style


The specific format to add translation feedback is:

POST <SPNS Gateway URL>/translation/feedback/add?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• sourceText
• targetText
• target

All other request parameters are optional.

Translation Feedback Add Parameters


The Translation Feedback Add request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation Feedback Add Parameters


Parameter Mandatory Default Description
key yes API key for service.
sourceText yes Source text.
targetText yes Target text.
source yes Source text language code.
target yes Target text language code.
status no Feedback status (new, in-progress, resolved, closed or
rejected).
problemSeverity no Problem severity (trivial, minor, normal, major, critical or
blocker).
translationRating no Translation rating (incomprehensible, disfluent, non-
native, good or flawless).
suggestedTranslation no Suggested translation.
comment no Comment regarding suggestion.

SYSTRAN Pure Neural® Server REST API 61


Parameter Mandatory Default Description
profile no Profile identifier (or “ID”).
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/translation/feedback/add?key=<API key>&sourceText=<source


text>&targetText=<target text>&target=<target language code>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": { /* Error at request level */
"message": "string", /* Readable description of the error */
"statusCode": "integer",
"info": { /* Additional information about the error */
}
},
"feedbackId": "string" /* Feedback identifier */
}

Examples
Translation feedback add
http -v POST <SPNS Gateway URL>/translation/feedback/add key==<API key> source==en target==fr
sourceText=="Sample source text" targetText=="Exemple de texte source" status==new
problemServerity==minor suggesedTranslation=="Exemple texte source" comment=="Example comment"

POST /translation/feedback/add?key=<API
key>&source=en&target=fr&sourceText=Sample+source+text&targetText=Exemple+de+texte+source&stat
us=new&problemServerity=minor&suggesedTranslation=Exemple+texte+source&comment=Example+comment
HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: ssi-pnmt-benchmark-01.systran.us:8904
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive

SYSTRAN Pure Neural® Server REST API 62


Content-Length: 41
Content-Type: application/json; charset=utf-8
Date: Fri, 04 Jan 2019 00:15:19 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"feedbackId": "5c2ea597bb71e1148e5ef7d9"
}

Language Detection API Version


Retrieve the API version for the NLP/LID REST API.

Language Detection API Version Calling Style


The specific format to return the API version is:

GET <SPNS Gateway URL>/nlp/lid/apiVersion?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Language Detection API Version Request Parameters


The Language Detection API Version request parameters you can use with the SPNS REST API are summarized in
the following table.

Language Detection API Version Parameters


Parameter Mandatory Default Description
key yes API key for service.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/nlp/lid/apiVersion?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"version": "1.0.0"

SYSTRAN Pure Neural® Server REST API 63


}

Examples
Get API version for Language Detection REST API
http -v GET <SPNS Gateway URL>/nlp/lid/apiVersion key==<API key>

GET /nlp/lid/apiVersion?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 19
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:26:02 GMT
Vary: Accept-Encoding

{
"version": "1.0.0"
}

Language Detection Document


Language detection identifies the language based on text provided and returns the identified language code and
confidence. This is a statistical analysis based on the script (Latin, Cyrillic, Ideographic and Arabic) and the
content. Detection is typically more accurate with more text. A few words or less may not be accurately
identified, and text with a mixture of languages (for example, French with some English words or phrases) can be
a challenge. Finally, some languages are quite similar (for example, Norwegian, Swedish, Dutch and Danish, or
Catalan and Spanish) and can be difficult to distinguish.

Language Detection Calling Style


The specific format to detect the language of a text is:

POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• input

All other request parameters are optional.

SYSTRAN Pure Neural® Server REST API 64


Language Detection Request Parameters
The Language Detection request parameters you can use with the SPNS REST API are summarized in the
following table.

Language Detection Parameters


Parameter Mandatory Default Description
key yes API key for service.
input yes Text to identify the language. Multiple input parameters
can be specified.
inputFile no Input file in form data.
format no auto Format of the source text. Valid values are text for plain
text, html for HTML pages, and auto for automatic
detection. The MIME type of file format supported by
SYSTRAN can also be used
(application/vnd.openxmlformats,
application/vnd.oasis.opendocument, ...).
rawBody no false The text to translate can be sent in body of the requests, all
the other parameters can be sent as query string
parameters. In the latter, the translated text will be sent
back in the body of the response message.
encoding no utf-8 Encodings can be base64 or utf-8. base64 can be useful to
send binary document in the JSON body. Please note that
another alternative is to use the rawBody parameter.
callback no JavaScript callback function for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document?key=<API key>&input=<input text


1>&input=<input text 2>

Request with Query String Parameters and a JSON Body


You can call the SPNS REST API by passing some parameters in the query string format and other parameters
through a JSON document to be sent in the body of the request.

Caution
A parameter cannot be defined more than once. For example, if the source parameter is defined
in the Request Body it cannot be defined in the URL (and vice-versa).

POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document?key=<API key>

Request Header

Content-Type: application/json

Request Body

SYSTRAN Pure Neural® Server REST API 65


{
"input": [
"text1",
"text2",
...
]
}

Request with the document to analyze in body of the request (rawBody mode)
You can call the SPNS REST API by passing all the parameters except input parameters in the query string format.
If you use the rawBody=true option, you can send the document to analyze in the body of the request directly.

POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document?key=<API key>&rawBody=true <filename>

If you use the withSource=true option, the response will be a multipart document, with the first part for the
source document, and the second part for the translated document.

Request with the document to analyze in body of the request (form data mode)
You can call the SPNS REST API by passing all the parameters except input parameters in the query string format.
The input data may be included as form data.

POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document?key=<API key> <filename>

If you use the withSource=true option, the response will be a multipart document, with the first part for the
source document, and the second part for the translated document.

Restrictions
• The requested URL, including parameters, must be less than 2K bytes.
• An element of the input array in the request body must be less than 5K bytes.
• The input arrays must have less than 1000 elements.

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": "", /* Error at request level */
"detectedLanguages": [
{
"lang": "en",
"confidence": 0.8728542923927307
},
{
"lang": "nl",
"confidence": 0.06847826391458511
},

SYSTRAN Pure Neural® Server REST API 66


{
"lang": "fr",
"confidence": 0.06717391312122345
}
}

Examples
Language detection of text
http -v POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document key==<API key> input=="Hello
and good day to you"

POST /nlp/lid/detectLanguage/document?key=<API key>&input=Hello+and+good+day+to+you HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 69
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:47:42 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"detectedLanguages": [
{
"confidence": 0.7850329279899597,
"lang": "en"
}
]
}

Language detection of file (rawBody mode)


http -v POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document key==<API key> rawBody==true
@example.docx

POST /nlp/lid/detectLanguage/document?key=<API key>&rawBody=true HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 11497
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

+-----------------------------------------+
| NOTE: binary data not shown in terminal |

SYSTRAN Pure Neural® Server REST API 67


+-----------------------------------------+

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 69
Date: Fri, 28 Dec 2018 19:48:40 GMT
Vary: X-HTTP-Method-Override

{"detectedLanguages":[{"lang":"en","confidence":0.7557401657104492}]}

Language detection of file (form data mode)


http --form POST <SPNS Gateway URL>/nlp/lid/detectLanguage/document key==<API key>
inputFile@example.docx

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 69
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:50:35 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"detectedLanguages": [
{
"confidence": 0.7557401657104492,
"lang": "en"
}
]
}

Language Detection Supported Formats


Retrieve the list of supported file formats for language detection. The listing includes input format and output
format. In almost all cases the input and output formats are the same. The main exception is “PDF” input format,
which is provided in “DOCX” output. Some of the formats are internal to SYSTRAN, and may be ignored.

Language Detection Supported Format Status Calling Style


The specific format to return the list of language detection document formats is:

GET <SPNS Gateway URL>/nlp/lid/supportedFormats?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

SYSTRAN Pure Neural® Server REST API 68


All other request parameters are optional.

Language Detection Supported Formats Request Parameters


The Language Detection Supported Formats request parameters you can use with the SPNS REST API are
summarized in the following table.

Language Detection Supported Formats Parameters


Parameter Mandatory Default Description
key yes API key for service.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/nlp/lid/supportedFormats?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"formats": [
{
"mimetypes": {
"input": "text/bitext",
"output": "text/bitext"
},
"name": "bitext"
}
]
}

Examples
List supported formats
http -v GET <SPNS Gateway URL>/nlp/lid/supportedFormats key==<API key>

GET /nlp/lid/supportedFormats?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK

SYSTRAN Pure Neural® Server REST API 69


Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:52:14 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"formats": [
{
"mimetype": "application/vnd.android.string-resource+xml",
"name": "Android string-resource xml"
},
{
"mimetype": "text/bitext",
"name": "Bitext"
},
{
"mimetype": "application/vnd.openxmlformats-
officedocument.wordprocessingml.document",
"name": "Word document (docx xml)"
},
{
"mimetype": "text/html",
"name": "HTML"
},
{
"mimetype": "application/xhtml+xml",
"name": "XHTML"
},
{
"mimetype": "application/vnd.jquery.globalize+json",
"name": "JQuery globalize"
},
{
"mimetype": "application/vnd.systran.document+json",
"name": "SYSTRAN document (json)"
},
{
"mimetype": "application/vnd.systran.i18n+json",
"name": "JSON i18n"
},
{
"mimetype": "application/x-gettext",
"name": "Gettext po"
},
{
"mimetype": "text/x-java-properties",
"name": "Java properties"
},
{
"mimetype": "application/vnd.microsoft.net.resx+xml",
"name": "Resx"
},
{
"mimetype": "text/rtf",
"name": "RTF"
},

SYSTRAN Pure Neural® Server REST API 70


{
"mimetype": "application/vnd.qt.ts+xml",
"name": "Qt ts"
},
{
"mimetype": "text/plain",
"name": "Plain text"
},
{
"mimetype": "xml/xliff",
"name": "SYSTRAN document (internal xliff)"
},
{
"mimetype": "xml/xliff2",
"name": "SYSTRAN document (xliff 2)"
},
{
"mimetype": "application/x-systran-internal+xml",
"name": "SYSTRAN document (internal xml)"
},
{
"mimetype": "application/x-systran-exchange+xml",
"name": "SYSTRAN document (external xml)"
},
{
"mimetype": "application/x-tmx+xml",
"name": "TMX"
},
{
"mimetype": "application/vnd.openxmlformats",
"name": "Office 2007"
},
{
"mimetype": "application/vnd.oasis.opendocument",
"name": "Open document"
},
{
"mimetype": "application/vnd.oasis.opendocument+xml",
"name": "XML open document"
}
]
}

Resources Dictionary API Version


Retrieve the API version for the Resources/Dictionary REST API.

Resources Dictionary API Version Calling Style


The specific format to return the API version is:

GET <SPNS Gateway URL>/resources/dictionary/apiVersion?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

SYSTRAN Pure Neural® Server REST API 71


• key

Resources Dictionary API Version Request Parameters


The Resources Dictionary API Version request parameters you can use with the SPNS REST API are summarized
in the following table.

Resources Dictionary API Version Parameters


Parameter Mandatory Default Description
key yes API key for service.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/dictionary/apiVersion?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"version": "1.0.0"
}

Examples
Get API version for Resources Dictionary REST API
http -v GET <SPNS Gateway URL>/resources/dictionary/apiVersion key==<API key>

GET /resources/dictionary/apiVersion?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 19
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:58:26 GMT
Vary: Accept-Encoding

SYSTRAN Pure Neural® Server REST API 72


{
"version": "1.0.0"
}

Resources Dictionary List


Retrieve the list of dictionaries installed. The list includes standard dictionaries included with SPNS as well as
custom ones too.

Resources Dictionary List Calling Style


The specific format to return the list of dictionaries is:

POST <SPNS Gateway URL>/resources/dictionary/list?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Resources Dictionary List Request Parameters


The Resources Dictionary List request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Dictionary List Status Parameters


Parameter Mandatory Default Description
key yes API key for service.
filters no Different filters that can be applied to the list functionality
(skip/limit/sort/match).

The dictionary filters provide control over the dictionary information returned in the list. A sample filter (always in
JSON form) is shown below. The aspects of the filter are as follows.

• Overall
• Sort
• Match

{
"skip": 1,
"limit": 3,
"sort": {
"nbEntries": 1,
"comments": -1,
"name": 1,
"sourceLang": -1,
"targetLangs": 1
},
"match": {
"inSourceLang": [

SYSTRAN Pure Neural® Server REST API 73


"en",
"fr"
],
"ninSourceLang": [
"nl"
],
"inTargetLangs": [
"en",
"fr"
],
"regexComments": "My",
"inNbEntries": [
0
],
"ninNbEntries": [
10
],
"minNbEntries": 0,
"maxNbEntries": 0,
"inName": [
"My Dictionary NORM",
"My Dictionary 2",
"My new dictionary enfr 2"
],
"ninName": [
"Something"
],
"inType": [
"NORM",
"UD"
],
"ninType": [
"UNKNOWN"
]
}
}

In the following tables are the parameters for each filter aspect. All of the parameters are optional.

Overall Filter Parameters


Parameter Description
skip Number of dictionaries to skip before including the
remainder on the list.
limit Limit number of dictionaries listed to specified number.

Sort Filter Parameters


Parameter Description
nbEntries 1/-1 for ascending/descending order on nbEntries field =
['1', '-1'].
comments -1 for ascending/descending order on comments field = ['1',
'-1'].
name 1/-1 for ascending/descending order on name field = ['1', '-
1'].

SYSTRAN Pure Neural® Server REST API 74


Parameter Description
sourceLang 1/-1 for ascending/descending order on sourceLang field =
['1', '-1'].
targetLangs 1/-1 for ascending/descending order on targetLangs field =
['1', '-1'].

Match Sort Filter Parameters


Parameter Description
inSourceLang Match all dictionaries with sourceLang present in a subset
of values.
ninSourceLang Match all dictionaries with sourceLang not present in a
subset of values.
inTargetLangs Match all dictionaries with targetLang from a subset of
values present in targetLangs property.
regexComments Match all entries with comments containing the specified
value.
inNbEntries Match all dictionaries with nbEntries present in a subset of
values.
ninNbEntries Match all dictionaries with nbEntries not present in a
subset of values.
minNbEntries Match all entries with nbEntries equal and over specified
value.
maxNbEntries Match all entries with nbEntries under and equal specified
value.
inName Match all entries with name present in a subset of values.
ninName Match all entries with name not present in a subset of
values.
regexName Match all entries with name containing the specified value.

Request with Query String Parameters


You can call the SPNS REST API by passing the key parameter in the query string format, and the filters
parameter as a JSON in the body of the request.

POST <SPNS Gateway URL>/resources/dictionary/list?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "Internal error",
"info": {}
},
"totalNoLimit": 3,

SYSTRAN Pure Neural® Server REST API 75


"dictionaries": [
{
"sourceLang": "en",
"targetLangs": "fr",
"nbEntries": 0,
"comments": "My new dictionary enfr 2",
"name": "My Dictionary 2",
"type": "UD",
"id": "5649bb5d5a3227a4df900aa6"
},
{
"sourceLang": "fr",
"targetLangs": "fr",
"nbEntries": 0,
"comments": "My new dictionary NORM",
"name": "My Dictionary NORM",
"type": "NORM",
"id": "fr-5649bb9a5a3227a4df900aa8"
}
]
}

Examples
List dictionaries
http -v GET <SPNS Gateway URL>/resources/dictionary/list key==<API key>

GET /resources/dictionary/apiVersion?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 19
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:58:26 GMT
Vary: Accept-Encoding

{
"version": "1.0.0"
}

@: ~/tests/spns-and-ses-tests/test15-httpie/9.1.1/spsn
[jordan@sdtrn01]$ ./xresources-dictionary-list
GET /resources/dictionary/list?key=<API key> HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

SYSTRAN Pure Neural® Server REST API 76


HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 19:59:27 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"dictionaries": [
{
"id": "altmeaning-",
"name": "SYSTRAN Alternative Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
},
{
"comments": "SYSTRAN General Domain Dictionary",
"id": "[main_0]",
"name": "SYSTRAN Main Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
},
{
"comments": "The SYSTRAN Industries Terminology Dictionary describes the
Automotive Technology, Aviation/Space, Naval and Maritime, Metallurgy, and Military domains.",
"id": "[main_1]",
"name": "SYSTRAN Industries Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
},
{
"comments": "The SYSTRAN Business &amp; News Terminology Dictionary describes the
Economics/Business, Legal and Political Science domains.",
"id": "[main_2]",
"name": "SYSTRAN Business Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
},
{
"comments": "The SYSTRAN Life Sciences Terminology Dictionary describes the Earth
Science, Medicine and Food Science domains.",
"id": "[main_3]",
"name": "SYSTRAN Life Sciences Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
},
{
"comments": "The SYSTRAN Colloquial Terminology Dictionary describes the
Colloquial (conversational) domain.",
"id": "[main_4]",

SYSTRAN Pure Neural® Server REST API 77


"name": "SYSTRAN Colloquial Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
},
{
"comments": "The SYSTRAN Sciences Terminology Dictionary describes the
Computers/Data Processing, Physics/Atomic Energy, Mechanical Engineering, Mathematics,
Electronics, Photography/Optics, and Chemistry domains.",
"id": "[main_5]",
"name": "SYSTRAN Science Dictionary",
"sourceLang": "*",
"targetLangs": "*",
"type": "MAIN"
}
],
"total-no-limit": 7
}

Resources Dictionary Add


Add a new dictionary.

Resources Dictionary Add Calling Style


The specific format to add a dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/add?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• input

Resources Dictionary Add Request Parameters


The Resources Dictionary Add request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Dictionary Add Parameters


Parameter Mandatory Default Description
key yes API key for service.
input yes Dictionary information to be associated with new
dictionary.

The input dictionary information is a JSON. A sample is shown below.

{
"dictionary": {
"sourceLang": "en",
"name": "My Dictionary",
"targetLangs": "fr",

SYSTRAN Pure Neural® Server REST API 78


"comments": "My new dictionary enfr",
"type": "UD"
}
}

In the following table are the parameters for dictionary information. All of the parameters are optional except for
sourceLang and type.

Dictionary Information Parameters


Parameter Description
sourceLang Source language for the dictionary.
type User Dictionary or Normalization Dictionary = ['UD',
'NORM'].
name Dictionary name.
targetLangs One or more target languages for the dictionary.
comments Dictionary comments.

Request with Query String Parameters


You can call the SPNS REST API by passing the input as a JSON in the body of the request, with the key
parameter in the query string format.

POST <SPNS Gateway URL>/resources/dictionary/add?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "Internal error",
"info": {}
},
"added": {
"comments": "My new dictionary enfr",
"id": "5649b6e55a3227a4df900a89",
"name": "My Dictionary",
"sourceLang": "en",
"targetLangs": "fr",
"type": "UD"
}
}

Examples
Add a new dictionary

SYSTRAN Pure Neural® Server REST API 79


more new_dict-example.json
{
"dictionary": {
"sourceLang": "en",
"name": "dict-example",
"targetLangs": "fr",
"comments": "My new dictionary enfr",
"type": "UD"
}
}

http -v POST <SPNS Gateway URL>/resources/dictionary/add key==<API key> @dict-example.json

POST /resources/dictionary/add?key=<API key> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 162
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"dictionary": {
"comments": "My new dictionary enfr",
"name": "dict-example",
"sourceLang": "en",
"targetLangs": "fr",
"type": "UD"
}
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 150
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 21:49:43 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"added": {
"comments": "My new dictionary enfr",
"id": "5c269a77f046e6adea661333",
"name": "dict-example",
"sourceLang": "en",
"targetLangs": "fr",
"type": "UD"
}
}

Resources Dictionary Update


Update an existing dictionary.

SYSTRAN Pure Neural® Server REST API 80


Resources Dictionary Update Calling Style
The specific format to update a dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/update?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId
• input

Resources Dictionary Update Request Parameters


The Resources Dictionary Update request parameters you can use with the SPNS REST API are summarized in the
following table.

Translation File Status Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId Yes Dictionary identifier.
input yes Dictionary information to be associated with updated
dictionary

The input dictionary information is a JSON. A sample is shown below.

{
"name": "My Dictionary",
"sourceLang": "en",
"targetLangs": "fr,es",
"comments": "My Dictionary with new settings"
}

In the following table are the parameters for dictionary information. All of the parameters are optional.

Dictionary Information Parameters


Parameter Description
sourceLang Source language for the dictionary.
name Dictionary name.
targetLangs One or more target languages for the dictionary.
comments Dictionary comments.

Request with Query String Parameters


You can call the SPNS REST API by passing all the key and dictionaryId parameters in the query string format and
the input parameter in JSON as the body of the request.

SYSTRAN Pure Neural® Server REST API 81


POST <SPNS Gateway URL>/resources/dictionary/update?key=<API key>&dictionaryId=<dictionary
identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "Internal error",
"info": {}
},
"updated": {
"comments": "My Dictionary with new settings",
"name": "My Dictionary",
"sourceLang": "en",
"targetLangs": "fr,es"
}
}

Examples
Update an existing dictionary
more dict-example-update.json
{
"dictionary": {
"sourceLang": "en",
"name": "dict-1",
"targetLangs": "fr",
"comments": "My updated dictionary enfr",
"type": "UD"
}
}

http -v POST <SPNS Gateway URL>/resources/dictionary/update key==<API key>


dictionaryId==<dictionary identifier> @ dict-example-update.json

POST /resources/dictionary/update?key=<API key>&dictionaryId=<dictionary identifier> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 166
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"dictionary": {
"comments": "My updated dictionary enfr",

SYSTRAN Pure Neural® Server REST API 82


"name": "dict-example",
"sourceLang": "en",
"targetLangs": "fr",
"type": "UD"
}
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 112
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 21:50:21 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"updated": {
"comments": "My updated dictionary enfr",
"name": "dict-example",
"sourceLang": "en",
"targetLangs": "fr"
}
}

Resources Dictionary Export


Export an existing custom dictionary in SYSTRAN structured text form. Standard dictionaries may not be
exported.

Resources Dictionary Export Calling Style


The specific format to export a dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/export?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId

Resources Dictionary Export Request Parameters


The Resources Dictionary Export request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Dictionary Export Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId Yes Dictionary identifier.

SYSTRAN Pure Neural® Server REST API 83


Request with Query String Parameters
You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/translation/file/status?key=<API key>&dictionaryId=<dictionary


identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be the exported dictionary in text form:

#ENCODING=UTF-8
#MULTI
#EN FR PRIORITY_FR COMMENTS_FR
cat chat ami 9
dog chien ami 9 Dog comment

Examples
Export an existing dictionary with its contents
http -v POST <SPNS Gateway URL>/resources/dictionary/export key==<API key>
dictionaryId==<dictionary identifier>

POST /resources/dictionary/export?key=<API key>&dictionaryId=<dictionary identifier> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 139
Content-Type: text/bitext
Date: Fri, 28 Dec 2018 21:52:36 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

#ENCODING=UTF-8
#SUMMARY=dict-example
#DESCRIPTION=My updated dictionary enfr
#MULTI
#EN UPOS FR PRIORITY_FR COMMENTS_FR
dog noun chien 9

SYSTRAN Pure Neural® Server REST API 84


Resources Dictionary Delete
Delete an existing custom dictionary. Standard dictionaries may not be deleted.

Resources Dictionary Delete Calling Style


The specific format to delete a dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/delete?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId

Resources Dictionary Delete Request Parameters


The Resources Dictionary Delete request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Dictionary Delete Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId yes Dictionary identifier.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/dictionary/delete?key=<API key>&dictionaryId=<dictionary


identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
There is no response body.

Examples
Delete custom dictionary
http -v POST <SPNS Gateway URL>/resources/dictionary/delete key==<API key>
dictionaryId==<dictionary identifier>

POST /resources/dictionary/delete?key=<API key>&dictionaryId=<dictionary identifier> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

SYSTRAN Pure Neural® Server REST API 85


HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 2
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 22:16:47 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{}

Resources Dictionary Supported Languages


Retrieve supported languages for dictionaries.

Resources Dictionary Supported Languages Calling Style


The specific format to return the list of supported language codes is:

GET <SPNS Gateway URL>/resources/dictionary/supportedLanguages?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

Resources Dictionary Supported Languages Request Parameters


The Resources Dictionary Supported Languages request parameters you can use with the SPNS REST API are
summarized in the following table.

Resources Dictionary Supported Languages Parameters


Parameter Mandatory Default Description
key yes API key for service.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/dictionary/supportedLanguages?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

SYSTRAN Pure Neural® Server REST API 86


{
"error": {
"message": "Internal error",
"info": {}
},
"languages": [
"en",
"fr",
"nl",
"es"
]
}

Examples
List supported languages by dictionaries
http -v GET <SPNS Gateway URL>/resources/dictionary/supportedLanguages key==<API key>

GET /resources/dictionary/supportedLanguages?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 250
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 22:18:37 GMT
Vary: Accept-Encoding

{
"languages": [
"ar",
"bg",
"bn",
"cs",
"cy",
"da",
"de",
"dr",
"el",
"en",
"es",
"et",
"fa",
"fi",
"fr",
"he",
"hi",
"hr",

SYSTRAN Pure Neural® Server REST API 87


"hu",
"id",
"is",
"it",
"ja",
"ko",
"lt",
"lv",
"ms",
"nl",
"no",
"pl",
"ps",
"pt",
"ro",
"ru",
"sh",
"sk",
"sl",
"so",
"sq",
"sr",
"sv",
"th",
"tr",
"uk",
"ur",
"vi",
"zh"
]
}

Resources Dictionary Lookup


Look up a term or phrase in a dictionary.

Resources Dictionary Lookup Calling Style


The specific format to look up a term or phrase in a dictionary is:

GET <SPNS Gateway URL>/resources/dictionary/lookup?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• input
• source
• target

All other request parameters are optional.

SYSTRAN Pure Neural® Server REST API 88


Resources Dictionary Lookup Request Parameters
The Resources Dictionary Lookup request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Dictionary Lookup Parameters


Parameter Mandatory Default Description
key yes API key for service.
input yes Term or phrase to look up. Multiple input parameters can
be specified.
source yes Source language for lookup
target yes Target language for lookup.
autocomplete no false With this parameter, if the input word is not found in the
source language, it will be filled in with autocompletion to
perform the lookup.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/dictionary/lookup?key=<API key>&source=<source language


>&target=<target language>&input=<input term or phrase to look up>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"warning": "string",
"error": {
"message": "Internal error",
"info": {}
},
"outputs": [
{
"output": {
"matches": [
{
"auto_complete": false,
"model_name": "mono-enfr.mod",
"other_expressions": [
{
"context": "",
"source": "borax dog",
"target": "borax chez le chien"
},
{
"context": "",
"source": "lucky dog",
"target": "veinard"

SYSTRAN Pure Neural® Server REST API 89


},
{
"context": "",
"source": "sea dog",
"target": "loup de mer"
},
{
"context": "",
"source": "top dog",
"target": "grand chef"
}
],
"source": {
"inflection": "(pl:dogs)",
"info": "",
"lemma": "dog",
"phonetic": "[dɑɡ]",
"pos": "noun",
"term": "dog"
},
"targets": [
{
"context": "",
"domain": "",
"entry_id": 4987,
"expressions": [
{
"source": "small dog",
"target": "petit chien"
},
{
"source": "treated dogs",
"target": "chien traité"
},
{
"source": "large dog",
"target": "grand chien"
},
{
"source": "male dog",
"target": "chien mâle"
}
],
"info": "",
"invmeanings": [
"dog"
],
"lemma": "chien",
"rank": "95",
"synonym": "",
"variant": ""
},
{
"context": "",
"domain": "",
"entry_id": 4987,
"expressions": [],
"info": "",
"invmeanings": [
"bitch",
"dog",

SYSTRAN Pure Neural® Server REST API 90


"slut"
],
"lemma": "chienne",
"rank": "1",
"synonym": "",
"variant": ""
}
]
}
],
"sDictSearch": true
}
}
]
}

Examples
Look up entry “dog” in dictionary with English source and French target
http -v GET <SPNS Gateway URL>/resources/dictionary/lookup key==<API key> source==en
target==fr input==dog

GET /resources/dictionary/lookup?key=<API key>&source=en&target=fr&input=dog HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 22:31:15 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"outputs": [
{
"output": {
"matches": [
{
"auto_complete": false,
"model_name": "mono-enfr.mod",
"other_expressions": [
{
"context": "",
"source": "hot dog",
"target": "hot dogs"
},
{
"context": "",
"source": "dog sled",

SYSTRAN Pure Neural® Server REST API 91


"target": "traîneau à chiens"
},
{
"context": "",
"source": "top dog",
"target": "grand chef"
},
{
"context": "",
"source": "borax dog",
"target": "borax chez le chien"
}
],
"source": {
"lemma": "dog",
"pos": "noun"
},
"targets": [
{
"lemma": "chien",
"origin": [
{
"dictId":
"gdict_5bec9bb86181956c538a0aaa_5c26a416f046e6adea661336",
"dictName": "dict-example",
"dictType": "gdict",
"entryId":
"5c26a428f046e6adea661338_5c26a428f046e6adea661337"
}
],
"pos": "noun"
},
{
"context": "",
"domain": "",
"entry_id": 15139,
"expressions": [
{
"source": "small dogs",
"target": "petit chien"
},
{
"source": "large dogs",
"target": "grand chien"
},
{
"source": "treated dogs",
"target": "chien traité"
},
{
"source": "male dogs",
"target": "chien mâle"
}
],
"info": "",
"invmeanings": [
"wolfhound"
],
"lemma": "chien",
"rank": "98",
"synonym": "",

SYSTRAN Pure Neural® Server REST API 92


"variant": ""
},
{
"context": "",
"domain": "",
"entry_id": 15139,
"expressions": [],
"info": "",
"invmeanings": [
"bitch",
"slut"
],
"lemma": "chienne",
"rank": "1",
"synonym": "",
"variant": ""
}
]
},
{
"auto_complete": false,
"model_name": "mono-enfr.mod",
"source": {
"inflection": "(dogs/dogged)",
"info": "",
"lemma": "dog",
"phonetic": "[dɑɡ]",
"pos": "verb",
"term": "dog"
},
"targets": [
{
"context": "",
"domain": "",
"entry_id": 15140,
"expressions": [],
"info": "",
"invmeanings": [
"make dizzy"
],
"lemma": "entêter",
"rank": "100",
"synonym": "",
"variant": ""
}
]
}
]
}
}
]
}

Resources Dictionary Lookup Supported Languages


List of language pairs in which lookup is supported. This list can be limited to a specific source language or target
language.

SYSTRAN Pure Neural® Server REST API 93


Resources Dictionary Lookup Supported Languages Calling Style
The specific format to return the list of supported language codes for a dictionary lookup is:

GET <SPNS Gateway URL>/resources/dictionary/lookup/supportedLanguages?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Resources Dictionary Lookup Supported Languages Parameters


The Resources Dictionary Lookup Supported Languages request parameters you can use with the SPNS REST API
are summarized in the following table.

Resources Dictionary Lookup Supported Languages Parameters


Parameter Mandatory Default Description
key yes API key for service.
source no Language of the source.
target no Language of the target.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/dictionary/lookup?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "Internal error",
"info": {}
},
"languagePairs": [
{
"source": "en",
"target": "fr"
},
{
"source": "en",

SYSTRAN Pure Neural® Server REST API 94


"target": "nl"
},
{
"source": "fr",
"target": "en"
},
{
"source": "fr",
"target": "es"
}
]
}

Examples
List all supported languages for dictionary lookup
http -v GET <SPNS Gateway URL>/resources/dictionary/lookup/supportedLanguages key==<API key>

GET /resources/dictionary/lookup/supportedLanguages?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 22:19:21 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"languagePairs": [
{
"source": "ar",
"target": "en"
},
{
"source": "ar",
"target": "fr"
},
{
"source": "bg",
"target": "en"
},
{
"source": "cs",
"target": "en"
},
{
"source": "de",
"target": "en"

SYSTRAN Pure Neural® Server REST API 95


},
{
"source": "de",
"target": "es"
},
{
"source": "de",
"target": "fr"
},
{
"source": "de",
"target": "it"
},
{
"source": "de",
"target": "pt"
},
{
"source": "dr",
"target": "en"
},
{
"source": "el",
"target": "en"
},
{
"source": "el",
"target": "fr"
},
{
"source": "en",
"target": "ar"
},
{
"source": "en",
"target": "de"
},
{
"source": "en",
"target": "el"
},
{
"source": "en",
"target": "es"
},
{
"source": "en",
"target": "fr"
},
{
"source": "en",
"target": "it"
},
{
"source": "en",
"target": "ja"
},
{
"source": "en",
"target": "ko"
},

SYSTRAN Pure Neural® Server REST API 96


{
"source": "en",
"target": "nl"
},
{
"source": "en",
"target": "pl"
},
{
"source": "en",
"target": "pt"
},
{
"source": "en",
"target": "ru"
},
{
"source": "en",
"target": "sv"
},
{
"source": "en",
"target": "zh-Hans"
},
{
"source": "es",
"target": "de"
},
{
"source": "es",
"target": "en"
},
{
"source": "es",
"target": "fr"
},
{
"source": "es",
"target": "it"
},
{
"source": "es",
"target": "pt"
},
{
"source": "fa",
"target": "en"
},
{
"source": "fr",
"target": "de"
},
{
"source": "fr",
"target": "el"
},
{
"source": "fr",
"target": "en"
},
{

SYSTRAN Pure Neural® Server REST API 97


"source": "fr",
"target": "es"
},
{
"source": "fr",
"target": "it"
},
{
"source": "fr",
"target": "nl"
},
{
"source": "fr",
"target": "pt"
},
{
"source": "fr",
"target": "zh-Hans"
},
{
"source": "hi",
"target": "en"
},
{
"source": "it",
"target": "de"
},
{
"source": "it",
"target": "en"
},
{
"source": "it",
"target": "es"
},
{
"source": "it",
"target": "fr"
},
{
"source": "it",
"target": "pt"
},
{
"source": "ja",
"target": "en"
},
{
"source": "ja",
"target": "ko"
},
{
"source": "ko",
"target": "en"
},
{
"source": "ko",
"target": "ja"
},
{
"source": "ko",

SYSTRAN Pure Neural® Server REST API 98


"target": "zh-Hans"
},
{
"source": "nl",
"target": "en"
},
{
"source": "nl",
"target": "fr"
},
{
"source": "pl",
"target": "en"
},
{
"source": "ps",
"target": "en"
},
{
"source": "pt",
"target": "de"
},
{
"source": "pt",
"target": "en"
},
{
"source": "pt",
"target": "es"
},
{
"source": "pt",
"target": "fr"
},
{
"source": "pt",
"target": "it"
},
{
"source": "ru",
"target": "en"
},
{
"source": "sh",
"target": "en"
},
{
"source": "sk",
"target": "en"
},
{
"source": "sq",
"target": "en"
},
{
"source": "sv",
"target": "en"
},
{
"source": "uk",
"target": "en"

SYSTRAN Pure Neural® Server REST API 99


},
{
"source": "ur",
"target": "en"
},
{
"source": "zh-Hans",
"target": "en"
},
{
"source": "zh-Hans",
"target": "fr"
},
{
"source": "zh-Hans",
"target": "ko"
}
]
}

Resources Dictionary Entry List


List entries for a specific custom dictionary. Standard dictionary may not be listed.

Resources Dictionary Entry List Calling Style


The specific format to return the list of dictionary entries is:

POST <SPNS Gateway URL>/resources/dictionary/entry/list?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId

All other request parameters are optional.

Resources Dictionary Entry List Request Parameters


The Resources Dictionary Entry List request parameters you can use with the SPNS REST API are summarized in
the following table.

Resources Dictionary Entry List Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId yes Dictionary identifier
filters no Different filters that can be applied to the list functionality
(skip/limit/sort/match).
callback no JavaScript callback function name for JSONP support.

The dictionary emtry filters provide control over the dictionary information returned in the list. A sample filter
(always in JSON form) is shown below. The aspects of the filter are as follows.

SYSTRAN Pure Neural® Server REST API 100


• Overall
• Sort
• Match

{
"skip": 0,
"limit": 3,
"sort": {
"targetLang": 1,
"targetConfidence": 1,
"sourceConfidence": 1,
"comments": 1,
"priority": 1,
"partOfSpeech": 1,
"target": 1,
"source": 1
},
"match": {
"ninTargetConfidence": [
75
],
"inTargetConfidence": [
100
],
"maxTargetConfidence": 100,
"minTargetConfidence": 0,
"ninSourceConfidence": [
75
],
"inSourceConfidence": [
100
],
"maxSourceConfidence": 100,
"minSourceConfidence": 0,
"ninPriority": [
3
],
"inPriority": [
0,
10,
9
],
"maxPriority": 10,
"minPriority": 0,
"ninTargetLang": [
"es"
],
"inTargetLang": [
"fr"
],
"regexComments": "",
"ninPartOfSpeech": [
"adj"
],
"inPartOfSpeech": [
"noun"
],
"regexTarget": "ba",

SYSTRAN Pure Neural® Server REST API 101


"ninTarget": [
"train"
],
"inTarget": [
"bateau"
],
"regexSource": "bo",
"ninSource": [
"something"
],
"inSource": [
"boat"
]
}
}

In the following tables are the parameters for each filter aspect. All of the parameters are optional.

Overall Filter Parameters


Parameter Description
skip Number of dictionary entries to skip before including the
remainder on the list.
limit Limit number of dictionary entries listed to specified
number.

Sort Filter Parameters


Parameter Description
source 1/-1 for ascending/descending order on sourceLang field =
['1', '-1'].
target 1/-1 for ascending/descending order on targetLangs field =
['1', '-1'].
partOfSpeech 1/-1 for ascending/descending order on partOfSpeech field
= ['1', '-1'].
priority 1/-1 for ascending/descending order on priority field = ['1', '-
1'.
comments 1/-1 for ascending/descending order on comments field =
['1', '-1'].
sourceConfidence 1/-1 for ascending/descending order on sourceConfidence
field = ['1', '-1'].
targetConfidence 1/-1 for ascending/descending order on targetConfidence
field = ['1', '-1'].
targetLang 1/-1 for ascending/descending order on targetLang field =
['1', '-1'].

Match Sort Filter Parameters


Parameter Description
inSource Match all dictionaries with source present in a subset of
values.

SYSTRAN Pure Neural® Server REST API 102


Parameter Description
ninSource Match all dictionaries with source not present in a subset of
values.
regexSource Match all entries with source containing the specified value.
inTarget Match all entries with target present in a subset of values.
ninTarget Match all entries with target not present in a subset of
values.
regexTarget Match all entries with target containing the specified value.
inPartOfSpeech Match all entries with partOfSpeech present in a subset of
values.
ninPartOfSpeech Match all entries with partOfSpeech not present in a subset
of values.
regexComments Match all entries with comments containing the specified
value.
inTargetLang Match all entries with targetLang present in a subset of
values.
ninTargetLang Match all entries with targetLang not present in a subset of
values.
minPriority Match all entries with priority equal and over specified
value.
maxPriority Match all entries with priority under and equal specified
value.
inPriority Match all entries with priority present in a subset of values.
ninPriority Match all entries with priority not present in a subset of
values.
minSourceConfidence Match all entries with sourceConfidence equal and over
specified value.
maxSourceConfidence Match all entries with sourceConfidence under and equal
specified value.
inSourceConfidence Match all entries with sourceConfidence present in a subset
of values.
ninSourceConfidence Match all entries with sourceConfidence not present in a
subset of values
minTargetConfidence Match all entries with targetConfidence equal and over
specified value.
maxTargetConfidence Match all entries with targetConfidence under and equal
specified value.
inTargetConfidence Match all entries with targetConfidence present in a subset
of values.
ninTargetConfidence Match all entries with targetConfidence not present in a
subset of values.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format, and the filters
parameter as a JSON in the body of the request.

POST <SPNS Gateway URL>/translation/file/status?key=<API key>&dictionaryId=<dictionary


identifier>

SYSTRAN Pure Neural® Server REST API 103


Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"entries": [
{
"source": "boat",
"target": "bateau",
"partOfSpeech": "noun",
"priority": 9,
"comments": "",
"sourceConfidence": 100,
"targetConfidence": 100,
"sourceLang": "en",
"targetLang": "fr",
"sourceId": "5649f12e5a3227a4df900aee",
"targetId": "5649f12e5a3227a4df900aed"
}
],
"totalNoLimit": 1
}

Examples
List all dictionary entries
http -v POST <SPNS Gateway URL>/resources/dictionary/entry/list key==<API key>
dictionaryId==<dictionary identifier>

POST /resources/dictionary/entry/list?key=<API key>&dictionaryId=<dictionary identifier>


HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 271
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 22:36:56 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"entries": [
{
"comments": "",
"partOfSpeech": "noun",

SYSTRAN Pure Neural® Server REST API 104


"priority": 9,
"source": "dog",
"sourceConfidence": 100,
"sourceId": "5c26a428f046e6adea661338",
"sourceLang": "en",
"target": "chien",
"targetConfidence": 100,
"targetId": "5c26a428f046e6adea661337",
"targetLang": "fr"
}
],
"totalNoLimit": 1
}

Resources Dictionary Entry Add


Add an entry to a dictionary

Resources Dictionary Entry Add Calling Style


The specific format to add an entry to a dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/entry/add?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId
• input

Resources Dictionary Entry Add Request Parameters


The Resources Dictionary Entry Add request parameters you can use with the SPNS REST API are summarized in
the following table.

Resources Dictionary Entry Add Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId yes Dictionary identifier.
input yes New entry information to be added.

The input dictionary information is a JSON. A sample is shown below.

{
"entry": {
"sourceLang": "en",
"targetLang": "fr",
"source": "dog",
"target": "chien",
"type": "translation",
"sourcePos": "noun",
"priority": "9"

SYSTRAN Pure Neural® Server REST API 105


}
}

In the following table are the parameters for dictionary information. All of the parameters are optional, except for
sourceLang, targetLang, and source.

Dictionary Information Parameters


Parameter Description
sourceLang Source language for the dictionary entry.
targetLang Target language for the dictionary entry.
source Source text for entry.
target Target text for entry
type Entry type.
sourcePos Source part-of-speech. For example, “noun”, “verb”,
“adjective” and so forth.
targetPos Target part-of-speech. For example, “noun”, “verb”,
“adjective” and so forth.
priority Entry priority from “1” (highest) to “9” (lowest).

Request with Query String Parameters


You can call the SPNS REST API by passing the input as a JSON in the body of the request, with the key and
dictionaryId parameters in the query string format.

POST <SPNS Gateway URL>/translation/file/status?key=<API key>&dictionaryId=<dictionary


identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "Internal error",
"info": {}
},
"entry": {
"confidence": "60.0000038",
"pos": "noun",
"status": "ok",
"type": "translation",
"sourceId": "5649e5ec5a3227a4df900ae3",
"targetId": "5649e5ec5a3227a4df900ae2",
"targetPos": "noun",
"source": "dog",
"target": "chien"
}
}

SYSTRAN Pure Neural® Server REST API 106


Examples
Add entry to a dictionary
more dict-entry-dog.json
{
"entry": {
"sourceLang": "en",
"targetLang": "fr",
"source": "dog",
"target": "chien",
"type": "translation",
"sourcePos": "noun",
"priority": "9"
}
}

http -v GET <SPNS Gateway URL>/resources/dictionary/entry/add key==<API key>


dictionaryId==<dictionary identifier> @dict-entry-dog.json

POST /resources/dictionary/entry/add?key=<API key>&dictionaryId=<dictionary identifier>


HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 185
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"entry": {
"priority": "9",
"source": "dog",
"sourceLang": "en",
"sourcePos": "noun",
"target": "chien",
"targetLang": "fr",
"type": "translation"
}
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 195
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Dec 2018 21:51:57 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"confidence": "100",
"pos": "noun",
"source": "dog",
"sourceId": "5c269afdf046e6adea661335",
"status": "ok",

SYSTRAN Pure Neural® Server REST API 107


"target": "chien",
"targetId": "5c269afdf046e6adea661334",
"targetPos": "noun",
"type": "translation"
}

Resources Dictionary Entry Update


Update an existing entry in a dictionary.

Resources Dictionary Entry Update Calling Style


The specific format to update an entry in a dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/entry/update?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId
• input

Resources Dictionary Entry Update Request Parameters


The Resources Dictionary Entry Update request parameters you can use with the SPNS REST API are summarized
in the following table.

Resources Dictionary Entry Update Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId yes Dictionary identifier.
input yes Entry information to be updated.

The input dictionary information is a JSON. A sample is shown below.

{
"sourceId": "5649fad7d335da43344cc9bf",
"targetId": "5649fad7d335da43344cc9be",
"update": {
"sourceLang": "en",
"targetLang": "fr",
"source": "bug",
"target": "insecte",
"type": "translation",
"sourcePos": "noun",
"targetPos": "noun",
"priority": 3
}
}

SYSTRAN Pure Neural® Server REST API 108


In the following table are the parameters for dictionary information. All of the parameters are optional, except for
sourceLang and targetLang.

Dictionary Information Parameters


Parameter Description
sourceLang Source language for the dictionary entry.
targetLang Target language for the dictionary entry.
source Source text for entry.
target Target text for entry
type Entry type.
sourcePos Source part-of-speech. For example, “noun”, “verb”,
“adjective” and so forth.
targetPos Target part-of-speech. For example, “noun”, “verb”,
“adjective” and so forth.
priority Entry priority from “1” (highest) to “9” (lowest).

Request with Query String Parameters


You can call the SPNS REST API by passing the input as a JSON in the body of the request, with the key and
dictionaryId parameters in the query string format.

POST <SPNS Gateway URL>/resources/dictionary/entry/update?key=<API


key>&dictionaryId=<dictionary identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"confidence": "100",
"source": "bug",
"sourceId": "5649fb48d335da43344cc9c0",
"target": "insecte",
"targetId": "5649fad7d335da43344cc9be"
}

Examples
Update a dictionary entry
more dict-entry-cat-update.json
{
"sourceId": "5851a1e926d26127d163eb38",
"targetId": "5851948726d26127d163eb35",
"update": {
"sourceLang": "en",
"targetLang": "fr",
"source": "cat",

SYSTRAN Pure Neural® Server REST API 109


"target": "chat",
"type": "translation",
"sourcePos": "noun",
"targetPos": "noun",
"priority": 4
}
}

http -v POST <SPNS Gateway URL>/resources/dictionary/entry/update key==<API key>


dictionaryId==<dictionary identifier> @dict-entry-cat-update.json

POST /resources/dictionary/entry/update?key=<API key>&dictionaryId=5c2d1a64f046e6adea661339


HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 292
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"sourceId": "5c2d1a9cf046e6adea66133b",
"targetId": "5c2d1a9cf046e6adea66133a",
"update": {
"priority": 4,
"source": "cat",
"sourceLang": "en",
"sourcePos": "noun",
"target": "chat",
"targetLang": "fr",
"targetPos": "noun",
"type": "translation"
}
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 127
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 21:30:08 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"confidence": "100",
"source": "cat",
"sourceId": "5c2d2a7bf046e6adea66133d",
"target": "chat",
"targetId": "5c2d1a9cf046e6adea66133a"
}

Resources Dictionary Entry Import


Import entries into a dictionary.

SYSTRAN Pure Neural® Server REST API 110


Resources Dictionary Entry Import Calling Style
The specific format to import entries into an existing dictionary is:

POST <SPNS Gateway URL>/resources/dictionary/entry/import?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId
• sourceLang
• inputFile

Resources Dictionary Entry Import Request Parameters


The Resources Dictionary Entry Import request parameters you can use with the SPNS REST API are summarized
in the following table.

Resources Dictionary Entry Import Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId yes Dictionary identifier
sourceLang yes Source languages of entries to be imported
inputFile yes File data to import.

The inputFile entry data information is a tab-delimited text file. A sample is shown below. Note that the “<tab>”
value should be replaced with a tab character.

#ENCODING=UTF-8
#SUMMARY=Sample dictionary entries
#MULTI
#EN<tab>FR
black cat<tab>chat noir
cat<tab>chat
cats<tab>chats
white cat<tab>chat blanc
kitten<tab>chaton

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format, with the inputFile
parameter passed as the body of the request.

POST <SPNS Gateway URL>/resources/dictionary/entry/import?key=<API


key>&dictionaryId=<dictionary identifier>&sourceLang=<source language>

SYSTRAN Pure Neural® Server REST API 111


Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"duplicates": 1,
"inserted": 95,
"total": 96
}

Examples
Import entries into existing dictionary (entries are tab-delimited)
more dict-entries.txt
#ENCODING=UTF-8
#SUMMARY=Sample dictionary entries
#MULTI
#EN FR
president président
presidents présidents
black cat chat noir
cat chat
cats chats
white cat chat blanc
kitten chaton

http -v GET <SPNS Gateway URL>/resources/dictionary/entry/import key==<API key>


dictionaryId==<dictionary identifier> sourceLang==en inputFile=@dict-entries.txt

POST /resources/dictionary/entry/import?key=<API
key>&dictionaryId=5c2d1a64f046e6adea661339&sourceLang=en HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 230
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"inputFile": "#ENCODING=UTF-8\n#SUMMARY=Sample dictionary
entries\n#MULTI\n#EN\tFR\npresident\tprésident\npresidents\tprésidents\nblack cat\tchat
noir\ncat\tchat\ncats\tchats\nwhite cat\tchat blanc\nkitten\tchaton\n\n"
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 39
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 21:34:44 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

SYSTRAN Pure Neural® Server REST API 112


{
"duplicates": 1,
"inserted": 6,
"total": 7
}

Resources Dictionary Entry Delete


Delete an entry in a dictionary. This only applies to custom dictionaries, not standard dictionaries.

Resources Dictionary Entry Delete Calling Style


The specific format to delete a dictionary entry is:

POST <SPNS Gateway URL>/resources/dictionary/entry/delete?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• dictionaryId
• input

Resources Dictionary Entry Delete Request Parameters


The Resources Dictionary Entry Delete request parameters you can use with the SPNS REST API are summarized
in the following table.

Resources Dictionary Entry Delete Parameters


Parameter Mandatory Default Description
key yes API key for service.
dictionaryId yes Dictionary identifier.
input yes Input with entry identifiers for source or target.

The input entry is a JSON specifying the identifiers for the source or target. The source identifier is required,
while the target identifier is optional. A sample is shown below.

{
"entry": {
"sourceId": "5649e5ec5a3227a4df900ae3",
"targetId": "5649e5ec5a3227a4df900ae2"
}
}

The source and target identifiers can be determined from an entry listing (see Resources Dictionary Entry List).

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format, with the input
parameter as the body of the request.

SYSTRAN Pure Neural® Server REST API 113


POST <SPNS Gateway URL>/translation/file/status?key=<API key>&dictionaryId=<dictionary
identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"status": "entry deleted with success"
}

Examples
Asynchronous file translation status check
more dict-entry-to-delete.json
{
"entry": {
"sourceId": "5c2d2e74f046e6adea661349",
"targetId": "5c2d2e74f046e6adea661348"
}
}

http -v GET <SPNS Gateway URL>/resources/dictionary/entry/delete key==<API key>


dictionaryId==<dictionary identifier> @dict-entry-to-delete.json

POST /resources/dictionary/entry/delete?key=<API key>&dictionaryId=5c2d1a64f046e6adea661339


HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 108
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"entry": {
"sourceId": "5c2d2e74f046e6adea661349",
"targetId": "5c2d2e74f046e6adea661348"
}
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 39
Content-Type: application/json; charset=utf-8

SYSTRAN Pure Neural® Server REST API 114


Date: Wed, 02 Jan 2019 21:38:59 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"status": "entry deleted with success"
}

Resources Corpus API Version


Retrieve the API version for the Resources Corpus REST API.

Resources Corpus API Version Calling Style


The specific format to return the API version is:

GET <SPNS Gateway URL>/resources/corpus/apiVersion?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

Resources Corpus API Version Request Parameters


The Resources Corpus API Version request parameters you can use with the SPNS REST API are summarized in
the following table.

Resources Corpus API Version Parameters


Parameter Mandatory Default Description
key yes API key for service.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/corpus/apiVersion?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"version": "1.0.0"
}

SYSTRAN Pure Neural® Server REST API 115


Examples
Get API version for Resources Corpus REST API
http -v GET <SPNS Gateway URL>/resources/corpus/apiVersion key==<API key>

GET /resources/corpus/apiVersion?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 19
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 21:41:00 GMT
Vary: Accept-Encoding

{
"version": "1.0.0"
}

Resources Corpus List


List available corpora.

Resources Corpus List Calling Style


The specific format to return the list of available corpora is:

GET <SPNS Gateway URL>/resources/corpus/list?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

All other request parameters are optional.

Resources Corpus List Request Parameters


The Resources Corpus List request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus List Parameters


Parameter Mandatory Default Description
key yes API key for service.

SYSTRAN Pure Neural® Server REST API 116


Parameter Mandatory Default Description
sourceLang no Language code of the source.
targetLang no Language code of the target.
withoutPending no false Filter out corpora in “pending” status.
withoutError no false Filter out corpora in “error” status.
prefix no Prefix of the corpus name
directory no If specified, response will return the content of this
directory, including corpora and directories. This list can
also be filtered by the prefix parameter.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/corpus/list?key=<API key>&sourceLang=<source


language>&targetLang=<target language>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"directories": [
"/MyProject/Technical",
"/MyProject/Administration"
],
"files": [
{
"id": "55af580d4cf4c7f74e7c8d1c",
"name": "/MyProject/gears.txt",
"createdAt": "Wed Jul 22 10:45:01 2015",
"format": "text/bitext",
"nbSegments": 5993,
"sourceLang": "fr",
"targetLangs": [
"en"
],
"status": "ok"
},
{
"id": "56af580d4cf4c8f74e7c9e9a",
"name": "/MyProject/balloon.tmx",
"createdAt": "Wed Jul 22 10:47:04 2015",
"format": "application/x-tmx+xml",
"nbSegments": 2496,
"sourceLang": "en",
"targetLangs": [
"fr",
"es"
],

SYSTRAN Pure Neural® Server REST API 117


"status": "pending"
}
]
}

Examples
List available corpora
http -v GET <SPNS Gateway URL>/resources/corpus/list key==<API key>

GET /resources/corpus/list?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 197
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 21:49:28 GMT
Vary: Accept-Encoding

{
"files": [
{
"createdAt": "Wed Jan 2 21:46:55 2019",
"format": "text/bitext",
"id": "5c2d314ff705707c0a8c3ecf",
"name": "/corpus_demo",
"nbSegments": 3,
"sourceLang": "en",
"status": "ok",
"targetLangs": [
"fr"
]
}
]

Resources Corpus Update


Update corpus properties.

Resources Corpus Update


The specific format to update the corpus properties is:

POST <SPNS Gateway URL>/resources/corpus/update?<parameters>

where <parameters> are any parameters to apply to the query.

SYSTRAN Pure Neural® Server REST API 118


The following parameters are required for each request:

• key
• corpusId
• name

All other request parameters are optional.

Resources Corpus Update Request Parameters


The Resources Corpus Update request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus Update Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier
name yes Corpus name. The name also contains the directories (for
example, "/myproject/firstPass/PersonalCorpus").
tag no Tag for the corpus. Multiple tag parameters are allowed.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/corpus/update?key=<API key>&corpusId=<corpus


identifier>&name=<corpus name>&tag=<new tag>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"updated": true
}

Examples
Add a new tag to an existing corpus
http -v GET <SPNS Gateway URL>}/resources/corpus/update key==<API key> corpusId===<corpus
identifier> name==corpus_demo tag==animals

POST /resources/corpus/update?key=<API key>&corpusId=<corpus identifier>&name=&tag=animals


HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate

SYSTRAN Pure Neural® Server REST API 119


Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 16
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 22:58:30 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"updated": true
}

Resources Corpus Details


Retrieve detailed information about a corpus.

Resource Corpus Details Calling Style


The specific format to retrieve detailed information about a corpus is:

GET <SPNS Gateway URL>/resources/corpus/details?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId

All other request parameters are optional.

Resources Corpus Details Request Parameters


The Resources Corpus Details request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus Details Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

SYSTRAN Pure Neural® Server REST API 120


GET <SPNS Gateway URL>/resources/corpus/details?key=<API key>&corpusId=<corpus identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"id": "55af580d4cf4c7f74e7c8d1c",
"name": "/MyProject/gears.txt",
"createdAt": "Wed Jul 22 10:45:01 2015",
"format": "text/bitext",
"nbSegments": 5993,
"sourceLang": "fr",
"targetLangs": [
"en"
],
"status": "ok"
}

Examples
Retrieve details about specified corpus
http -v GET <SPNS Gateway URL>/resources/corpus/details key==<API key> corpusId==<corpus
identifier>

GET /resources/corpus/details?key=<API key>&corpusId=<corpus identifier> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 201
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 22:07:03 GMT
Vary: Accept-Encoding

{
"corpus": {
"createdAt": "Wed Jan 2 22:05:02 2019",
"format": "text/bitext",
"id": "<corpus identifier>",
"name": "&#x2F;corpus_demo",
"nbSegments": 3,

SYSTRAN Pure Neural® Server REST API 121


"sourceLang": "en",
"status": "ok",
"targetLangs": [
"fr"
]
}
}

Resources Corpus Exists


Check if a corpus exists.

Resources Corpus Exists Calling Style


The specific format to check if a corpus exists is:

GET <SPNS Gateway URL>/resources/corpus/exists?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• name

All other request parameters are optional.

Resources Corpus Exists Request Parameters


The Resources Corpus Exists request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus Exits Parameters


Parameter Mandatory Default Description
key yes API key for service.
name yes Corpus name. The name also contains the directories (ex:
"/myproject/firstPass/PersonalCorpus").
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/corpus/exists?key=<API key>&name=<corpus name>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

SYSTRAN Pure Neural® Server REST API 122


{
"exists": false
}

Examples
Asynchronous file translation status check
http -v GET <SPNS Gateway URL>/resources/corpus/exists key==<API key> name==corpus_demo

GET /resources/corpus/exists?key=<API key>&name=corpus_demo HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 15
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 22:08:42 GMT
Vary: Accept-Encoding

{
"exists": true
}

Resources Corpus Import


Import entries into a corpus.

Resources Corpus Import Calling Style


The specific format to import entries into a corpus is:

POST <SPNS Gateway URL>/resources/corpus/import?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• name
• format

All other request parameters are optional.

SYSTRAN Pure Neural® Server REST API 123


Resources Corpus Import Request Parameters
The Resource Corpus Import request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus Import Status Parameters


Parameter Mandatory Default Description
key yes API key for service.
name yes Corpus name.
format yes Format of the input corpus. The supported formats are
“application/x-tmx+xml”or “text/bitext”.
input no* Corpus entries for import in query.
inputFile no* Corpus entries for import in form data.
tag no Tag for the corpus. Multiple tag parameters are allowed.
callback no JavaScript callback function name for JSONP support.
* One of either the input or inputFile parameter is required.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/corpus/import?key=<API key>&name=<corpus name>&input=<corpus


entries>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"corpus": {
"id": "55af580d4cf4c7f74e7c8d1c"
}
}

Examples
Import a corpus text/bitext file into a corpus
more corpus_demo.txt
#TM
#EN FR
Why do cats purr? Pourquoi les chats ronronnent-ils?
When do dogs bark? Quand les chiens aboient?
The cat and dog are sleeping. Le chat et le chien dorment.

http -v GET <SPNS Gateway URL>/resources/corpus/import key==<API key> name==corpus_demo


format=="text/bitext" inputFile=@corpus-main.txt tag==cats tag==dogs

POST /resources/corpus/import?key=<API
key>&name=corpus_demo&format=text%2Fbitext&tag=cats&tag=dogs HTTP/1.1

SYSTRAN Pure Neural® Server REST API 124


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 194
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"inputFile": "#TM\n#EN\tFR\nWhy do cats purr?\tPourquoi les chats ronronnent-ils?\nWhen do
dogs bark?\tQuand les chiens aboient?\nThe cat and dog are sleeping.\tLe chat et le chien
dorment.\n"
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 44
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 21:46:55 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"corpus": {
"id": "5c2d314ff705707c0a8c3ecf"
}
}

Resources Corpus Export


Export a corpus using a specified format.

Resources Corpus Export Calling Style


The specific format to export a corpus is:

GET <SPNS Gateway URL>/resources/corpus/export?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId

All other request parameters are optional.

Resources Corpus Export Request Parameters


The Resource Corpus Export request parameters you can use with the SPNS REST API are summarized in the
following table.

SYSTRAN Pure Neural® Server REST API 125


Resources Corpus Export Parameters
Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
format no Expected corpus format. The supported formats are
“application/x-tmx+xml” (default) and “text/bitext”.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/corpus/export?key=<API key>&corpusId=<corpus identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be the exported corpus if successful, or if not a JSON body:

{
"error": {
"info": {
"code": 400
},
"message": "{\"error\":\"Corpus Not Found\"}\n",
"statusCode": 400
}
}

Examples
Export corpus to “application/x-tmx+xml” format
http -v GET <SPNS Gateway URL>/resources/corpus/export key==<API key> corpusId==<corpus
identifier>

GET /resources/corpus/exists?key=<API key>&name=corpus_demo HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 15

SYSTRAN Pure Neural® Server REST API 126


Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 22:08:42 GMT
Vary: Accept-Encoding

{
"exists": true
}

@: ~/tests/spns-and-ses-tests/test15-httpie/9.1.1/spsn
[jordan@sdtrn01]$ vi xresources-corpus-export
@: ~/tests/spns-and-ses-tests/test15-httpie/9.1.1/spsn
[jordan@sdtrn01]$ ./xresources-corpus-export "<corpus identifier>"
GET /resources/corpus/export?key=<API key>&corpusId=<corpus identifier> HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/x-tmx+xml
Date: Wed, 02 Jan 2019 22:10:17 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

<?xml version="1.0"?>
<tmx version="1.4">
<header adminlang="en_US" creationtool="systran-corpus-manager" creationtoolversion="1.0"
datatype="unknown" o-tmf="" segtype="sentence" srclang="en" />
<body>
<tu>
<tuv xml:lang="en">
<seg>Why do cats purr?</seg>
</tuv>
<tuv xml:lang="fr">
<seg>Pourquoi les chats ronronnent-ils?</seg>
</tuv>
</tu>
<tu>
<tuv xml:lang="en">
<seg>When do dogs bark?</seg>
</tuv>
<tuv xml:lang="fr">
<seg>Quand les chiens aboient?</seg>
</tuv>
</tu>
<tu>
<tuv xml:lang="en">
<seg>The cat and dog are sleeping.</seg>
</tuv>
<tuv xml:lang="fr">
<seg>Le chat et le chien dorment.</seg>
</tuv>
</tu>

SYSTRAN Pure Neural® Server REST API 127


</body>
</tmx>

Resources Corpus Delete


Delete a corpus.

Resources Corpus Delete Calling Style


The specific format to delete a corpus is:

POST <SPNS Gateway URL>/resources/corpus/delete?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId

All other request parameters are optional.

Resources Corpus Delete Request Parameters


The Resources Corpus Delete request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus Delete Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus indentifier.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/corpus/delete?key=<API key>&corpusId=<corpus identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"files": [
{
"id": "55af70344cf4c7f74e7cbbf0"

SYSTRAN Pure Neural® Server REST API 128


}
]
}

Examples
Delete a corpus
http -v GET <SPNS Gateway URL>/resources/corpus/delete key==<API key> corpusId== <corpus
identifier>

POST /resources/corpus/delete?key=<API key>&corpusId=<corpus identifier> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 45
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 23:02:01 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"files": [
{
"id": "<corpus identifier>"
}
]
}

Resources Corpus Match


Find segments in the corpus that match provided input text.

Resources Corpus Match Calling Style


The specific format to corpus matches is:

GET <SPNS Gateway URL>/resources/corpus/match?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId

SYSTRAN Pure Neural® Server REST API 129


• input
• sourceLang
• targetLang

All other request parameters are optional.

Resources Corpus Match Request Parameters


The Resources Corpus Match request parameters you can use with the SPNS REST API are summarized in the
following table.

Resources Corpus Match Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
input yes Text is used to perform the match operation. Multiple input
parameters can be specified.
sourceLang yes Language code of source.
targetLang yes Language code of target.
threshold no 0.7 The fuzzy match threshold from which a segment will be
considered as a match result.
limit no 1 Limit the number of returned matches. Only the first
matches with the limit will be returned.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/corpus/match?key=<API key>&corpusId=<request


identifier>&input=<input to match>&sourceLang=<source language>&targetLang=<target languages>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"matches": [
{
"form": "1er samestre (1136 Kb)",
"matches": [
{
"penalty": 0.1428571492433548,
"score": 0.8571428656578064,
"source": "1er semestre (1136 Kb)",
"target": "First half (1 Kb)"
}
]
},
{

SYSTRAN Pure Neural® Server REST API 130


"form": "Antivols alectriques de direction",
"matches": [
{
"penalty": 0,
"score": 0.75,
"source": "Antivols électriques de direction",
"target": "Electrical Steering Column Locks"
},
{
"penalty": 0,
"score": 0.75,
"source": "Antivols électriques de direction",
"target": "Identifier or advanced electronic key"
}
]
}
]
}

Examples
Find “fuzzy” match in corpus
http -v GET <SPNS Gateway URL>/resources/corpus/match key==<API key> corpusId==<corpus
identifier> input=="The cat and dog are eating." sourceLang==en targetLang==fr

GET /resources/corpus/match?key=<API key>&corpusId=<corpus


identifier>&input=The+cat+and+dog+are+eating.&sourceLang=en&targetLang=fr HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 186
Content-Type: application/json; charset=utf-8
Date: Wed, 02 Jan 2019 23:00:20 GMT
Vary: Accept-Encoding

{
"matches": [
{
"form": "The cat and dog are eating.",
"matches": [
{
"penalty": 0,
"score": 0.8571428656578064,
"source": "The cat and dog are sleeping.",
"target": "Le chat et le chien dorment."
}
]
}
]

SYSTRAN Pure Neural® Server REST API 131


}

Resources Corpus Segment List


List segments in a corpus.

Resources Corpus Segment List Calling Style


The specific format to return the list of corpus segments is:

GET <SPNS Gateway URL>/resources/corpus/segment/list?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId

All other request parameters are optional.

Resources Corpus Segment List Request Parameters


The Resources Corpus Segment List request parameters you can use with the SPNS REST API are summarized in
the following table.

Resources Corpus Segment List Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
skip no Skip specified number of first found segments.
limit no Limit the number of found segments.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/resources/corpus/segment/list?key=<API key>&corpusId=<corpus


identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"segments": [

SYSTRAN Pure Neural® Server REST API 132


{
"lang": "en",
"source": "glass",
"id": "5649fdb8569da4eca7037230.5649fe48569da4eca7037232",
"targets": [
{
"id": "5649fe48569da4eca7037233",
"lang": "fr",
"target": "mirroir"
},
{
"id": "5649fe48569da4eca7037234",
"lang": "fr",
"target": "verre"
}
]
}
]
}

Examples
List all segments in a corpus
http -v GET <SPNS Gateway URL>/resources/corpus/segment/list key==<API key> corpusId==<corpus
identifier>

POST /resources/corpus/segment/list?key=<API key>&corpusId=5c2d4568f705707c0a8c3ee1 HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 20:32:24 GMT
Transfer-Encoding: chunked
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"segments": [
{
"id": "5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee2",
"lang": "en",
"source": "Why do cats purr?",
"targets": [
{
"id": "5c2d4568f705707c0a8c3ee3",
"lang": "fr",
"target": "Pourquoi les chats ronronnent-ils?"
}

SYSTRAN Pure Neural® Server REST API 133


]
},
{
"id": "5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee4",
"lang": "en",
"source": "When do dogs bark?",
"targets": [
{
"id": "5c2d4568f705707c0a8c3ee5",
"lang": "fr",
"target": "Quand les chiens aboient?"
}
]
},
{
"id": "5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee6",
"lang": "en",
"source": "The cat and dog are sleeping.",
"targets": [
{
"id": "5c2d4568f705707c0a8c3ee7",
"lang": "fr",
"target": "Le chat et le chien dorment."
}
]
},
{
"id": "5c2d4568f705707c0a8c3ee0.5c2e7100e19b11ae515dff01",
"lang": "en",
"source": "This cat is white.",
"targets": [
{
"id": "5c2e7100e19b11ae515dff02",
"lang": "fr",
"target": "Ce chat est blanc."
}
]
},
{
"id": "5c2d4568f705707c0a8c3ee0.5c2e7100e19b11ae515dff03",
"lang": "en",
"source": "The dog has a long tail.",
"targets": [
{
"id": "5c2e7100e19b11ae515dff04",
"lang": "fr",
"target": "Le chien a une longue queue."
}
]
}
]
}

Resources Corpus Segment Add


Add segments to a corpus.

Resources Corpus Segment Add Calling Style


The specific format to add segments to a corpus codes is:

SYSTRAN Pure Neural® Server REST API 134


POST <SPNS Gateway URL>/resources/corpus/segment/add?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• body

All other request parameters are optional.

Resources Corpus Segment Add Request Parameters


The Resources Corpus Segment Add request parameters you can use with the SPNS REST API are summarized in
the following table.

Resources Corpus Segment Add Parameters


Parameter Mandatory Default Description
key yes API key for service.
body yes Segments to add to corpus in JSON.
callback no JavaScript callback function name for JSONP support.

The body parameter is added to the body of the request. A sample body (always in JSON form) is show below.

{
"corpusId": "55afbc9e17fb5791ef7a54ff",
"segments": [
{
"lang": "fr",
"source": "Exemple de traduction",
"targets": [
{
"lang": "en",
"target": "Translation example"
},
{
"lang": "en",
"target": "Example of translation"
}
]
}
]
}

In the following tables are the parameters for the body parameter. All of the parameters are required.

Body Parameters
Parameter Description
corpusId Corpus identifier.

SYSTRAN Pure Neural® Server REST API 135


Parameter Description
segments List of segments to add.
lang Language code of segment source or target.
source Segment source text.
targets List of segment targets.
target Segment target text.

Request with Query String Parameters


You can call the SPNS REST API by passing the body as a JSON in the body of the request, with the key
parameter in the query string format.

POST <SPNS Gateway URL>/resources/corpus/segment/add?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"segments": [
"55afbc9e17fb5791ef7a54fe.55b65d8c6b457345fd2e3473",
"55afbc9e17fb5791ef7a54fe.55b65d9c6c457345fd1f5a8b"
]
}

Examples
Add segments to an existing corpus
more corpus_segs_to_add.json
{
"corpusId": "5c2d4568f705707c0a8c3ee1",
"segments": [
{
"lang": "en",
"source": "This cat is white.",
"targets": [
{
"lang": "fr",
"target": "Ce chat est blanc."
}
]
},
{
"lang": "en",
"source": "The dog has a long tail.",
"targets": [
{
"lang": "fr",
"target": "Le chien a une longue queue."
}

SYSTRAN Pure Neural® Server REST API 136


]
}
]
}

http -v GET <SPNS Gateway URL>/resources/corpus/segment/add key==<API key> @


corpus_seg_to_add.json

POST /resources/corpus/segment/add?key=<API key> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 447
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"corpusId": "5c2d4568f705707c0a8c3ee1",
"segments": [
{
"lang": "en",
"source": "This cat is white.",
"targets": [
{
"lang": "fr",
"target": "Ce chat est blanc."
}
]
},
{
"lang": "en",
"source": "The dog has a long tail.",
"targets": [
{
"lang": "fr",
"target": "Le chien a une longue queue."
}
]
}
]
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 118
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 20:30:56 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"segments": [
"5c2d4568f705707c0a8c3ee0.5c2e7100e19b11ae515dff01",
"5c2d4568f705707c0a8c3ee0.5c2e7100e19b11ae515dff03"
]
}

SYSTRAN Pure Neural® Server REST API 137


Resources Corpus Segment Delete
Delete segments from a corpus.

Resources Corpus Segment Delete Calling Style


The specific format to delete segments from a corpus is:

POST <SPNS Gateway URL>/resources/corpus/segment/delete?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId
• segId

All other request parameters are optional.

Resources Corpus Segment Delete Request Parameters


The Resources Corpus Segment Delete request parameters you can use with the SPNS REST API are summarized
in the following table.

Resources Corpus Segment Delete Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
segId yes Segment identifier. Multiple segId parameters can be
specified. Example:
“5851d78303566ee95cec57e7.5851d78303566ee95cec57e9”.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/corpus/segment/delete?key=<API key>&corpusId=<corpus


identifier>&segId=<segment identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

SYSTRAN Pure Neural® Server REST API 138


"error": {
"message": "Internal error",
"info": {}
},
"nbDeleted": 0
}

Examples
Delete a corpus segment
http -v GET <SPNS Gateway URL>/resources/corpus/segment/delete key==<API key>
corpusId==<corpus identifier> segId=="<segment identifier>"

POST /resources/corpus/segment/target/delete?key=<API
key>&corpusId=5c2d4568f705707c0a8c3ee1&segId=5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee2
&targetId=5c2d4568f705707c0a8c3ee3 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 16
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 21:04:32 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"deleted": true
}

Resources Corpus Segment Update


Update a segment in a corpus.

Resources Corpus Segment Update Calling Style


The specific format to update a segment in a corpus is:

POST <SPNS Gateway URL>/resources/corpus/segment/update?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key

SYSTRAN Pure Neural® Server REST API 139


• corpusId
• segId

All other request parameters are optional.

Resources Corpus Segment Update Request Parameters


The Resources Corpus Segment Update request parameters you can use with the SPNS REST API are summarized
in the following table.

Resources Corpus Segment Update File Status Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
segId yes Segment identifier. . Example:
“5851d78303566ee95cec57e7.5851d78303566ee95cec57e9”.
source no Source text to replace existing segment source text.
targetId no Target identifier.
target no Target text to replace existing segment target text. Note
that targetId is required for this.
targetLang no Language code of target. Note that targetId is required for
this
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/corpus/segment/update/?key=<API key>&corpusId=<corpus


identifier>&segId=<segment identifier>&source=<segment source text>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": {
"message": "Internal error",
"info": {}
},
"updated": true
}

Examples
Update a corpus segment
http -v GET <SPNS Gateway URL>/resources/corpus/segment/update key==<API key>
corpusId==<corpus identifier> segId=="<segment identifier>" source=="Why do cats knead?"

SYSTRAN Pure Neural® Server REST API 140


POST /resources/corpus/segment/update?key=<API
key>&corpusId=5c2d4568f705707c0a8c3ee1&segId=5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee2
&source=Why+do+cats+knead%3F HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 16
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 20:34:21 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"updated": true
}

Resources Corpus Segment Target Add


Add targets to a segment in a corpus.

Resources Corpus Segment Target Add Calling Style


The specific format to add targets to a segment in a corpus is:

POST <SPNS Gateway URL>/resources/corpus/segment/target/add?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• body

All other request parameters are optional.

Resources Corpus Segment Target Add Request Parameters


The Resources Corpus Segment Target Add request parameters you can use with the SPNS REST API are
summarized in the following table.

Resources Corpus Segment Target Add Parameters


Parameter Mandatory Default Description
key yes API key for service.
body yes Segments to add to corpus in JSON.

SYSTRAN Pure Neural® Server REST API 141


Parameter Mandatory Default Description
callback no JavaScript callback function name for JSONP support.

The body parameter is added to the body of the request. A sample body (always in JSON form) is show below.

{
"corpusId": "55afbc9e17fb5791ef7a54ff",
"segId": "55afbc9e17fb5791ef7a54fe.55b69c8d6b457345fd2e347f",
"targets": [
{
"lang": "en",
"target": "added segment one"
},
{
"lang": "en",
"target": "added segment two"
}
]
}

In the following tables are the parameters for the body parameter. All of the parameters are required.

Body Parameters
Parameter Description
corpusId Corpus identifier.
segId Segment identifier.
targets List of segment targets to add.
lang Language code of segment target.
target Segment target text.

Request with Query String Parameters


You can call the SPNS REST API by passing the body as a JSON in the body of the request, with the key
parameter in the query string format.

POST <SPNS Gateway URL>/resources/corpus/segment/target/add?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"added": true
}

SYSTRAN Pure Neural® Server REST API 142


Examples
Add targets to an existing corpus segment
more corpus-target-segments.json
{
"corpusId": "5c2d4568f705707c0a8c3ee1",
"segId": "5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee2",
"targets": [
{
"lang": "de",
"target": "Warum machen Katzen schnurren?"
},
{
"lang": "de",
"target": "Warum kneten Katzen?"
}
]
}

http -v GET <SPNS Gateway URL>/resources/corpus/segment/target/add key==<API key> @corpus-


target-segments.json

POST /resources/corpus/segment/target/add?key=<API key> HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 282
Content-Type: application/json
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

{
"corpusId": "5c2d4568f705707c0a8c3ee1",
"segId": "5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee2",
"targets": [
{
"lang": "de",
"target": "Warum machen Katzen schnurren?"
},
{
"lang": "de",
"target": "Warum kneten Katzen?"
}
]
}

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 14
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 20:38:13 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"added": true

SYSTRAN Pure Neural® Server REST API 143


}

Resources Corpus Segment Target Delete


Delete targets from a segment in a corpus.

Resources Corpus Segment Target Delete Calling Style


The specific format to delete targets from a segment in a corpus is:

POST <SPNS Gateway URL>/resources/corpus/segment/target/delete?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• corpusId
• segId
• targetId

All other request parameters are optional.

Resources Corpus Segment Target Delete Request Parameters


The Resources Corpus Segment Target Delete request parameters you can use with the SPNS REST API are
summarized in the following table.

Resources Corpus Segment Target Delete Parameters


Parameter Mandatory Default Description
key yes API key for service.
corpusId yes Corpus identifier.
segId yes Segment identifier.
targetId yes Target identifier.
callback no JavaScript callback function name for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

POST <SPNS Gateway URL>/resources/corpus/segment/target/delete?key=<API key>&corpusId=<corpus


identifier>&segId=<segment identifier>&targetId=<target identifier>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

SYSTRAN Pure Neural® Server REST API 144


{
"deleted": true
}

Examples
Delete target from a corpus segment
http -v GET <SPNS Gateway URL>/resources/corpus/segment/target/delete key==<API key>
corpusId==<corpus identifier> segId=="<segment identifier>" targetId==<target identifier>

POST /resources/corpus/segment/target/delete?key=<API
key>&corpusId=5c2d4568f705707c0a8c3ee1&segId=5c2d4568f705707c0a8c3ee0.5c2d4568f705707c0a8c3ee2
&targetId=5c2e72b5e19b11ae515dff05 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 16
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 20:45:17 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"deleted": true
}

Multimodal Speech API Version


Retrieve the API version for the Multimodal Speech REST API.

Multimodal Speech API Version Calling Style


The specific format to return the API version is:

GET <SPNS Gateway URL>/multimodal/speech/apiVersion?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

SYSTRAN Pure Neural® Server REST API 145


Multimodal Speech API Version Request Parameters
The Multimodal Speech API Version request parameters you can use with the SPNS REST API are summarized in
the following table.

Multimodal Speech API Version Parameters


Parameter Mandatory Default Description
key yes API key for service.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL>/multimodal/speech/apiVersion?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"version": "2.0.0"
}

Examples
Get API version for Multimodal Speech REST API
http -v GET <SPNS Gateway URL>/multimodal/speech/apiVersion key==<API key>

GET /multimodal/speech/apiVersion?key=<API key> HTTP/1.1


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 19
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 00:14:03 GMT
Vary: Accept-Encoding

{
"version": "2.0.0"
}

SYSTRAN Pure Neural® Server REST API 146


Multimodal Speech Transcribe
Speech transcribe extracts text and other information from an audio stream. The extracted information includes
word alignment data (start time, word duration, word text and confidence) as well as speaker gender
identification.

Multimodal Speech Transcribe Calling Style


The specific format to transcribe the audio is:

POST <SPNS Gateway URL>/multimodal/speech/transcribe?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• audioFile
• lang

All other request parameters are optional.

Multimodal Speech Transcribe Request Parameters


The Multimodal Speech Transcribe request parameters you can use with the SPNS REST API are summarized in
the following table.

Multimodal Speech Transcribe Detection Parameters


Parameter Mandatory Default Description
key yes API key for service.
audioFile yes Audio file in one of the supported formats (mp3, wav or
m4a).
lang yes Language code of the audio.
model no Model name. Models can be specifically designed for a
particular user application. Contact SYSTRAN for more
information on how to get a specific model for a language,
dialect or use case).
sampling no high Sampling quality of audio file. Two quality levels are
supported: “high” for wide band audio such as radio and TV
broadcast (sampling higher or equal to 15 kHz), or “low”
(telephone data with sampling rates higher of equal to 8
kHz). It is highly recommended to not use a bit rate lower
than 32 kbps.
maxSpeaker no 1/infinity Maximum number of speakers. Default is “1” for “low”
sampling and infinity for “high”.
callback no JavaScript callback function for JSONP support.

SYSTRAN Pure Neural® Server REST API 147


Request to analyze the audio file in body of the request (form data mode)
You can call the SPNS REST API by passing all the parameters except the audio file parameter in the query string
format. The audio file should be included as form data.

POST <SPNS Gateway URL>/multimodal/speech/transcribe?key=<API key>&lang=<language code>


<filename>

Restrictions
• Maximum size of an audi0 file is limited to 100 MB or 2 hours.
• The requested URL, including parameters, must be less than 2K bytes.

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": "", /* Error at request level */
"channels": [
{
"id": "1",
"signalDuration": "12.41",
"speechDuration": "10.64",
"nbWords": "24",
"textConfidence": "0.95"
}
],
"speakers": [
{
"gender": "female",
"channel": "1",
"duration": "10.64",
"id": "FS1",
"nbWords": "24",
"textConfidence": "0.95",
"langConfidence": "1.00",
"lang": "eng-usa"
}
],
"segments": [
{
"channel": "1",
"speechConfidence": "1.00",
"start": "0.42",
"end": "11.06",
"speaker": "FS1",
"lang": "eng-usa",
"langConfidence": "1.00",
"words": [
{
"start": "0.72",
"duration": "0.25",
"confidence": "0.975",

SYSTRAN Pure Neural® Server REST API 148


"text": " Hello "
},
{
"start": "0.97",
"duration": "0.14",
"confidence": "0.976",
"text": " . "
},
{
"start": "1.11",
"duration": "0.20",
"confidence": "0.734",
"text": " World "
}
]
}
]
}

Examples
Audio transcription from file
http --form POST <SPNS Gateway URL>/multimodal/speech/transcribe lang==en sampling==high
key==<API key> audioFile@test-en-generic.mp3

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 21:55:26 GMT
Transfer-Encoding: chunked
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"channels": [
{
"id": "1",
"nbWords": 5,
"signalDuration": 1.04,
"speechDuration": 1.02,
"textConfidence": 1
}
],
"segments": [
{
"channel": "1",
"end": 1.03,
"lang": "eng-usa",
"langConfidence": 1,
"speaker": {
"gender": "male",
"id": "1"
},
"speechConfidence": 1,
"start": 0.01,
"words": [

SYSTRAN Pure Neural® Server REST API 149


{
"confidence": 0.998,
"duration": 0.21,
"nextStart": 0.38,
"start": 0.17,
"text": "This"
},
{
"confidence": 0.997,
"duration": 0.12,
"nextStart": 0.5,
"start": 0.38,
"text": "is"
},
{
"confidence": 0.988,
"duration": 0.09,
"nextStart": 0.59,
"start": 0.5,
"text": "a"
},
{
"confidence": 0.998,
"duration": 0.42,
"nextStart": 1.01,
"start": 0.59,
"text": "test"
},
{
"confidence": 0.999,
"duration": 0,
"start": 1.01,
"text": "."
}
]
}
],
"speakers": [
{
"channel": "1",
"duration": 1.02,
"gender": "male",
"id": "1",
"lang": "eng-usa",
"langConfidence": 1,
"nbWords": 5,
"textConfidence": 1
}
],
"transcript": "#TM\n#ENCODING=UTF-8\n# EN \t\nThis is a test .\t\n"
}

Multimodal Speech Align


Aligns provided text with an audio file, by matching text words with the audio equivalent.

Multimodal Speech Align Calling Style


The specific format to align the text with the audio is:

SYSTRAN Pure Neural® Server REST API 150


POST <SPNS Gateway URL>/multimodal/speech/align?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• audioFile
• textFile
• lang

All other request parameters are optional.

Multimodal Speech Align Request Parameters


The Multimodal Speech Align request parameters you can use with the SPNS REST API are summarized in the
following table.

Multimodal Speech Align Parameters


Parameter Mandatory Default Description
key yes API key for service.
audioFile yes Audio file in one of the supported formats (mp3,
wav or m4a).
textFile yes Plain text file (ASCII, ISO-8859 or UTF-8 encoded)
that includes one sentence or clause per line ending
with a punctuation mark.
lang yes Language code of the audio. Note that this feature
is limited to Dutch (nl), French (fr), English (en),
German (de), Italian (it) and Spanish (es).
model no Model name. Models can be specifically designed
for a particular user application. Contact SYSTRAN
for more information on how to get a specific
model for a language, dialect or use case).
sampling no high Sampling quality of audio file. Two quality levels
are supported: “high” for wide band audio such as
radio and TV broadcast (sampling higher or equal
to 15 kHz), or “low” (telephone data with sampling
rates higher of equal to 8 kHz). It is highly
recommended to not use a bit rate lower than 32
kbps.
callback no JavaScript callback function for JSONP support.

Request to analyze the audio file in body of the request (form data mode)
You can call the SPNS REST API by passing all the parameters except the audio and text file parameters in the
query string format. The audio and text files should be included as form data.

SYSTRAN Pure Neural® Server REST API 151


POST <SPNS Gateway URL>/multimodal/speech/transcribe?key=<API key>&lang=<language code> <audio
filename> <text filename>

Restrictions
• Maximum size of an audi0 file is limited to 100 MB or 2 hours.
• The requested URL, including parameters, must be less than 2K bytes.

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": "", /* Error at request level */
"channels": [
{
"id": "1",
"signalDuration": "10.99",
"speechDuration": "10.28",
"nbWords": "25",
"textConfidence": "0.95"
}
],
"segments": [
{
"channel": "1",
"start": "0.71",
"end": "10.99",
"lang": "eng",
"textConfidence": "0.95",
"words": [
{
"id": "1",
"start": "0.71",
"duration": "0.32",
"confidence": "0.990",
"text": " Okay "
},
{
"id": "2",
"start": "1.03",
"duration": "0.00",
"confidence": "0.100",
"text": " , "
}
]
}
]
}

SYSTRAN Pure Neural® Server REST API 152


Examples
Alignment of text and audio
more test-en-generic.txt
This is a test .

http --form POST <SPNS Gateway URL>/multimodal/speech/align lang==en key==<API key>


audioFile@test-en-generic.mp3 textFile@test-en-generic.txt

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 21:56:52 GMT
Transfer-Encoding: chunked
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"channels": [
{
"id": "1",
"nbWords": 5,
"signalDuration": 1,
"speechDuration": 0.82,
"textConfidence": 0.98
}
],
"segments": [
{
"channel": "1",
"end": 1,
"lang": "eng-usa",
"start": 0.18,
"textConfidence": 0.98,
"words": [
{
"confidence": 0.99,
"duration": 0.19,
"id": "1",
"nextStart": 0.37,
"start": 0.18,
"text": "This"
},
{
"confidence": 0.99,
"duration": 0.15,
"id": "2",
"nextStart": 0.52,
"start": 0.37,
"text": "is"
},
{
"confidence": 0.99,
"duration": 0.06,
"id": "3",
"nextStart": 0.58,
"start": 0.52,

SYSTRAN Pure Neural® Server REST API 153


"text": "a"
},
{
"confidence": 0.99,
"duration": 0.42,
"id": "4",
"nextStart": 1,
"start": 0.58,
"text": "test"
},
{
"confidence": 0.95,
"duration": 0,
"id": "5",
"start": 1,
"text": "."
}
]
}
]
}

Multimodal Speech Segment


Segment an audio file.

Multimodal Speech Segment Calling Style


The specific format to segment an audio file is:

POST <SPNS Gateway URL>/multimodal/speech/segment?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• audioFile

All other request parameters are optional.

Multimodal Speech Segment Request Parameters


The Multimodal Speech Segment request parameters you can use with the SPNS REST API are summarized in the
following table.

Multimodal Speech Segment Parameters


Parameter Mandatory Default Description
key yes API key for service.
audioFile yes Audio file in one of the supported formats (mp3, wav or
m4a).

SYSTRAN Pure Neural® Server REST API 154


Parameter Mandatory Default Description
sampling no high Sampling quality of audio file. Two quality levels are
supported: “high” for wide band audio such as radio and TV
broadcast (sampling higher or equal to 15 kHz), or “low”
(telephone data with sampling rates higher of equal to 8
kHz). It is highly recommended to not use a bit rate lower
than 32 kbps.
maxSpeaker no 1/infinity Maximum number of speakers. Default is “1” for “low”
sampling and infinity for “high”.
callback no JavaScript callback function for JSONP support.

Request to analyze the audio file in body of the request (form data mode)
You can call the SPNS REST API by passing all the parameters except the audio file parameter in the query string
format. The audio file should be included as form data.

POST <SPNS Gateway URL>/multimodal/speech/segment?key=<API key> <filename>

Restrictions
• Maximum size of an audi0 file is limited to 100 MB or 2 hours.
• The requested URL, including parameters, must be less than 2K bytes.

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": "", /* Error at request level */
"channels": [
{
"id": "1",
"signalDuration": "12.41",
"speechDuration": "11.06"
}
],
"speakers": [
{
"gender": "female",
"channel": "1",
"duration": "11.06",
"id": "FS1"
}
],
"segments": [
{
"channel": "1",
"speechConfidence": "1.00",
"start": "0.01",
"end": "11.07",
"speaker": "FS1"

SYSTRAN Pure Neural® Server REST API 155


}
]
}

Examples
Speech segmentation of audio file
http --form POST <SPNS Gateway URL>/multimodal/speech/segment key==<API key> audioFile@test-
en-generic.mp3

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 250
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 21:57:49 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"channels": [
{
"id": "1",
"signalDuration": 1.04,
"speechDuration": 1.02
}
],
"segments": [
{
"channel": "1",
"end": 1.03,
"speaker": {
"gender": "male",
"id": "1"
},
"speechConfidence": 1,
"start": 0.01
}
],
"speakers": [
{
"channel": "1",
"duration": 1.02,
"gender": "male",
"id": "1"
}
]
}

Multimodal Speech Language Detection


Language detection identifies the language based on audio provided and returns the identified language code and
confidence. Detection is typically more accurate with more audio.

Multimodal Speech Language Detection Calling Style


The specific format to detect the language of the audio is:

SYSTRAN Pure Neural® Server REST API 156


POST <SPNS Gateway URL>//multimodal/speech/detectLanguage?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameters are required for each request:

• key
• audioFile

All other request parameters are optional.

Multimodal Speech Language Detection Request Parameters


The Multimodal Speech Language Detection request parameters you can use with the SPNS REST API are
summarized in the following table.

Multimodal Speech Language Detection Parameters


Parameter Mandatory Default Description
key yes API key for service.
audioFile yes Audio file in one of the supported formats (mp3, wav or
m4a).
sampling no high Sampling quality of audio file. Two quality levels are
supported: “high” for wide band audio such as radio and TV
broadcast (sampling higher or equal to 15 kHz), or “low”
(telephone data with sampling rates higher of equal to 8
kHz). It is highly recommended to not use a bit rate lower
than 32 kbps.
maxSpeaker no 1/infinity Maximum number of speakers. Default is “1” for “low”
sampling and infinity for “high”.
callback no JavaScript callback function for JSONP support.

Request to analyze the audio file in body of the request (form data mode)
You can call the SPNS REST API by passing all the parameters except the audio file parameter in the query string
format. The audio file should be included as form data.

POST <SPNS Gateway URL> /multimodal/speech/detectLanguage?key=<API key> <filename>

Restrictions
• Maximum size of an audi0 file is limited to 100 MB or 2 hours.
• The requested URL, including parameters, must be less than 2K bytes.

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

SYSTRAN Pure Neural® Server REST API 157


{
"error": "", /* Error at request level */
"languages": [
{
"confidence": 0.75,
"languageCode": "eng"
}
]
}

Examples
Language detection of audio file
http --form POST <SPNS Gateway URL>/multimodal/speech/detectLanguage key==<API key>
audioFile@test-fr-generic.mp3

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 56
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 22:02:11 GMT
Vary: X-HTTP-Method-Override, Accept-Encoding

{
"languages": [
{
"confidence": 0.99,
"languageCode": "fre"
}
]
}

Multimodal Speech Supported Languages


Provides a list of languages (in ISO-639-1 two-letter language codes) for which the Multimodal Speech REST APIs
is supported, excepted as noted in specific APIs.

Multimodal Speech Supported Languages Calling Style


The specific format to list the supported languages is:

GET <SPNS Gateway URL> /multimodal/speech/supportedLanguages?<parameters>

where <parameters> are any parameters to apply to the query.

The following parameter is required for each request:

• key

SYSTRAN Pure Neural® Server REST API 158


All other request parameters are optional.

Multimodal Speech Supported Languages Request Parameters


The Multimodal Speech Supported Languages request parameters you can use with the SPNS REST API are
summarized in the following table.

Multimodal Speech Supported Languages Parameters


Parameter Mandatory Default Description
key yes API key for service.
callback no JavaScript callback function for JSONP support.

Request with Query String Parameters


You can call the SPNS REST API by passing all the parameters in the query string format.

GET <SPNS Gateway URL> /multimodal/speech/supportedLanguages?key=<API key>

Response
HTTP Status Code
If the request succeeds, the HTTP Status Code will be 200 OK.
Response body
The response body will be a JSON object:

{
"error": "", /* Error at request level */
"languages": [
"ar",
"nl",
"en",
"fi",
"fr",
"de",
"el",
"it",
"lt",
"zh",
"pl",
"pt",
"ro",
"ru",
"es",
"tr"
]
}

Examples
List all supported languages
http -v GET <SPNS Gateway URL>/multimodal/speech/supportedLanguages key==<API key>

GET /multimodal/speech/supportedLanguages?key=<API key> HTTP/1.1

SYSTRAN Pure Neural® Server REST API 159


Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: ssi-pnmt-benchmark-01.systran.us:8904
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 95
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Jan 2019 21:58:27 GMT
Vary: Accept-Encoding

{
"languages": [
"ar",
"nl",
"en",
"fi",
"fr",
"de",
"el",
"it",
"lt",
"zh",
"pl",
"pt",
"ro",
"ru",
"es",
"tr"
]
}

5. Usage Tips
General Guidance for Performing Translations
The SPNS REST API offers several ways to perform translations such as using text or files, and with a synchronous
or asynchronous pattern. These choices offer flexibility; however, it is important to understand the advantages
and disdavantages of the different approaches.

For quick translation of a small amount text (from a single sentence to a few sentences), the use of the text
approach (/translation/text/translate service) might be best. The source text may be specified as part of the URL
or referenced in a SYSTRAN-specific JSON (see “Text translation with JSON object” example). This JSON may
include other translation parameters. Th /translation/text/translate service only supports the synchronous
pattern, which relies upon a quick response from SPNS since it is limited by time-outs – both within the client
making the translation request as well as the SPNS system. Performing many such translation requests
simultaneously, or within a short amount of time may impact translation throughput depending on the
capabilities of the host system for SPNS.

SYSTRAN Pure Neural® Server REST API 160


When more text needs to be translated, it is better to do so using a file referenced in the translation request with
the /translation/file/translate service. This service supports many file formats including those from Microsoft
Office (Word, Excel, PowerPoint for example), plain text, HTML, XML (including standard translation-related
formats such as TMX and XLIFF), PDF and others. Files up to 50 MB (by default) may be translated.

Note!
The /translation/file/translate service provides the translated output from the PDF format in
the Microsoft Word/DOCX format. This provides the ability to edit and update the translated
results (for example, update of embedded images). All other file formats are provided in the
same format as the source data.

In terms of translation throughput, files with at least 100-200 sentences will work best. Larger files will obvioiusly
take longer to process than shorter ones, but the throughput (in terms of characters translated per second) will be
about the same. However, as mentioned with /translation/text/translate service, if a significant number of
translation requests are being performed simultaneously, or within a short amount of time, the throughput can be
affected. A best practice recommendation is to translate files using an asynchronous patterm. This means using
the /translation/file/translate service with the async parameter set “true”, followed by periodic checks using the
/translation/file/status service. Once the translation is complete, the translation results are obtained with the
/translation/file/results service. The frequency of the periodic checks depends on the application, the number of
pending translation requests and how quick the results must be obtained. We would recommend at least a 500-
millisecond delay between checks for a single translation request.

If it is important to keep a connection between the source and translated text, consider using the XLIFF format,
which is described elsewhere in this section. In XLIFF, each sentence is kept in a single “translation unit”, and may
include specialized tags. For example, it is possible to encode HTML snippets within a translation unit, or other
formats. Some industry tools do just this, using XLIFF as the basis for translation (either machine/automated or
human) after converting Microsoft Office, HTML and other formats to XLIFF.

Customizing Translations with Dictionary and Corpus Entries


You can customize translations using dictionary and corpus API services. The dictionary API services within the
Resources REST API allow you to build a list of terms and phrases that will be automatically matched during
translation. Each entry can be associated with a priority, which indicates the importance of the match. To use the
custom dictionary, you must associate with an active profile.

The corpus API services within the Resources REST API allow you to build a list of translation memories (or TMs).
A translation memory are exact matches of source text segments that will be replace the corresponding target
text segment defined in a corpus. This matching will override any attempt to translate to the source text. To use
one or more corpora in translation, you specify the corpus identifiers in the withCorpus parameter that is
available in the Translation REST API services. You can search specific segments with a corpus using the corpus
match API. The search can find exact matches and fuzzy (inexact) matches.

Adding Annotations to Translations


Annotations are only visible in HTML as HTML attributes. Therefore, to see annotations for plain text you need to
enclose the text with the following HTML elements: <html><body>...</body></html>. The annotations can be
seen with source (if withSource and withAnnotations parameters are set “true”). For annotations in the output
(translated text), only the withAnnotations parameter needs to be set “true”. Below is an example.

http -v GET <SPNS Gateway URL>/translation/text/translate key==<API key> source==en target==fr


format==html withSource==true withAnnotations==true input=="<html><body>The sky is
blue.</body></html>

SYSTRAN Pure Neural® Server REST API 161


GET
/translation/text/translate?target=fr&source=en&format=html&withAnnotations=true&withSource=tr
ue&key=<API key>&input=%3Chtml%3E%3Cbody%3EThe+sky+is+blue.%3C%2Fbody%3E%3C%2Fhtml%3E HTTP/1.1

Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 08 Dec 2016 18:11:46 GMT
Transfer-Encoding: chunked
Vary: Accept-Encoding

{
"outputs": [
{
"output": "<html>\n<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">\n<body><span class=\"systran_seg\" id=\"Sp1.s1.1_o\"><span
class=\"systran_token_word\" value=\"*\" id=\"p1.t1.1_0\">Le</span> <span
class=\"systran_token_word\" value=\"1010/noun:common\" id=\"p1.t1.1_2\">ciel</span> <span
class=\"systran_token_word\" value=\"4004/aux:plain\" id=\"p1.t1.1_3\">est</span> <span
class=\"systran_token_word\" value=\"2020/adj:base\" id=\"p1.t1.1_4\">bleu</span><span
class=\"systran_token_punctuation\" id=\"p1.t1.1_5\">.</span></span></body></html>",
"source": "<html>\n<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=UTF-8\">\n<body><span class=\"systran_seg\" id=\"Sp1.s1.1_o\"><span
class=\"systran_lemma\" value=\"the\" id=\"p1.t1.1_1\"><span class=\"systran_token_word\"
value=\"3c3d/det\" id=\"p1.t1.1_1\">The</span></span> <span class=\"systran_lemma\"
value=\"sky\" id=\"p1.t1.1_2\"><span class=\"systran_token_word\" value=\"1010/noun:common\"
id=\"p1.t1.1_2\">sky</span></span> <span class=\"systran_lemma\" value=\"be\"
id=\"p1.t1.1_3\"><span class=\"systran_token_word\" value=\"4004/aux:plain\"
id=\"p1.t1.1_3\">is</span></span> <span class=\"systran_amb_adjective/noun\"
value=\"&lt;reference&gt;blue&lt;/reference&gt;&lt;choice value='adjective'
default='yes'/&gt;&lt;choice value='noun'/&gt;\" id=\"p1.t1.1_1\"><span
class=\"systran_lemma\" value=\"blue\" id=\"p1.t1.1_4\"><span class=\"systran_token_word\"
value=\"2020/adj:base\" id=\"p1.t1.1_4\">blue</span></span></span><span
class=\"systran_lemma\" value=\".\" id=\"p1.t1.1_5\"><span class=\"systran_token_punctuation\"
value=\"cccc/punct\" id=\"p1.t1.1_5\">.</span></span></span></body></html>"
}
]
}

Below is a description of the annotation tags.

SYSTRAN Pure Neural® Server REST API 162


Annotation Tags
Tag Description
systran_seg Represents a segment/sentence.

Example: <span class="systran_seg" id="Sp1.s1.1_o">


• “Sp1.s1” part of the “id” indicates it is a first paragraph
(<p>).
• “1_0” indicates the segment identifier.
• Therefore, an “id” of “Sp1.s1.1_0” means the first segment
in the first paragraph. An “id” such as “Sp2.s2.2_0” means
the second segment in the second paragraph.
systran_token_word and Represents a word or punctuation.
systran_token_punctuation
Example: <span class="systran_token_punctuation"
value="cccc/punct" id="p1.t1.1_6">.</span>
• “p1.t1” part of the “id” indicates it is the first paragraph.
• “1_6” indicates the 6th token in the first sentence. This
being with “1” for the 1st token, “2” for the 2nd token and so
forth. This continues on for all segments/sentences in a
paragraph.

Example: <span class="systran_token_word" value="3c3d/det"


id="p1.t1.2_7">The</span>
• Again, the “p1t1” indicates the first paragraph.
• “2_7” indicates the 7th token in the second sentence.
• The notation after the “/” in the “value” represents the part-
of-speech (“det” in this case, or determinant). In some
cases, there is a sub-part-of-speech. The four characters
prior to the “/” is a SYSTRAN-specific part-of-speech code.

Note that the counter increments regardless of token type


(systran_token_word or systran_token_punctuation). The
token increment restarts at “1” in each paragraph.
systran_lemma This tag only appears in the source, and specifies the dictionary
form of the token. For example, dictionary form of the token is
"be" if token is "am/are/is/was/were/been", or “friend” if token is
“Friends”.

Example: <span class="systran_lemma" value="be"


id="p1.t1.1_2">
<span class="systran_token_word" value="4004/aux:plain"
id="p1.t1.1_2">is</span>
</span>
systran_amb Represents part-of-speech ambiguity between noun and verb.

Example: <span class="systran_amb_noun/verb"


value="&lt;reference&gt;paragraph&lt;/reference&gt;&lt;choice
value='noun' default='yes'/&gt;&lt;choice value='verb'/&gt;"
id="p1.t1.1_3">
• The chosen part-of-speech is indicated by “choice”, which is
“noun” in this example.

SYSTRAN Pure Neural® Server REST API 163


Below is the list of the most common parts-of-speech. The sub-parts-of-speech depend on the main part-of-
speech. For example, an “entity” can be “url”, “email” or “date”, and a “verb” can be “present”, “past”, “future”,
and so forth.

Parts-of-speech (POS) Tags


POS Description
abbr Abbreviation
adj Adjective
adv Adverb
conj Conjunction
det Determinant
entity Entity
intj Interjection
nfw Not-found-word
noun Noun
numeric Numeric
particle Particle
pron Pronoun
symbol Symbol
verb Verb

Translating with Do-not-translate Tags


It is possible to mark some text with do-not-translate tags to prevent translation of that text. The “dnt_entity”
XML markup tag is used for this purpose and may include an optional part-of-speech (POS) attribute, which
instructs the translator on how best to treat the text within the translation. The default POS is “adv” (Adverb).
This can be done for simple text translations, and file translations for specific formats (see list below).

• Plain text
• Microsoft Word DOCX
• Microsoft PowerPoint PPTX
• Microsoft Excel XLSX
• Adobe PDF
• Rich Text Format
• OpenDocument Text ODT
• OpenDocument Spreadsheet ODS
• OpenDocument Presentation ODP

more test-dnt.txt
The quick brown fox jumps over the lazy dog.

The quick brown <dnt_entity POS="noun">fox</dnt_entity> jumps over the lazy dog.

http -v POST <SPNS Gateway URL>/translation/file/translate key==<API key> source==en


target==fr rawBody==true @test-dnt.txt

POST /translation/file/translate?key=<API key>&source=en&target=fr&rawBody=true HTTP/1.1


Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 127
Content-Type: text/plain

SYSTRAN Pure Neural® Server REST API 164


Host: <SPNS Gateway URL>
User-Agent: HTTPie/0.9.2

The quick brown fox jumps over the lazy dog.

The quick brown <dnt_entity POS="noun">fox</dnt_entity> jumps over the lazy dog.

HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Requested-With,Content-Type,X-HTTP-METHOD-OVERRIDE,X-User-
Agent
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 139
Date: Thu, 03 Jan 2019 23:18:49 GMT
Vary: X-HTTP-Method-Override

Le renard brun saute au-dessus du chien paresseux.

Le brun rapide <dnt_entité POS="noun">fox</dnt_entité> saute sur le chien paresseux.

Translating with XLIFF Data


XLIFF (XML Localization Interchange File Format) is a popular standard format used for handling localizable
textual data. It is supported by many products (including SPNS) and is a good way for handling translation of data
in a structured format. The XML format consists of one or more “translation units” that typically include a single
sentence or segment per translation unit – both source and translation. The XLIFF standard is defined by versions
1.1, 1.2, 2.0 and 2.1. SPNS only supports XLIFF 1.2 (see http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html)
with some conditions and restrictions as follow.

• It requires the <seg-source> element.


• Only the <bpt>, <ept> and <ph> inline tags are supported.

If it is necessary to ensure a connection between source and translated text sentence-by-sentence, XLIFF is the
recommended format choice.

Examples
XLIFF Source Example
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" original="dummy.xml" datatype="mimetype" mimetype="text/xml">
<body>
<trans-unit id="0">
<source>A sample sentence to be translated.</source>
<seg-source>
<mrk id="1" type="seg" mtype="seg">A sample sentence to be translated.</mrk>
</seg-source>
</trans-unit>
<trans-unit id="1">
<source>Another sample sentence to be translated.</source>
<seg-source>
<mrk id="1" type="seg" mtype="seg">Another sample sentence to be translated. </mrk>
</seg-source>
</trans-unit>
</body>
</file>

SYSTRAN Pure Neural® Server REST API 165


</xliff>

XLIFF Translation Example


<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xlf="urn:oasis:names:tc:xliff:document:1.2"
xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" original="dummy.xml" datatype="mimetype" mimetype="text/xml">
<body>
<trans-unit id="0">
<source xmlns="" id="0">A sample sentence to be translated.</source>
<target xmlns="" id="0">翻訳されるサンプル文。</target>
</trans-unit>
<trans-unit id="1">
<source xmlns="" id="1">Another sample sentence to be translated.</source>
<target xmlns="" id="1">別の翻訳されるサンプル文。</target>
</trans-unit>
</body>
</file>
</xliff>

Important!
XLIFF translation units may include inline tags (<bpt>, <ept> and <ph>). The SPNS REST API
does not guarantee that all tags within the <source> element are also present in the <target>
element, or that these tags are in the proper order. It is the responsibility of the calling
application to verify this.

6. Language Code Values


The supported language codes to be used or returned by these APIs are the typically the two-letter codes defined
by the ISO 639-1:2002, Codes for the representation of names of languages – Part 1: Alpha-2 code standard, with
some exceptions. Those marked with "*" are specific to SYSTRAN and Chinese is separated by script into
“Simplified” and “Traditional”, which is indicated by the addition of the script name. Refer to the column “ISO
639-1 code” of this list: http://www.loc.gov/standards/iso639-2/php/code_list.php. The value can also be set to
auto for the source for translation requests, in order to activate automatic language detection.

Two-Letter Language Codes


Language Code
Albanian sq
Amharic am
Arabic ar
Armenian hy
Azerbaijani az
Basque eu
Bengali bn
Bulgarian bg
Catalan ca
Chinese zh-Hans (or zh)
(Simplified)
Chinese zh-Hant (or zt*)
(Traditional)
Croatian hr

SYSTRAN Pure Neural® Server REST API 166


Language Code
Czech cs
Danish da
Dari dr*
Dutch nl
English en
Estonian et
Finnish fi
French fr
German de
Greek el
Hausa ha
Hebrew he
Hindi hi
Hungarian hu
Icelandic is
Indonesian id
Italian it
Japanese ja
Korean ko
Kurdish ku
Latvian lv
Lithuanian lt
Malay ms
Norwegian no
Pashto ps
Persian fa
Polish pl
Portuguese pt
Punjabi pa
(Gurmukhi)
Punjabi pu*
(Shahmukhi)
Romanian ro
Russian ru
Serbian (Cyrillic) sr
Serbian (Latin) sb*
Slovak sk
Slovenian sl
Somali so
Spanish es
Swahili sw
Swedish sv
Tajik (Cyrillic) tj*
Tajik (Farsi) tg
Tamil ta
Thai th
Turkish tr
Ukrainian uk
Urdu ur

SYSTRAN Pure Neural® Server REST API 167


Language Code
Vietnamese vi
Welsh cy

For the Multimodal Speech APIs, the language codes used as input are also the same two-letter codes defined in
the previous table, but limited to the languages specified in the list of ISO 639-2/B three-letter language codes in
the following table. The languages returned by the Multimodal Speech APIs are the three-letter language codes.

Multimodal Speech Three-Letter Language Codes


Language Code
Arabic ara
Chinese chi
(Simplified)
Chinese chi
(Traditional)
Dutch dut
English eng
Finnish fin
French fre
German ger
Greek gre
Italian ita
Korean kor
Lithuanian lit
Polish pol
Portuguese por
Romanian rum
Russian rus
Spanish spa
Turkish tur
Undetermined und

7. Domain Values
Domains are translation rules and terms specific to a topic such as automotive, construction or medical. The
SPNS domains will depend on those translation resources (TRs) that are installed. The most common domain is
“Generic”.

8. Terminology
This provides a list of terms often used with language translation, including some SYSTRAN specific terms.

Term List
Term Meaning
Homograph A word or phrase that can be more than one part-of-
speech or meaning. For example, the word “advocate”
may be a noun or a verb.
HT Human Translation.

SYSTRAN Pure Neural® Server REST API 168


Term Meaning
Lemma A canonical form, dictionary form or citation form of a
set of word. For example, “run”, “runs” and “running”
are forms of the lemma “run”.
MT Machine Translation.
PNMT Pure Neural® Machine Translation. SYSTRAN’s name for
its neural-network-based machine translation.
POS Part-Of-Speech. For example, “noun”, “adverb” and
“adjective”.
RBMT Rule-Based Machine Translation. Translation performed
using linguistic information based on human-coded
grammatical rules along with various dictionaries.
SMT Statistical Machine Translation. Translations based on
bilingual corpus using a package such as Moses.
SPE Statistical Post-Editing. Translation using a hybrid
approach where initial translations are done using
RBMT, which is followed by a statistical machine
translation.
TM Translation Memory. A segment, sentence, paragraph or
sentence like unit used to improve translations by either
HT or MT. For example, a TM may be a heading, title or
command sentence provided in two or more languages.
A TM may be automatically used for either exact
matches or approximate matches depending on the
localization application.
TMX Translation Memory eXchange format. A standard XML-
based file format used for exchanging translation
memories between localization applications.
TR Translation Resource. There are different types of TRs,
including TRs for translation, file format conversion and
statistical model (such as Moses). For translation TRs,
the files included in the TR will vary depending on the
type of translation – RBMT, PNMT, SPE or SMT.
UD User Dictionary. A custom dictionary of words and
phrases in two or more languages used to improve
translations.
UTF-8 Unicode Translation Format-8 bit. A common character
encoding of text used by many localization applications.
Characters are represented by one or more 8-bit bytes.
UUID Universally Unique IDentifier. A value used for
identifying various SPNS components, such as TRs. For
example, “123e4567-e89b-12d3-a456-426655440000”.
XLIFF XML Localization Interchange File Format. A standard
XML-based interchange file format used by many
localization applications. It has similarities to the TMX
standard.

9. References
REST:
[1] http://en.wikipedia.org/wiki/Representational_state_transfer

SYSTRAN Pure Neural® Server REST API 169


JSONP:
[2] http://en.wikipedia.org/wiki/JSONP

CORS:
[3] http://www.w3.org/TR/cors/

JSON:
[4] http://en.wikipedia.org/wiki/JSON
[5] http://json.org

HTTPIE:
[6] https://github.com/jakubroztocil/httpie

10. Releases
This provides information based on SPNS releases and is divided between the APIs. Any “breaking change” (a
change that requires an application code change) is noted.

SPNS REST API


Translation REST API
2.1.1
• Added new /translation/feedback/add service to update the Feedback suggestions.
• [Breaking change] For translation of XLIFF files, no longer support the following inline elements: <bx/>,
<ex/>, <x/> and <g/>.
2.1.0
• The /translation/profiles service now returns the translator selectors for each translator.
• The withInfo parameter for /translation/file/translate now works for both synchronous and
asynchronous translations. Previously, this only worked with the former. The output from this
parameter is one part of a multi-part output.
2.0.0
• [Breaking change] Profile selection is now done using “selectors” for “owner”, “domain” and “size”. All
profile identifiers are UUIDs (Universally Unique Identifiers) instead of integers. Profiles may no longer
share the same profile identifier.
• [Breaking change] For /translation/text/translate and /translation/file/translate, a new parameter –
withInfo – to provide processing statistics, selected routes, language detection results and other
information. Prior to this change, language detection results were automatically provided and in a
different form.
1.0.0
• Initial SPNS Translation REST API.

Resources Corpus REST API


1.0.0
• [Breaking change] The /resources/apiVersion is now two separate services:
/resources/corpus/apiVersion and /resources/dictionary/apiVersion.

Resources Dictionary REST API


1.0.0
• [Breaking change] The /resources/apiVersion is now two separate services:
/resources/corpus/apiVersion and /resources/dictionary/apiVersion.

NLP LID REST API


1.0.0

SYSTRAN Pure Neural® Server REST API 170


• Added the /nlp/lid/detectLanguage/document service for language detection, along with
/nlp/lid/apiVersion and /nlp/lid/supportedFormats.

Multimodal Speech REST API


2.0.0
• Added support for Nuance Transcription Engine.
• [Breaking change] The /multimodal/speech/detectLanguage service only returns the identified language
and confidence. It no longer provides the speaker or channel details.
1.0.0
• Added the /multimodal/speech APIs for audio transcription, language detection, alignment and list of
supported speech languages.

11. Technical Support


For assistance or more information, please contact SYSTRAN Technical Support at:

Support Form: http://www.systransoft.com/contact/support/server-products

12. Copyright
Copyright © 2016-2019 SYSTRAN. All Rights Reserved.
Information in this document is subject to change without notice. The software described in this document is
furnished under a license agreement or a nondisclosure agreement. The software may be used or copied only in
accordance with the terms of those agreements. No part of this publication may be reproduced, stored in a
retrieval system, or transmitted by any means, electronic or mechanical, including photocopying and recording,
for any purchaser’s personal use without the written permission of SYSTRAN.

SYSTRAN Pure Neural® Server REST API 171

You might also like