字典API或库

Tre*_*rey 23 ruby api dictionary

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

我认为它应该像以下一样工作:

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

谢谢

小智 15

Wordnik.com有几个word-info API,包括定义API.更多信息在这里:http://developer.wordnik.com/

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


Ros*_*oss 14

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

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

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

http://dictionary.cambridge.org/learnenglish/results.asp?searchword=SEARCH_PHRASE&dict=L
Run Code Online (Sandbox Code Playgroud)

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

/* 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');
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 此服务似乎不再以答案作者描述的形式提供. (10认同)

Chr*_*nch 6

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

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