beginners-pytorch-deep-learning
beginners-pytorch-deep-learning copied to clipboard
problem with googletrans and 'the cat sat on the mat'
after installing with 'pip install googletrans' to the anaconda env for pytorch
the line:
sentences = ['The cat sat on the mat']
translations_fr = translator.translate(sentences, dest='fr')
throws an error: File "myuser\anaconda3\envs\PyTc\lib\site-packages\googletrans\gtoken.py", line 62, in _update code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'
how can i make this nice tool work?!
That error is currently under review, see the package's open issue. I'll open a PR.
--> Please try googletrans==3.1.0a0
instead. It's a temporary fix, but its effectiveness seems to depend on your local environment. Feedback is welcome!
I haven't tried nor tested it, but I've also encountered an alternative (for non-commmercial usage) called google_trans_new
: https://github.com/lushan88a/google_trans_new