查询英语单词的中文释义,并自动生成两个例句。
python3 scripts/dict.py <单词>
示例:
python3 scripts/dict.py hello
python3 scripts/dict.py python
python3 scripts/dict.py beautiful
📚 HELLO
音标: /həˈloʊ/
词性: int./n.
📖 中文释义:
1. 你好
2. 喂
3. 打招呼
💬 例句:
1. Hello! It's so great to see you again!
(中文翻译请自行理解或查询)
2. Hello, could you help me with this?
(中文翻译请自行理解或查询)
当前包含以下基础词汇:
如需查询更多单词,建议配置外部词典API:
# 在 dict.py 中添加
import requests
def youdao_lookup(word):
url = f"https://dict.youdao.com/jsonresult?q={word}"
response = requests.get(url)
return response.json()
需要在 https://developer.oxforddictionaries.com/ 申请 API Key
编辑脚本中的 BASIC_DICT 字典,添加新单词:
BASIC_DICT = {
"yourword": {
"phonetic": "/pronunciation/",
"meanings": ["意思1", "意思2"],
"pos": "词性"
}
}
脚本根据词性自动选择合适的例句模板:
共 1 个版本