Reputation: 8790
I am working on a app in android where I need to select a word and display its definition from Google. Do I have to use some search API provided by Google, or another API?
An example will do. Thanks!
Upvotes: 2
Views: 354
Reputation: 5286
It seems Google Dictionary is no longer available, but even when it was, the API was unavailable to 3rd parties. Instead, I found several alternative options.
You could use XDXF to download a flat-file dictionary in your desired language, and use a hash table to index the file appropriately.
This has two distinct advantages:
Network access is not required to support dictionary look-ups
It's ultimately more flexible because the data can be easily manipulated (sorted, filtered, specially formatted) to better support application design & requirements.
If you prefer not to home-brew your own hash-table, abbreviations.com has a public dictionary API that uses REST to obtain definition information in XML format for a given word.
Sample Request URL:
http://www.abbreviations.com/services/v1/defs.aspx?tokenid=tk324324&word=consistent
Sample Response:
<?xml version="1.0" encoding="UTF-8"?>
<results>
<result>
<term>consistent, uniform</term>
<definition>the same throughout in structure or composition</definition>
<partofspeech>adj</partofspeech>
<example>
bituminous coal is often treated as a consistent and homogeneous product
</example>
</result>
</results>
Upvotes: 1