开发者

Dictionary Application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 6 years ago.

Improve this question

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 sente开发者_高级运维nce.

Thanks in advance


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

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.

Source: Google Operating System (blog)

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

Previous response

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.

Links:

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

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.

Edit

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

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".

What you get is:

<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.

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.


I you're looking for an offline paid option, you might want to have a look at lexicontext (full disclosure: it's mine)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜