estnltk / suffix-lemmatizer

Suffix Lemmatizer for Estonian
GNU General Public License v2.0
2 stars 1 forks source link

NameError: name 'xrange' is not defined #1

Open LeoHenryM opened 4 years ago

LeoHenryM commented 4 years ago

Tere!

I'm trying to use your lemmatizer, but there is an issue coming as soon as I tried to use the example you presented us:

from suffix_lemmatizer import SuffixLemmatizer
sl = SuffixLemmatizer()

I got the Error following:

Traceback (most recent call last):

  File "<ipython-input-6-aecbc67a68ca>", line 3, in <module>
    sl = SuffixLemmatizer()

  File "/opt/anaconda3/lib/python3.7/site-packages/suffix_lemmatizer-1.0.0-py3.7.egg/suffix_lemmatizer/lemmatizer.py", line 17, in __init__
    self.chnl_model = util.train_channel_model(suf_sub_func=self.get_suffix_sub)

  File "/opt/anaconda3/lib/python3.7/site-packages/suffix_lemmatizer-1.0.0-py3.7.egg/suffix_lemmatizer/util.py", line 105, in train_channel_model
    l_suf, w_suf = suf_sub_func(lem, word)

  File "/opt/anaconda3/lib/python3.7/site-packages/suffix_lemmatizer-1.0.0-py3.7.egg/suffix_lemmatizer/lemmatizer.py", line 47, in get_suffix_sub
    for j in xrange(i-1, i-pref_len-1, -1):

NameError: name 'xrange' is not defined

I tried to resolve the issue, but didn't succeed.

If you have any help?

Thanks!

paultammo commented 4 years ago

Have you tried Python 2.7 as the readme suggests?

LeoHenryM commented 4 years ago

Yes,

But I think it’s due to an issue with SWIG. I run on a Mac, and I had great problem with installing SWIG. I’m pretty sure it’s due to it. Unhappily, I don’t think I’ll have the material to use your module. I don’t really know how I will lemmatize my corpus, because I can’t find a proper stemmer for Estonian neither.

Thanks for you rapid answer!

If you have any advice to give, mulle väga meeldib!

Le 21 sept. 2020 à 12:18, Paul Tammo notifications@github.com a écrit :

Have you tried Python 2.7 as the readme suggests?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/estnltk/suffix-lemmatizer/issues/1#issuecomment-696025772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL5WS7GCAVV5FF2ZVBNRN7LSG4R6PANCNFSM4RUHQP3A.

d009 commented 4 years ago

Hi LeoHMD,

SuffixLemmatizer is an old and outdated tool, but you are welcome to use our standard Estonian lemmatizer that is in the EstNLTK 1.6 toolkit. Its use is explained here under Morphological Analysis section, and EstNLTK installation is described here.

LeoHenryM commented 4 years ago

Tere,

It’s really useful and what I was looking for. Thanks a lot! I only have one answer, is there a way to minimize the morph analysis of the tag_layer() to get only the lemma and, doing so, run the algorithm faster?

Aitah!

Le 21 sept. 2020 à 12:37, Dage Särg notifications@github.com a écrit :

Hi LeoHBD,

SuffixLemmatizer is an old and outdated tool, but you are welcome to use our standard Estonian lemmatizer that is in the EstNLTK 1.6 toolkit. Its use is explained here https://github.com/estnltk/estnltk/blob/devel_1.6/tutorials/nlp_pipeline/A_01_short_introduction_and_tutorial_for_linguists.ipynb under Morphological Analysis section, and EstNLTK installation is described here https://github.com/estnltk/estnltk/tree/devel_1.6#version-16.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/estnltk/suffix-lemmatizer/issues/1#issuecomment-696034185, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL5WS7GCK5SQ5MQQR74ZTNTSG4UHFANCNFSM4RUHQP3A.

d009 commented 4 years ago

Unfortunately, lemmatization needs all the steps of the morph analysis. If you need lemmas faster, you can use the older version of EstNLTK 1.4, the installation of which is here, tutorial here under Morphological Analysis again. It is optimized and faster than 1.6 but it only works on Python 3.5 and not the newer versions. Lemmatization quality should be about the same.