Home > python > A thin Python API for wordnik.com

A thin Python API for wordnik.com

In my current project I wanted to get the definition of a word. In addition, it’d be nice to see some examples with the given word. How to do that?

In Google you can use the search term “define:word” (example). It shows you the definition, some synonyms, and it can even pronounce the word for you. Nice, but I didn’t want to parse HTML. I wanted a clean API for getting all these data.

Wiktionary is an open dictionary. It has an API but I wasn’t fully satisfied with it. You can get the definition of a word as raw text (word, raw text), but it’s not that easy to extract what you want. They also provide the content in JSON format, but there the whole content was grouped in a string. Not too convenient.

And finally I found wordnik.com that provided exactly what I needed. They have a REST API (here), which is freely available, but first you need to request your own API key. The result is provided in JSON format. They have a Python client API but I wanted something simpler, so I wrote my own (wordnik.py).


# input: barkeeper
# output:
A person who owns or operates a bar for the sale of alcoholic beverages.
(1) Aaron called the barkeeper over and asked for a beer.

Related posts
I built a simple interactive, command-line dictionary that uses this thin API (see here).

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: