字典API或库

有没有人知道一个好的词典API或ruby库来查找单词的定义?

我认为它应该是这样的:

  1. 我叫get_definition(word)
  2. 它返回该单词的定义(理想情况下以某种方式轻松格式化显示的定义)。

谢谢

Ruby-WordNet听起来像你正在寻找的东西:

Ruby-WordNet是WordNet®词汇数据库的Ruby接口。 WordNet是一个在线词汇参考系统,其设计灵感来自当前人类词汇记忆的心理语言学理论。 英语名词,动词,形容词和副词被组织成同义词集,每个表示一个潜在的词汇概念。 不同的关系链接同义词集。

Wordnik.com有几个word-info API,包括定义API。 更多信息请访问: http : //developer.wordnik.com/

[我为Wordnik工作。 我们很快会有更多的API,让我们知道你想要的!]

我昨天发现了这个网络服务。

转到英国文化协会主页,双击任何单词(这不是超链接)。

这应该打开一个弹出窗口,其中包含剑桥词典定义。 API相对简单( 它是一个公共API,我昨天检查过):

http://dictionary.cambridge.org/learnenglish/results.asp?searchword=SEARCH_PHRASE&dict=L 

作为参考,这是他们用来双击启动它的代码:

 /* 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'); } }