Created
January 9, 2021 12:35
-
-
Save JayantGoel001/115a7ff85d179731e3b9d0ca16e22008 to your computer and use it in GitHub Desktop.
Convert Any Text Language to Any Other Text Language using googletrans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from googletrans import Translator | |
text = ''' | |
J'ai erré seul comme un nuage | |
Qui flotte sur les hautes vallées et collines, | |
Quand tout à coup j'ai vu une foule, | |
Une foule, de jonquilles dorées; | |
Au bord du lac, sous les arbres, | |
flottant et dansant dans la brise. | |
''' | |
translator = Translator() | |
lang = translator.detect(text) | |
print(lang) | |
translated_lang = translator.translate(text, dest='en', src='fr') | |
print(translated_lang) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment