Simple wrapper for Youdao online translate (Chinese <-> English) service API, as an alternative to the StarDict Console Version(sdcv).
注意
本工具已经停止公共服务。用户若要继续使用,需申请一个私人的有道智云 API Key配置使用。 大致步骤为: 翻译实例-创建实例-选“文本翻译”, 我的应用-创建应用-接入方式:API-选择绑定刚才创建的自然语言翻译服务-文本翻译实例。 得到的应用ID / 应用密钥即为本工具的YDAPPID/YDAPPSEC。
本工具可通过环境变量YDCV_YOUDAO_APPID和YDCV_YOUDAO_APPSEC和ini文件方式配置key。配置文件默认为~/.ydcv,也可用--config指定。 配置文件例子:
[YDCV] YDAPPID=123456 YDAPPSEC=abcd1234
Usage
$ ydcv --help
usage: ydcv.py [-h] [-f] [-s] [-S] [-r] [-p {festival,mpg123,sox,mpv}]
[-a {auto,uk,us}] [-x] [--color {always,auto,never}]
[-F {zh-CHS,ja,EN,ko,fr,ru,pt,es,vi,de,ar,id}]
[-t {zh-CHS,ja,EN,ko,fr,ru,pt,es,vi,de,ar,id}]
[words [words ...]]
Youdao Console Version
positional arguments:
words words to lookup, or quoted sentences to translate.
optional arguments:
-h, --help show this help message and exit
-f, --full print full web reference, only the first 3 results
will be printed without this flag.
-s, --simple only show explainations. argument "-f" will not take
effect.
-S, --speech print URL to speech audio.
-r, --read read out the word with player provided by "-p" option.
-p {festival,mpg123,sox,mpv}, --player {festival,mpg123,sox,mpv}
read out the word with this play.Default to 'festival'
or can be 'mpg123', 'sox', 'mpv'.-S option is required
if player is not festival.
-a {auto,uk,us}, --accent {auto,uk,us}
set default accent to read the word in. Default to
'auto' or can be 'uk', or 'us'.
-x, --selection show explaination of current selection.
--color {always,auto,never}
colorize the output. Default to 'auto' or can be
'never' or 'always'.
-F {zh-CHS,ja,EN,ko,fr,ru,pt,es,vi,de,ar,id}, --from {zh-CHS,ja,EN,ko,fr,ru,pt,es,vi,de,ar,id}
Translate from specific language. Default: EN
-t {zh-CHS,ja,EN,ko,fr,ru,pt,es,vi,de,ar,id}, --to {zh-CHS,ja,EN,ko,fr,ru,pt,es,vi,de,ar,id}
Translate to specific language. Default: zh-CHS
翻译支持的语言列表
--from 和 --to参数可以指定特定语言之间相互翻译,但只有中文结果有词典内容
语言 |
代码 |
语言 |
代码 |
语言 |
代码 |
语言 |
代码 |
|---|---|---|---|---|---|---|---|
中文 |
zh-CHS |
葡萄牙文 |
pt |
韩文 |
ko |
德文 |
de |
日文 |
ja |
西班牙文 |
es |
法文 |
fr |
阿拉伯文 |
ar |
英文 |
EN |
越南文 |
vi |
俄文 |
ru |
印尼文 |
id |
Installation
pip install ydcv
Environment
Python ( >=2.7, 3.x )
Similar Projects on github
Lang |
Project |
Author |
|---|---|---|
Go |
boypt |
|
RUST |
farseerfc |
|
RUST |
passchaos |
|
Powershell |
atupal |
|
BASH |
MasterCsquare |
|
Perl |
JaHIY |
|
C |
proudzhu |
|
C++ |
proudzhu |
|
Vim |
bennyyip |
|
Erlang |
zhenglinj |
|
Haskell |
proudzhu |
Metadata
Release files for ydcv 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ydcv-0.7.tar.gz | 21.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ydcv-0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.6 kB
Release files / ydcv-0.7.tar.gz
| Download URL | ydcv-0.7.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53cd59501557496512470e7db5fb14e42ddcb411fe4fa45c00864d919393c1da
|
|
BLAKE2b-256 checksum How to use checksums |
1f2917124ebfdea8d810774977474a8652018c04c4a6db1ca413189f7e5b9d52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
|
Release files / ydcv-0.7-py3-none-any.whl
| Download URL | ydcv-0.7-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
596d960617556f5687e42134193c3b3d33d605be6b8ad71d601dd3f5d1a7288b
|
|
BLAKE2b-256 checksum How to use checksums |
7e111656bb33c5d30569468678c8ff3c32140f16f5255e3e087576ddbb85ffb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
|
Security for ydcv 0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.