【发布时间】:2011-12-06 03:51:22
【问题描述】:
我正在开发一个 android 应用程序,我需要在其中选择一个单词并从 Google 显示它的定义。我必须使用 Google 提供的某些搜索 API 还是其他 API?
一个例子就可以了。谢谢!
【问题讨论】:
标签: android api search dictionary
我正在开发一个 android 应用程序,我需要在其中选择一个单词并从 Google 显示它的定义。我必须使用 Google 提供的某些搜索 API 还是其他 API?
一个例子就可以了。谢谢!
【问题讨论】:
标签: android api search dictionary
似乎Google Dictionary 不再可用,但即使它可用,API 也是unavailable to 3rd parties。相反,我找到了几个替代选项。
您可以使用所需语言的XDXF 到download a flat-file dictionary,并使用哈希表对文件进行适当的索引。
这有两个明显的优势:
支持字典查找不需要网络访问
它最终更加灵活,因为数据可以轻松操作(排序、过滤、特殊格式)以更好地支持应用程序设计和要求。
如果您不想自制自己的哈希表,abbreviations.com 有一个 public dictionary API,它使用 REST 来获取给定单词的 XML 格式的定义信息。
示例请求 URL:
http://www.abbreviations.com/services/v1/defs.aspx?tokenid=tk324324&word=consistent
示例响应:
<?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>
【讨论】: