![]() ![]() Notice how I have successfully translated the Japanese phrase for “Good morning” into English. Let’s use TextBlob to do that now: UTF8ipxm > text = u"おはようございます。" Once instantiated, we can call the translate() method of the TextBlob class and perform the automatic text translation. Notice how we are importing the TextBlob class - this class enables us to automatically analyze a piece of text for tags, noun phrases, and yes, even language translation. Next, you should familiarize yourself with the library by opening a Python shell: $ python ![]() Once textblob is installed, you should run the following command to download the Natural Language Toolkit (NLTK) corpora that textblob uses to automatically analyze text: $ python -m textblob.download_corpora If not, you can install it with pip: $ pip install textblob If you’ve followed the development environment configuration instructions from an earlier tutorial, then you should already have textblob installed on your system. To translate text from one language to another, we’ll use the textblob Python package ( ). Translating Text to Different Languages with TextBlob We’ll wrap up the tutorial with a discussion of our OCR and text translation results. From there, we’ll review our project directory structure and implement our OCR and text translation Python script. In the first part of this tutorial, we’ll briefly discuss the textblob package and how it can be used to translate text. Review the results of the text translation.Implement a Python script that OCRs text and then translates it. ![]() ![]()
0 Comments
Leave a Reply. |