2

im trying to translate some sentences by using textblob from arabic to english,it was working when suddenly i started getting this errors

from textblob import TextBlob

en_blob = TextBlob(u'انا سعيد') 

print(en_blob.translate(to='en'))

getting this error


  File "C:\Users\USER\Anaconda3\lib\site-packages\textblob\translate.py", line 61, in translate
    self._validate_translation(source, result)

  File "C:\Users\USER\Anaconda3\lib\site-packages\textblob\translate.py", line 84, in _validate_translation
    if result.strip() == source.strip():

AttributeError: 'list' object has no attribute 'strip'
  • Guessing that's a bug in `textblob`, but as noted in the textblob source: "TextBlob.translate is deprecated and will be removed in a future release. Use the official Google Translate API instead." - see https://github.com/sloria/TextBlob/blob/dev/textblob/blob.py#L564 – Brad Solomon Mar 19 '21 at 19:04
  • Google Translate REST API docs can be found [here](https://cloud.google.com/translate/docs/basic/translating-text). All textblob was doing is calling them under the hood anyway. – Brad Solomon Mar 19 '21 at 19:04
  • the point is that im doing a project that i used in it google_trans and BlobText packages and i want to continue the calculations using them – Kassem Jeha Mar 19 '21 at 19:32

0 Answers0