Text prediction REST API, v1


https://api.imagineville.org/word/random

Returns random words drawn from the vocabulary.

Parameter Required/optional Description Valid values Default
num
Optional Number of results 1-100 5
vocab
Optional Vocabulary size to draw words from 1k, 5k, 10k, 20k, 40k, 100k, 500k 100k
sort
Optional Sorting of result words alpha = sort alphabetically A-Z
rev-alpha = sort reverse alphabetically Z-A
(none)
safe
Optional Safe mode, filters obscene words. on off

Example:
https://api.imagineville.org/word/random?num=3&vocab=1k&sort=alpha&safe=on
{
  "words": [
    "amazing",
    "news",
    "not"
  ]
}
    


https://api.imagineville.org/word/predict

Predict the most likely words based on what is to the left, right, and/or the prefix of the current word.

Parameter Required/optional Description Valid values Default
left
Optional Left text context One or more words separated by spaces (none)
right
Optional Right text context One or more words separated by spaces (none)
prefix
Optional Prefix of current word Sequence of one or more characters (none)
num
Optional Number of results 1-100 5
vocab
Optional Filter to words in this vocabulary size 1k, 5k, 10k, 20k, 40k, 100k, 500k 100k
sort
Optional Sorting of result words alpha = sort alphabetically A-Z
rev-alpha = sort reverse alphabetically Z-A
most likely first
safe
Optional Safe mode, filters obscene words. on off

Example:
https://api.imagineville.org/word/predict?left=this is a&prefix=t&right=message
{
  "words": [
    "text",
    "test",
    "total",
    "terrible",
    "true"
  ]
}
    


https://api.imagineville.org/sentence/likely

Returns the most likely words from a sentence. This is based on a left-to-right scoring of each word under the language model.

Parameter Required/optional Description Valid values Default
text
Required Sentence text Sequence of words separated by spaces (none)
num
Optional Number of results 1-100 5
vocab
Optional Filter to words in this vocabulary size 1k, 5k, 10k, 20k, 40k, 100k, 500k 100k
sort
Optional Sorting of result words alpha = sort alphabetically A-Z
rev-alpha = sort reverse alphabetically Z-A
most likely first
safe
Optional Safe mode, filters obscene words. on off

Example:
https://api.imagineville.org/sentence/likely?text=i do not like neon zebras or others animals
{
  "words": [
    "not",
    "i",
    "like",
    "do",
    "or"
  ]
}
    


https://api.imagineville.org/sentence/unlikely

Returns the least likely words from a sentence. This is based on a left-to-right scoring of each word under the language model.

Parameter Required/optional Description Valid values Default
text
Required Sentence text Sequence of words separated by spaces (none)
num
Optional Number of results 1-100 5
vocab
Optional Filter to words in this vocabulary size 1k, 5k, 10k, 20k, 40k, 100k, 500k 100k
sort
Optional Sorting of result words alpha = sort alphabetically A-Z
rev-alpha = sort reverse alphabetically Z-A
least likely first
safe
Optional Safe mode, filters obscene words. on off

Example:
https://api.imagineville.org/sentence/unlikely?text=i do not like neon zebras or others animals
{
  "words": [
    "zebras",
    "neon",
    "animals",
    "others",
    "or"
  ]
}
    


https://api.imagineville.org/sentence/oov

Returns the words that are out-of-vocabulary in a sentence.

Parameter Required/optional Description Valid values Default
text
Required Sentence text Sequence of words separated by spaces (none)
num
Optional Number of results 1-100 5
vocab
Optional Vocabulary used to determine out-of-vocabulary words 1k, 5k, 10k, 20k, 40k, 100k, 500k 100k
sort
Optional Sorting of result words alpha = sort alphabetically A-Z
rev-alpha = sort reverse alphabetically Z-A
(none)
safe
Optional Safe mode, filters obscene words. on off

Example:
https://api.imagineville.org/sentence/oov?vocab=1k&text=it was the epoch of belief it was the epoch of incredulity
{
  "words": [
    "epoch",
    "belief",
    "incredulity"
  ]
}
    


https://api.imagineville.org/sentence/perplexity

Returns the per-word perplexity of a sentence.

Parameter Required/optional Description Valid values Default
text
Required Sentence text Sequence of words separated by spaces (none)

Example:
https://api.imagineville.org/sentence/perplexity?text=i like neon zebras
2181.753470691329