Python implements automatic text translation

In programming life, sometimes we need to implement translation functions.
If we are training Chinese sentences, we need to turn the results into English.

Example

First, download the package, pip install translate

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: yudengwu(余登武)
# @Date  : 2020/9/14
#@email:[email protected]
from translate import Translator
translator= Translator(from_lang="chinese",to_lang="english")
translation = translator.translate("余登武喜欢的女明星是范冰冰")
print(translation)

After many experiments, the translation effect is worse than Youdao translation.

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/kobeyu652453/article/details/108578576