
unsplash 上的封面照片由 christopher gower
您是否正在开发语言学习应用程序、写作助手或任何涉及单词并需要 api 来检索单词含义的项目?免费词典 api 提供了一种免费且易于访问的方式,将语言数据合并到您的作品中。本文档将向您展示如何开始。
由 meetdeveloper 开发的免费词典 api,在 github 上拥有 2.6k star。 api 仅支持 get 请求,并提供单词定义和音标。
https://api.dictionaryapi.dev/api/v2/entries/en/<word>
此端点检索指定英文单词的字典信息。
api 有两个版本:v1 和 v2。主要区别在于响应结构。当前版本是 v2。
Shopxp购物系统历经多年的考验,并在推出shopxp免费购物系统下载之后,收到用户反馈的各种安全、漏洞、BUG、使用问题进行多次修补,已经从成熟迈向经典,再好的系统也会有问题,在完善的系统也从在安全漏洞,该系统完全开源可编辑,当您下载这套商城系统之后,可以结合自身的技术情况,进行开发完善,当然您如果有更好的建议可从官方网站提交给我们。Shopxp网上购物系统完整可用,无任何收费项目。该系统经过
1
api 返回一个 json 数组,其中包含单个对象,其中包含有关单词的详细信息,包括:
const word = "documentation";
fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${word}`)
.then(response => response.json())
.then(data => console.log(data));
[
{
"word": "documentation",
"phonetic": "/ˌdɒkjʊmənˈteɪʃən/",
"phonetics": [
{
"text": "/ˌdɒkjʊmənˈteɪʃən/",
"audio": ""
},
{
"text": "/ˌdɑkjəmənˈteɪʃən/",
"audio": ""
}
],
"meanings": [
{
"partofspeech": "noun",
"definitions": [
{
"definition": "something transposed from a thought to a document; the written account of an idea.",
"synonyms": [],
"antonyms": []
},
{
"definition": "documentary evidence and sources.",
"synonyms": [],
"antonyms": []
},
{
"definition": "documents that explain the operation of a particular machine or software program.",
"synonyms": [],
"antonyms": []
},
{
"definition": "comments that explain the usage of individual functions, libraries and blocks of code.",
"synonyms": [],
"antonyms": []
}
],
"synonyms": [],
"antonyms": []
}
],
"license": {
"name": "cc by-sa 3.0",
"url": "https://creativecommons.org/licenses/by-sa/3.0"
},
"sourceurls": [
"https://en.wiktionary.org/wiki/documentation"
]
}
]
const word = "software engineer";
fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${word}`)
.then(response => response.json())
.then(data => console.log(data));
{
"title": "No Definitions Found",
"message": "Sorry pal, we couldn't find definitions for the word you were looking for.",
"resolution": "You can try the search again at later time or head to the web instead."
}
此 api 目前不返回特定的成功或错误代码。
要尝试该 api 或支持 free dictionary api,请访问 free dictionary api 网站。
另请参阅 github 上的免费词典 api 项目。
以上就是如何使用免费词典API的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号