API that gives word based on alphabet

19 views
Skip to first unread message

Devendra Khatri

unread,
Apr 14, 2018, 7:18:33 AM4/14/18
to Wordnik API
Hello,

I am looking for an API where I would send one alphabet and response would give me a random word that starts with the requested alphabet. 
Is there such API available !! or any guess If I can achieve it anyway..

I addition I wanna know.. To what extent the APIs are free to use in my app.


Regards

Vedant Patel

unread,
Apr 14, 2018, 9:29:16 AM4/14/18
to Wordnik API
I don't know enough to answer the second part of your request. But i think i found a solution to the first part.

So there is no proper solution to your problem. A roundabout way to do it is to use  /words.json/search/{query}.
For the parameters of the query:

minCorpusCount = 1
maxCorpusCount = -1
minDictionaryCount = 1
maxDictionaryCount = -1
minLength = 1
maxLength = -1

limit = 1
skip = 0


Now lets say your query (alphabet) is "r", the api call returns an object:

{
  "totalResults": 10916,
  "searchResults": [
    {
      "lexicality": 0,
      "count": 0,
      "word": "r"
    },
    {
      "lexicality": 0,
      "count": 7507178,
      "word": "right"
    }
  ]
}

If you observe the very first field of the json response, there 10000 words approximately starting with r.

To get a random word starting from "r" , use the "skip" field. Skip a random number of results to get a random word.


Its not the perfect solution, buts its a roundabout way to achieve it.


Devendra Khatri

unread,
Apr 16, 2018, 11:40:25 AM4/16/18
to Wordnik API
thanks , this helped...
Reply all
Reply to author
Forward
0 new messages