stardict 字典命令行版本 sdcv

StarDict Dictionaries

StarDict is a Cross-Platform and international dictionary written in Gtk. It has powerful features such as "Glob-style pattern matching", "Scan selection word," "Fuzzy query," etc.

星际译王是跨平台的国际词典软件!它功能强大,实用性强,“通配符匹配”,“鼠标查词”,“模糊查询”等功能倍受青睐!星际译王3.0版更增加了全文翻译,网络词典等新功能。

主页:

http://stardict-4.sourceforge.net/index_en.php
http://stardict-4.sourceforge.net/index_cn.php

Dictionary storage

User dictionaries are stored in ~/.stardict/dic; system dictionaries in /usr/share/stardict/dic.

下载词典

词典数据包下载地址

http://download.huzheng.org/
http://download.huzheng.org/zh_CN/

将词典解压后存放至 ~/.stardict/dic ,如果目录不存在,则 mkdir -p ~/.stardict/dic 手动创建。

推荐词典

  • xdict-ec-gb dictionary(en - zh_CN)
  • langdao-ec-gb dictionary(en - zh_CN) 朗道英汉字典
  • lazyworm-ec dictionary(en - zh_CN) 懒虫简明英汉词典
词典 格式 详情
langdao-ec-gb dictionary(en - zh_CN) 朗道英汉字典 tarbal GPL, 9.1M, 435468 words. 推荐!
langdao-ce-gb dictionary(zh_CN - en) 朗道汉英字典 tarbal GPL, 7.8M, 405719 words. 推荐!
xdict-ec-gb dictionary(en - zh_CN) tarbal GPL, 3.5M, 177842 words
xdict-ce-gb dictionary(zh_CN - en) tarbal GPL, 2.4M, 160997 words.
xdict-ec-gb dictionary fix(en - zh_CN) tarbal GPL, 3.6M, 177817 words
xdict-ce-gb dictionary fix(zh_CN - en) tarbal GPL, 2.4M, 160995 words.
lazyworm-ec dictionary(en - zh_CN) 懒虫简明英汉词典 tarbal GPL, 10M, 452185 words.
lazyworm-ce dictionary(zh_CN - en) 懒虫简明汉英词典 tarball GPL, 1.7M, 119592 words.
简明英汉词典 tarball 10M.
英汉双解计算机词典 tarball 3.1M.
五笔86 tarball Free to use , 835K, 78641 words
五笔98 tarball Free to use , 842K, 78597 words

Client : sdcv

sdcv = stardict console version ,即终端下的 stardict 词典

Installation

For command line queries I recommend sdcv, which is available in the app-text/sdcv package in Gentoo.

sudo emerge -av ap-text/sdcv

Usage

  • 查看可用词典
sdcv -l
Dictionary's name   Word count
五笔86    78641
英汉双解计算机词典    21138
StarDict dictionary    9
朗道英汉字典5.0    435468
CDICT5英汉辞典    57510
XDICT英汉辞典    177842
  • 选择词典
sdcv -u 朗道英汉字典5.0 computer
Found 1 items, similar to computer.
-->朗道英汉字典5.0
-->computer

*[kәm'pju:tә]
n. 电脑, 电子计算机
【计】 计算机
【经】 电子计算机, 电脑
  • alias
alias trans="sdcv --utf8-output --color -u 朗道英汉字典5.0"
  • pager

For your convenience, set up the following in a script or shell alias.

dict.sh

sdcv -n --utf8-output --color "$@" 2>&1 | \
fold --width=$(tput cols) | \
less -FRX

划词翻译

vim侧栏

在vim中调用sdcv并在左侧显示光标处字典内容。在vimrc中加入:

"sdvc{{{
"use sdcv instead man
set keywordprg=sdcv\ -u\ 朗道英汉字典5.0
" F key call sdcv 
function! Mydict()
    let retstr=system('sdcv '.expand("<cword>"))
    windo if expand("%")=="dict-win" |q!|endif
    30vsp dict-win
    setlocal buftype=nofile bufhidden=hide noswapfile
    1s/^/\=retstr/
    1
endfunction
nnoremap F :call Mydict()<CR>
"}}}

系统环境

配置脚本 xsdcv.sh ,自定义快捷按键运行脚本。

#!/bin/bash
word=`xclip -out`
mean=`sdcv -n ${word}|grep "^[a-z]"`
pkill notify-osd
notify-send "$mean"
上一篇:2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】


下一篇:接口测试 Mock 实战(二) | 结合 jq 完成批量化的手工 Mock