Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when using the command "from polyglot.detect import Detector"

I was playing with the polyglot function to convert the text from one language to another like Spanish to English.

I was following the instructions to install the Polyglot and the required modules.

But while running the code

from polyglot.detect import Detector

I am getting this error:

Traceback (most recent call last):   
  File "<pyshell#8>", line 1, in <module>
    from polyglot.detect import Detector   
  File "C:\Python34\lib\site-packages\polyglot-15.5.2-py3.4.egg\polyglot\detect\__init__.py", line 1, in <module>
    from .base import Detector, Language   
  File "C:\Python34\lib\site-packages\polyglot-15.5.2-py3.4.egg\polyglot\detect\base.py", line 11, in <module>
    from icu import Locale ImportError: No module named 'icu'

I'm not sure what I need to be doing.

Can anyone please help?

like image 595
Rajni Avatar asked Jul 28 '15 16:07

Rajni


2 Answers

You need to install the libraries polyglot, PyICU and pycld2 with the commands:

pip install polyglot
pip install PyICU
pip install pycld2
like image 83
Priyansh gupta Avatar answered Oct 21 '22 01:10

Priyansh gupta


You need to install https://github.com/ovalhub/pyicu

pip install pyicu
like image 30
Vic Nicethemer Avatar answered Oct 21 '22 01:10

Vic Nicethemer