Python ProgrammingPython Programming

Language detection and translation using TextBlob

The TextBlob library uses Google Translate to detect a text's language and translate TextBlobs, Sentences and Words into other languages.


Language detection and translation using TextBlob

from textblob import TextBlob

blob = TextBlob("Comment vas-tu?")

print(blob.detect_language())

print(blob.translate(to='es'))
print(blob.translate(to='en'))
print(blob.translate(to='zh'))

fr
¿Como estas tu?
How are you?
你好吗?