安慰剂版本,一个简单的写作

ydcv的Python项目详细描述


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_APPIDYDCV_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

LangProjectAuthor
Goydgoboypt
RUSTydcv-rsfarseerfc
RUSTydcv-rustpasschaos
Powershellydcv.ps1atupal
BASHydcv-bash-versionMasterCsquare
PerlydcvJaHIY
Ccydcvproudzhu
C++ydcv-cppproudzhu
Vimydcv.vimbennyyip
Erlangydcv-elzhenglinj
Haskellydcv-hsproudzhu

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
WebLogic10.3JAR包含Weblogic的java。马绍尔群岛共和国。远程异常   JavaHibernate不更新或删除,但插入   java检查字段是否被覆盖   java程序只发送一次消息   使用DefaultDesktopManager对JInternalFrame进行图标化时出现java异常   如何在firebase数据库安卓 studio/java中检索特定子级的数据?   java JsonIllegalstateexception:应为BEGIN_数组,但在第1行第61列为字符串。$顾客数据   javascript在使用Angular JS调用HTML文件中的函数时遇到问题   在Java中填充多维数组   java selenium webdriverXpath不适用于列表   在不同bean上运行事务的java抛出异常   java我可以知道backoffice用户是否忘记保存其更改吗?   数学算术运算   java如何格式化和比较来自bash/vm的输入?   关闭JDBC连接时出现java问题   java错误:无法解析MyFirstApp教程中的符号“edit_message”   java将/n替换为带返回码的真正utf8