I'm putting something together to return a short definition of a word using the Oxford API. (Happy to supply more details to anyone who needs some motivation to help with this problem!) You can get an API key for free that gives you 3,000 requests per month which should be more than enough for my intended use.
It mostly works pretty well...
The thing I can't work out how to do is search for variants - the things listed under 'also' on the main dictionary page.
so AWHETOS, RHAGADE, PIVA as examples.
These are returned under variantForms in the results on the entries endpoint if you search for the headword - e.g.
Code: Select all
{
"id": "aweto",
"metadata": {
"operation": "retrieve",
"provider": "Oxford University Press",
"schema": "RetrieveEntry"
},
"results": [
{
"id": "aweto",
"language": "en-gb",
"lexicalEntries": [
{
"entries": [
{
"etymologies": [
"mid 19th century. From Maori āwhato, āwheto any of various large caterpillars, including those affected by the Ophiocordyceps fungus"
],
"senses": [
{
"definitions": [
"A caterpillar of a New Zealand porina moth (genus Wiseana, family Hepialidae) that has been infected by the parasitic fungus Ophiocordyceps robertsii, which mummifies the insect below a covering of soil or leaf litter before sending up a slender fruiting body; also called vegetable caterpillar. In later use also: a caterpillar of the same family parasitized by the fungus O. sinensis, found in the highlands of central Asia and used in traditional medicine."
],
"id": "m_en_gb_oed13942.002"
}
],
"variantForms": [
{
"text": "aweta"
},
{
"text": "awhato"
},
{
"text": "awheto"
}
]
}
],
"language": "en-gb",
"lexicalCategory": {
"id": "noun",
"text": "Noun"
},
"text": "aweto"
}
],
"type": "headword",
"word": "aweto"
}
],
"word": "aweto"
}