If you want to use Google Translate and Microsoft Bing Translate for free, you may consider the following Python-based wrappers:
+ Code: Google Translate; Bing Translate
+ Samples:
# Google Translate
import googletrans
gs = googletrans.Googletrans()
import googletrans
gs = googletrans.Googletrans()
languages = gs.get_languages()
print(languages['en'])
print(languages['en'])
print(gs.translate('hello', 'de'))
print(gs.translate('hello', 'zh'))
print(gs.translate('hello', 'vi'))
print(gs.translate('hello', 'zh'))
print(gs.translate('hello', 'vi'))
print(gs.detect('some English words'))
#Bing Translate
from mstranslator import Translator
translator =
Translator('cdvhoang', 'HlUUMftdkETWa8E9/jzD4l1CzC8sOhRSJxH+kk0MDBg=')
Translator('cdvhoang', 'HlUUMftdkETWa8E9/jzD4l1CzC8sOhRSJxH+kk0MDBg=')
print(translator.translate('hello', lang_from='en', lang_to='vi'))
*** Please note that I don't encourage to use the wrapper for Google Translate because you should respect and pay for using its service (simply it's now commercialized ^_^).
No comments:
Post a Comment