Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典

1. 无道词典

 

项目地址:https://github.com/ChestnutHeng/Wudao-dict

直接下载:https://github.com/ChestnutHeng/Wudao-dict/archive/master.zip

无道词典,是一个简洁优雅的有道词典命令行版本。支持英汉互查的功能,包含释义、词组、例句等有助于学习的内容。

无道词典致力于做最好的命令行词典,随着我们优化排版、显示,增加生词本和补全功能,提供了良好的用户体验,并在不断改进中。

英汉:

Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典
Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典

汉英:

Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典

功能特性

  1. 基础词典(20w英汉查询 + 10w汉英查询 + 网络词库)
  2. 词组查询功能(例如直接输入wd in order to)
  3. 自动补全功能(按Tab自动补全单词,包含1w个最热的词)
  4. 生词本(自动把历史记录存为生词本,wd -h查看生词本文件位置)

安装说明

1.  安装环境: 需要python3和bs4, lxml(在线搜索用)

Debian/Ubuntu

sudo apt-get install python3
sudo apt-get install python3-pip
sudo pip3 install bs4
sudo pip3 install lxml

OpenSUSE

sudo zypper install python3-pip
sudo pip3 install bs4
sudo pip3 install lxml

CentOS

sudo yum install python34
sudo yum install python34-pip
sudo pip3 install bs4
sudo pip3 install lxml

 

2. 运行

git clone https://github.com/chestnutheng/wudao-dict
cd ./wudao-dict/wudao-dict
sudo bash setup.sh #或者sudo ./setup.sh

看到出现Setup Finished!表明安装成功。如果发生由于移动安装文件不能使用的情况,只需再次运行该脚本即可。

无法clone的,可以下载 https://github.com/ChestnutHeng/Wudao-dict/archive/master.zip ,然后解压安装使用。

Note: 注意python的版本,只支持python3

使用说明

运行wd -h查看使用说明。

$ wd -h
Usage: wd [OPTION]... [WORD]
Youdao is wudao, a powerful dict.
-k, --kill             kill the server process    (退出服务进程)
-h, --help             display this help and exit (查看帮助)
-s, --short-desc       do not show sentence       (只看释义)
-n, --not-save         query and save to notebook (不存入生词本)
生词本文件: ... some path .../notebook.txt
查询次数: ... some path .../usr_word.json

查词时可以直接使用wd 词语查汉英词典,或wd word查英汉词典(可以自动检测)。

小贴士

  1. ./wd_monofile 是本词典的在线查询的单文件版本, 可以复制到/usr/bin下直接使用.(需要安装bs4)
  2. 如果您不想看到例句, 请在/usr/bin/wd中的./wdd后面加上-s参数.
  3. 有的用户反馈字体颜色看不清的问题, 你可以找到./wudao-dict/wudao-dict/src/CommandDraw.py, 可以看到释义,读音等采用的颜色, 直接修改即可.
  4. 查询词组直接键入类似wd take off即可.

 

2. ICI金山词霸

 

项目地址:https://github.com/Flowerowl/ici

直接下载:https://github.com/Flowerowl/ici/archive/master.zip

一款基于python的命令行查词工具, 使用金山词霸api。

安装:

pip install ici

使用方法:

$ ici what

[wɒt]

[wɑ:t]

pron. (用以询问某人或某事物的词)什么,多少;…的事物;

adj. …的(事物或人);

adv. (用于感叹句中);

int. (用以表示不相信或惊奇);(用以表示未听清楚对方说的话);

ex. Compare the use of which and what as determiners and pronouns in questions. 试比较which和what用作限定词和代词时,在疑问句中的用法。

ex. We categorize functionally idiomsinto three types: ideational (e.g. Indian summer), interpersonal (e.g. What's up?) 我们将习语搭配按其功能分为三类:概念搭配(如Indiansummer),人际搭配(如What’s up?)

ex. The song is called What's Yr [your] Take on Cassavetes. 歌名就是“What'syr[your]TakeonCassavetes”。

ex. The questions such as"why""what""how"have been answered. 现有的研究基本上回答了有关语文课程资源建设的“为什么(why)”、“是什么(what)”及“怎么办(how)”的系列问题。

ex. Who, what, that, etc. are relatives. Who, what, that等是关系代词。

运行样例

Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典
Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典

 

3. Translate Shell 谷歌翻译

 

项目地址:https://github.com/soimort/translate-shell

直接下载:https://github.com/soimort/translate-shell/archive/develop.zip

Translate Shell (formerly Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing TranslatorYandex.TranslateDeepL Translator and Apertium. It gives you easy access to one of these translation engines in your terminal:

$ trans 'Saluton, Mondo!'
Saluton, Mondo!

Hello, World!

Translations of Saluton, Mondo!
[ Esperanto -> English ]
Saluton ,
    Hello,
Mondo !
    World!

By default, translations with detailed explanations are shown. You can also translate the text briefly: (only the most relevant translation will be shown)

$ trans -brief 'Saluton, Mondo!'
Hello, World!

Translate Shell can also be used like an interactive shell; input the text to be translated line by line:

$ trans -shell -brief
> Rien ne réussit comme le succès.
Nothing succeeds like success.
> Was mich nicht umbringt, macht mich stärker.
What does not kill me makes me stronger.
> Юмор есть остроумие глубокого чувства.
Humor has a deep sense of wit.
> 學而不思則罔,思而不學則殆。
Learning without thought is labor lost, thought without learning is perilous.
> 幸福になるためには、人から愛されるのが一番の近道。
In order to be happy, the best way is to be loved by people.

安装 Installation

选项1: 直接下载 Option #1. Direct Download

Download the self-contained executable and place it into your path. It’s everything you need.

$ wget git.io/trans
$ chmod +x ./trans

There is a GPG signature.

选项2 Option #2. From A Package Manager

Using Antigen (Recommended for Zsh users)

Add the following line to your .zshrc:

antigen bundle soimort/translate-shell

Using your favorite package manager

See wiki: Distros on how to install from a specific package manager on your distro.

Option #3. From Git (Recommended for seasoned hackers)

$ git clone https://github.com/soimort/translate-shell
$ cd translate-shell/
$ make
$ [sudo] make install

In case you have only zsh but not bash in your system, build with:

$ make TARGET=zsh

The default PREFIX of installation is /usr/local. To install the program to somewhere else (e.g. /usr~/.local), use:

$ [sudo] make PREFIX=/usr install

 

本文:Shell/Terminal: 命令行词典, 命令行字典, 命令行英汉字典, translate shell, 命令行查词工具, 终端字典

Leave a Reply