Giter Club home page Giter Club logo

tub's Introduction

tub

tub use baidu 命令行翻译脚本^ _ ^

tub use baidu 命令行智能脚本^ _ ^

介绍

使用百度翻译api接口,在命令行使用python脚本翻译 tub具有两种模式,第一种也就是原始功能,即翻译功能(为translate模块);第二种则利用百度ai,能够进行对话,低智商问题的搜索(为robot模块)。

依赖:

安装:

源码安装

  • 首先在新建一个文件夹,建议在工作区目录下。这边我是在~/workspace/app目录下新建的文件夹,命令:mkdir tub
  • 然后进入新建的目录下,命令:cd tub
  • 下载源码,命令:git clone [email protected]:ZZP-DMU/tub.git
  • 创建虚拟环境所在文件夹,在tub目录下创建文件夹,这里命名为venv,命令: mkdir venv
  • 创建虚拟环境,命令:python3 -m venv ./venv
  • 修改tub文件,在tub文件第一行修改为#!../venv/bin/python3
  • 安装必要的工具包,命令: python3 -m pip install requests
  • 设置环境变量,对于bash,命令:echo "export PATH='PATH:~/workspace/app/tub'" >> ~/.bashrc;对于zsh,只需要将.bashrc改为.zshrc
  • 现在即可在命令行输入tub命令,初次运行需要设置自己的appid和秘钥,即在依赖中所提到的

pip安装

  • pip install tub

用法:

image

用法案例:

翻译英文:tub -c [english_word]

image

翻译中文:tub -e [chinese_word]

image

tub zh to en(? or puss 'q' to quit)提示后,命令q退出,cl改变语言,cm改变输出方式,clr清除屏幕,直接输入单词继续翻译

image

tub's People

Contributors

zzphub avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.