1 Star 0 Fork 0

WarrenZhang / fanyi.cli

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
Sync branch
Notice: Creating folder will generate an empty file .keep, because not support in Git


A CLI language translator using Baidu translation API



Just Download fanyi.cli.py directly.


1. For Linux user(and may be for macOS user):

You can run ./fanyi.cli.py directly. If it cannot work, just check if you have installed python3 on your computer and if you have add a symbolic link of python3 in /usr/bin, and try it again.

2. For Windows user:

Check if you have installed python3 on your machine firstly. Then run python3 fanyi.cli.py

3. Language support

Right now this applet only support "Chinese > English" and "English > Chinese" translating. You can specific -z, -c or -e argument to choose target language, besides the applet will choose target language automately.

4. Translate file

Right now this applet only support plain text file(like .txt file). You can specific -f [FILE PATH] argument to use this mode.

5. Exit

Type exit or quit in the Interactive interface.


1. Translating words

$ fanyi.cli.py
# Input text:
Speaking a foreign language is a high demand skill because of domestic cultural diversity and the number of companies doing business abroad. Foreign language skills can help you get jobs by enhancing your qualifications.
# Result:

2. Translating from standard i/o

$ fanyi.cli.py -t "Our understanding of the distribution of genetic variation in natural populations has been driven by mathematical models of the underlying biological and demographic processes. A key strength of such coalescent models is that they enable efficient simulation of data we might see under a variety of evolutionary scenarios."
# Result:

3. Translating from file

$ fanyi.cli.py --ori -f 'The Selfish Gene.txt'  # use `--ori` argument to show origin text.
# Origin:
Intelligent life on a planet comes of age when it first works out the reason for its own existence. If superior creatures from space ever visit earth, the first question they will ask, in order to assess the level of our civilization,is: 'Have they discovered evolution yet?' Living organisms had existed on earth, without ever knowing why,for over three thousand million years before the truth finally dawned on one of them. His name was Charles Darwin. To be fair,others had had inklings of the truth, but it was Darwin who first put together a coherent and tenable account of why we exist.Darwin made it possible for us to give a sensible answer to the curious child whose question heads this chapter. We no longer have to resort to superstition when faced with the deep problems: Is there a meaning to life? What are we for? What is man? After posing the last of these questions, the eminent zoologist G.G.Simpson put it thus: 'The point I want to make now is that all attempts to answer that question before 1859 are worthless and that we will be better off if we ignore them completely.'

# Result:
MIT License Copyright (c) 2022 ANOMS-top Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


一个基于百度翻译API的命令行翻译软件。 expand collapse


No release




Load More
can not load any more
马建仓 AI 助手


344bd9b3 5694891 D2dac590 5694891