<p>Does anyone know of a good dictionary API or ruby library to lookup the definitions of words?</p>

<p>I'm thinking it should work something like:</p>

<ol>
<li>I call get_definition(word)</li>
<li>It returns the definition for that word (ideally in some way to easily format the definition for display.</li>
</ol>

<p>Thanks</p>

I discovered a webservice for this yesterday.
Go to the
British Council
homepage and double click on any word (that isn't already a hyperlink).
This should open a popup window with a Cambridge Dictionary definition in it. The API is relatively simple (and
it is
a public API, I checked it yesterday):
```
```
http://dictionary.cambridge.org/learnenglish/results.asp?searchword=SEARCH_PHRASE&dict=L
```
```
For reference, here's the code they use to launch this on double-click:
```
```
/* BC double-click pop-up dictionary */
var NS = (navigator.appName == "Netscape" || navigator.product == 'Gecko') ? 1 : 0;
if (NS) document.captureEvents(Event.DBLCLICK);
document.ondblclick = dict;
var dictvar;

function dict() {
    if (NS) {
        t = document.getSelection();
        pass_to_dictionary(t);
    } else {
        t = document.selection.createRange();
        if(document.selection.type == 'Text' && t.text != '') {
            document.selection.empty();
            pass_to_dictionary(t.text);
        }
    }
}

function pass_to_dictionary(text) {
    //alert(text);
    if (text > '') {
        window.open('http://dictionary.cambridge.org/learnenglish/results.asp?searchword='+text+ '&dict=L', 'dict_win', 'width=650,height=400,resizable=yes,scrollbars=yes');
    }
}
```
```