词典应用 [英] Dictionary Application

查看:97
本文介绍了词典应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个需要英文单词字典的iphone应用程序。你可以建议我任何一个链接,我可以从那里找到包含合理数量英文单词的数据库,其含义和例句。

I want to develop an iphone application that needs an english word dictionary. Can you people suggest me any link from where i can have that database containing a reasonable number of english words with their meanings and example sentence.

提前感谢

推荐答案

更新



我最近发现一个比wiktionary更有用的API。似乎谷歌有一个谷歌词典你可以使用,虽然这是一个非官方的API。使用此查询:

Update

I recently found out about a much more useful API than wiktionary. It seems google has a "Google Dictionary" that you can use, though it's an unofficial API. Using this query:


http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q= {query}& sl = en& tl = en& restrict = pr%2Cde& client = te

http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q={query}&sl=en&tl=en&restrict=pr%2Cde&client=te

您可以从google字典获取JSON结果。将您的关键字替换为 {query} (例如 q = dog )。显然这是google docs使用的字典,也可能是一些chrome扩展名。

You can get a JSON result from google dictionary. Substitute your keyword for {query} (eg q=dog). Apparently this is the dictionary that google docs uses, and possibly some chrome extensions.

资料来源: Google操作系统(博客)

PS:评论还提到Dictionary.com的API。

PS: The comments also mention an API for Dictionary.com.

可以通过Mediawiki的API访问Wikitionary的数据。这可能足以满足您的需要。我不知道你可以使用的任何预先制作的字典。如果您需要拼写检查,您可能可以在iPhone上获取 Aspell

You could access Wikitionary's data via Mediawiki's API. That might be enough for what you need. I don't know of any pre-made dictionaries you could use. If you need spell checking, you might be able to get Aspell working on iPhone.

链接:

  • Default page for wikionary's api, with a 'quick reference'
  • Mediawiki's API documentation

还可能包含API的包装已经用你需要的语言创建。有些在此页面上列出了

There may also be wrappers for the API already created in the language you need. Some are listed on this page.

如果没有这样做,你可以尝试刮一个其他的字典网站。

If that doesn't do it for you, you could try scraping one of the other dictionary websites too.

我可能只会尝试这是最后的手段,因为(据我所知),您无法轻松地获得任何 可用的结果,从查询wikitionary。但是,您可以获得一个条目的wiki代码。问题在于,您将不得不从该代码中提取重要信息。

I'd probably only try this as a last resort because (as far as I know) you can't get any easily usable results from querying wikitionary. You can get the wiki code for an entry, though. The problem with that is that you'll then have to somehow extract the important information from that code.

例如,进行以下查询(单击在浏览器中打开) ):

For example, take the following query (click to open in your browser):


http://en.wiktionary.org/w/api.php?action=query&titles=dog&prop=revisions& rvprop = content& format = xml

如果您阅读文档,您将看到这里的部分是 action = query titles = dog prop = revisions rvprop = content format = xml 。这些告诉api你想要什么它说我正在对标题狗的条目执行查询,我想要最新版本的内容是xml格式。

If you read the documentation, you'll see the parts here are action=query, titles=dog, prop=revisions, rvprop=content, and format=xml. These tell the api what you want. It says "I'm performing a query for the entry with title 'dog' and I want the content of the latest revision in xml format".

你得到的是:

<api>
  <query>
    <pages>
     <page pageid="24" ns="0" title="dog">
       <revisions>
         <rev xml:space="preserve">
{{also|DOG|dög}}
==English==
{{wikipedia}}
[[Image:YellowLabradorLooking.jpg|thumb|A dog (a [[Labrador]])]]
... (removed for brevity)
          </rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>

您必须以某种方式处理。

You'll have to process that somehow.

无论如何,您可以自己创建http请求字符串,或者您可以使用一个包装器来进行查询的硬工作。

Anyway, you can create the http request strings yourself, or you can use a wrapper for the api that does the "hard" work of making queries.

这篇关于词典应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆