Dear API forum users,

Please note that our site is undergoing maintenance.
We apologize for any inconvenience, we should be back fully operational soon.

Please refrain from posting as new posts may not be saved during this period.

The Oxford dictionaries API team

Results for plural or derived words

The API yields a 404 code when a search is done for derived words. For example "home" will display results but "homes" will not. On your site's search "homes" is automatically replaced with "home" to show results. What would be a solution or good workaround to display results for the origin word?

Answers

  • joughtredjoughtred Member, Administrator, Moderator admin
    edited March 2017

    Hello @vaquero74

    I will just check in with my colleague and hopefully have an answer for you soon. Stay tuned!

  • joughtredjoughtred Member, Administrator, Moderator admin
    edited March 2017

    Hi @vaquero74,

    I have checked with our technical team and you will need to perform a two stage search.

    The first stage is to call on either the ‘search’ endpoint (this is good for vague matches) or the ‘lemmatron’ (for more specific matches). You can then take the relevant output from this to make a standard call.

    We hope you enjoy using the API.

  • eaparrotteaparrott Member

    Hi @vaquero74 ,
    I had the same question. When you are searching for the definition of a word in the plural inflection, you need to make two calls to the API. In the first call, you need to feed the plural form of the word into the lemmatron (see lemmatron documentation). The API will return an object that contains the base form of the word you are searching for. From there you have to take the base word and use the same dictionary entries API call you've probably been using. E.g. if you make a call to the lemmatron with the word 'oxen', the object you get back will contain 'ox'. Feed 'ox' (the origin word) into the dictionary entry definition API call and the result object from that call will contain the definition. The tricky part is that both calls use the same onPostExecute() method, and the second API call (the one that retrieves the definition) needs to occur within that onPostExecute() method, otherwise it will not work. It's a little strange. I got around this little glitch using a counter that would execute the desired parsing based on whether the counter was even or odd. The attached file lays out the groundwork for solving your problem in java code. Hope this helps,
    ~Eric P

Sign In or Register to comment.