如何搜索词的定义? [英] How to search for word definitions?

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

问题描述

我正在 android 中开发一个应用程序,我需要在其中选择一个词并从 Google 显示其定义.我是否必须使用 Google 提供的某些搜索 API 或其他 API?

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?

举个例子就行.谢谢!

推荐答案

看来 Google Dictionary 没有不再可用,但即使可用,API 也不可用给第三者.相反,我找到了几个替代选项.

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.

您可以使用 XDXF下载您所需语言的平面文件字典,并使用哈希表适当地索引文件.

You could use XDXF to download a flat-file dictionary in your desired language, and use a hash table to index the file appropriately.

这有两个明显的优点:

  • 支持字典查找不需要网络访问

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

如果您不想自制哈希表,abbreviations.com 有一个 公共词典 API,它使用 REST 获取给定单词的 XML 格式的定义信息.

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.

示例请求网址:

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>

这篇关于如何搜索词的定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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