>

These endpoints provide word predictions and auto-corrections based on client-provided distributions over possible characters.

Here are some test pages for the endpoints:


rec/distrib

Returns the most likely text given a sequence of distributions over possible characters. Optionally can return word completion predictions based on the observation sequence being the prefix of a word. Call should be via a POST containing JSON with the following key/value pairs:

Parameter Required Description Valid values Default
left
no Left text context One or more words separated by spaces (none)
right
no Right text context One or more words separated by spaces (none)
numBest
no Number of best recognition results Positive integer 5
numPrefix
no Number of prefix word completion results Non-negative integer 0
vocab
no Filter to text only containing words in the specified vocabulary 1k, 5k, 10k, 20k, 40k, 100k, 500k 100k
sort
no Sorting of result words alpha = alphabetically A-Z
rev-alpha = reverse alphabetically Z-A
logprob = log probability, largest first
rev-logprob = log probability, smallest first
logprob
safe
no Safe mode, remove hypotheses that contain any obscene words true or false false
singleWord
no Restricts recognition hypotheses to single words true or false true
exactContext no Client is providing exact left and right context including any spaces or sentence start/end words (for experts) true or false false
lang
no Language code Language to use (see list) en
config
no Configuration code Recognition configuration to use (see list) en
distribs
yes List of distributions to recognize against See details below (none)

The distribs parameter is a list of the user's input distributions. Each distribution contains the following:

Key Required Description Valid values Default
distrib yes Distributions over possible characters A list with 0 or more items containing: text and logProb. (none)
time no Time of input double value (none)

Notes:

Example POST request:

BASE_URL/rec/disitrib
{
    "left"       : "this is a",
    "right"      : "message",
    "numBest"    : 2,
    "numPrefix"  : 3,
    "vocab"      : "100k",
    "sort"       : "logprob",
    "safe"       : false,
    "singleWord" : true,
    "distribs"   : [ { "distrib" : [ {"text": "t", "logProb": -1.23},
                                     {"text": "r", "logProb": -2.34},
                                     {"text": "y", "logProb": -3.45}
                                   ],
                       "time"    : 0.123
                     },
                     { "distrib" : [ {"text": "e", "logProb": -1.56},
                                     {"text": "w", "logProb": -3.43},
                                     {"text": "r", "logProb": -4.84}
                                   ],
                       "time"    : 0.234
                     }
                   ]
}

Example response:

{
    "best": [
        {
            "text": "te",
            "logProb": -14.897991
        },
        {
            "text": "re",
            "logProb": -16.703276
        }
    ],
    "prefix": [
        {
            "text": "text",
            "logProb": -10.180267
        },
        {
            "text": "team",
            "logProb": -12.689505
        },
        {
            "text": "terror",
            "logProb": -13.126982
        }
    ]
}