The URL structure for requesting TM suggestions is
<SERVER>/tmserver/<SOURCE_LANGUAGE>/<TARGET_LANGUAGE>/unit/<QUERY>
where:
Placeholder | Description |
---|---|
<SERVER> | The URL of the amaGama server |
<SOURCE_LANGUAGE> | Source language code: de, en, en_GB |
<TARGET_LANGUAGE> | Target language: ar, es_AR, fr, hi |
<QUERY> | The URL escaped string to be queried |
Note
<SOURCE_LANGUAGE>
and <TARGET_LANGUAGE>
should be language
codes in the form of LANG_COUNTRY where LANG is mandatory. LANG
should be a language code from ISO 639 and COUNTRY a
country code from ISO 3166. The
following are valid examples: ar, de, en, en_GB, es_AR, fr, gl, hi, tlh,...
For example:
http://amagama.locamotion.org/tmserver/en/af/unit/Computer
It is possible to provide some options in the request URL by using a query string with one or more or the following fields.
Option | Description |
---|---|
min_similarity | The minimum similarity between the string to be searched and the strings to match. See Levenshtein distance. Minimum possible value is 30. Default value is 70. |
max_candidates | The maximum number of results. Default value is 5. |
For example:
http://amagama.locamotion.org/tmserver/en/gl/unit/window?min_similarity=31&max_candidates=500
The results from a TM suggestion request are provided in JSON format. It is a list containing zero or more results. The results contain the following fields:
Field | Description |
---|---|
source | Matching unit’s source language text |
target | Matching unit’s target language test |
quality | A Levenshtein distance measure of quality as percent |
rank | ? |
An example:
[
{
"source": "Computer",
"quality": 100.0,
"target": "Rekenaar",
"rank": 100.0
},
{
"source": "Computers",
"quality": 88.888888888888886,
"target": "Rekenaars",
"rank": 100.0
},
{
"source": "&Computer",
"quality": 88.888888888888886,
"target": "Rekenaar",
"rank": 100.0
},
{
"source": "_Computer",
"quality": 88.888888888888886,
"target": "_Rekenaar",
"rank": 100.0
},
{
"source": "My Computer",
"quality": 72.727272727272734,
"target": "My Rekenaar",
"rank": 100.0
}
]