接入教程
https://api.datamuse.com/words?ml=ringing+in+the+earshttps://api.datamuse.com/words?rel_rhy=forgetfulhttps://api.datamuse.com/sug?s=hipp1. 查询含义相近的词语:
2. 查询押韵词:
3. 联想补全:
4. 返回JSON数组包含word与score字段。
5. 每天100000次免费额度,无需Key。
Python 查询相似词
python
import requests
r = requests.get("https://api.datamuse.com/words", params={"ml": "happy"})
print([w["word"] for w in r.json()])
PHP 查询相似词
php
<?php
$url = 'https://api.datamuse.com/words?ml=happy';
$data = json_decode(file_get_contents($url), true);
foreach ($data as $w) { echo $w['word'] . PHP_EOL; }
JavaScript 查询相似词
javascript
fetch('https://api.datamuse.com/words?ml=happy')
.then(r => r.json())
.then(arr => arr.forEach(w => console.log(w.word)));
常见问题
需要Key吗?
当前无需Key,每天免费100000次请求。
免费额度多少?
每天100000次,超出可能被限速。
Aitishiku.com