- python3 编写的有道词典 Windows 命令行版本
- 使用有道词典的 API,通过解析其返回的 JSON 数据,完成单词查询
- 支持中英互译,单词、短语,句子均可
- 查询记录储存在数据库,支持查询和清空记录
- 支持单词联想查询
- Windows 下代码页为 gbk 的不能显示音标,所以看音标要 chcp 65001 切换为 utf-8
项目来源
- 鉴于每次查询单词都要打开词典,鼠标点击查询窗口,输入单词,回车结束查询,好像比较麻烦。就想能不能通过终端来操作,所以就写了这个项目
- 所以现在查询单词是这样的 Windows + R, 键入 cmd,回车,输入 wd + 想要查询的内容, 再回车
安装
# 需要先设置和连接自己的数据库
python setup.py install
用法
>>> wd -h
>> Usage: wd <words> [-h] [-a] [-l] [-c]
Optional arguments:
words Can be a word or a sentence and it supports inter-traslation of Chinese-English
-h show this help message and exit
-a associate relative words
-l show query logs
-c clear query logs
查单词
>>> wd python
>> python : python
n. 巨蟒;大蟒
n. (法)皮东(人名)
python['蟒蛇', 'Python', '蟒属']
Burmese Python['缅甸蟒', '缅甸蟒', '黄金蟒']
Python regius['球蟒', '球蟒']
查句子
>>> wd where there is a will,there is a way
>> where there is a will,there is a way : 有志者事竟成,有一种方法
有志者事竟成
"Where there is a will,there is a way. "['世上无难事,只要肯攀登']
Where there is a will, there is a way .['有志者,事竟成。']
查中文
>>> wd 测试
>> 测试 : test
[试验] test
measurement
测试['Test', 'test', 'TST test']
测试条件['Testing Conditions', 'test condition', 'Condition']
集成测试['Integration testing', 'integration testing', 'Integrated Testing']
查询记录
>>> wd -l
>> Query logs:[Words]
You have queried for 3 Words
logs:
python
where there is a will,there is a way
测试
单词联想
>>> wd -a increm
>> Associate words:
incremate
incremation
increment
incremental
incrementation
清空数据
>>> wd -c
>> You have cleared your query logs
欢迎 Fork 和 Star