1

I am working on code from a team-member. I have to use python2.

import Stemmer is called at the top of the script. However, I was getting the error No module named Stemmer.

Per python, Stemmer not found, I changed the line to import nltk.stem as Stemmer. However, now the script crashed at the line stemmer = Stemmer.Stemmer('english'), giving me the error 'module' object has no attribute 'Stemmer'.

I think Stemmer might be part of the module pyStemmer, but when I try to install pyStemmer through python -m pip install pyStemmer or python -m pip install pyStemmer==1.3.0 I get a bunch of indecipherable errors.

Any suggestions on how to proceed? Thank you!

2 Answers2

0

The reason I couldn't install pyStemmer was because I did not have Cython installed. See this github issue. Once I installed Cython, I was able to install pyStemmer and my code ran smoothly.

0

I come across the same question and it was solved by following steps:

from nltk.stem import *
from nltk.stem.porter import *
stemmer = PorterStemmer()
Albert Einstein
  • 7,472
  • 8
  • 36
  • 71
Emily
  • 1