ICTRC / Parsivar

A Language Processing Toolkit for Persian
MIT License
226 stars 34 forks source link

Can not import this package on python 3.11 #24

Open tayyebehsaeedi opened 1 year ago

tayyebehsaeedi commented 1 year ago

Hi everyone When I want to import the Parivar package on Python 3.11, It can not be imported because of the 'Iterable' of the 'collections' package. Actually, the following code of the Parsivar package is not called: try:

Python <= 3.9

from collections import Iterable

except ImportError:

Python > 3.9

from collections.abc import Iterable

How can I fix this problem? I must mention that I install the Parsivar package by following the code: pip install git+https://github.com/ICTRC/Parsivar

Looking forward to hearing from you Best Regards Tayyebeh Saeedi

AmirMohamadBabaee commented 1 year ago

Hi, First of all, thanks for your excellent repository. I faced the same issue in Python 3.10.

Alirezab-2000 commented 1 year ago

I faced the same issue in python 3.10

hdeldar commented 1 year ago

Hi. @tayyebehsaeedi, thanks for your solution. My problem was solved by changing from collections import Iterable with from collections.abc import Iterable in file ..\Python311\Lib\site-packages\parsivar\token_merger.py which was installed with pip install parsiver .

translation-robot commented 8 months ago

Thank you the modified import worked for me on python 3.11, but I had to upgrade nltk

pip install nltk --upgrade

Successfully installed nltk-3.8.1

translation-robot commented 8 months ago

For python 3.11, setup.py should replace this line:

  install_requires=['nltk==3.6.6'],

by this line: install_requires=['nltk==3.8.1'],

Also mentioned in this post, replace in file token_merger.py:

Python <= 3.9

from collections import Iterable

Python > 3.9

from collections.abc import Iterable