Use Baidu Translate via crawler

  In NLP tasks, it is a very common trick to increase the training set through data enhancement (such as EDA, back translation, etc.). Among them, back translation requires a translation system. However, because the construction of a translation system requires large-scale corpus and computing power, it is better to directly use the existing translation system. In addition, there are many scenes that need to be translated, so in order to meet everyone's needs, I take the time to write a blog for everyone using Baidu translation through crawlers.

  This time, the best choice is Baidu Translate, but please explain in advance that the script is only for learning, please do not abuse or commercialize it, otherwise you will be at your own risk.

  Although there are many similar blogs on the Internet, most of them are too rough to be conducive to the learning of novices. So I will prepare a very detailed blog for everyone.

1. Setting up the environment

1.1 Install Python library

pip install PyExecJS 
pip install requests

1.2 Install nodejs

  The nodejs download address is:

Guess you like

Origin blog.csdn.net/herosunly/article/details/113061056