[Snowball-discuss] PyStemmer: " 'dict' object has no attribute 'iteritems'" on Python 3

Marc Abramowitz marca at surveymonkey.com
Fri Feb 22 07:23:13 GMT 2013


I did a little more testing and I verified that the problem I'm seeing occurs if Stemmer.c is built with Cython <= 0.16; with Cython 0.17, the problem is gone.

I'm using the tox.ini and tests that I posted in other threads.

With Cython 0.16:

```
~/dev/pystemmer$ .tox/py26/bin/pip install Cython==0.16 && .tox/py26/bin/cython src/Stemmer.pyx && .tox/py26/bin/python setup.py sdist && .tox/py33/bin/pip uninstall -y PyStemmer && .tox/py33/bin/pip install dist/PyStemmer-1.2.0.tar.gz && .tox/py33/bin/nosetests –v
…
======================================================================
ERROR: test_stemWord_many_times (test_pystemmer.PyStemmerEnglishTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Stemmer.pyx", line 184, in Stemmer.Stemmer.stemWord (src/Stemmer.c:1722)
KeyError: b'spiks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vagrant/dev/pystemmer/tests/test_pystemmer.py", line 57, in test_stemWord_many_times
    result = self.stemmer.stemWord(word)
  File "Stemmer.pyx", line 195, in Stemmer.Stemmer.stemWord (src/Stemmer.c:1870)
  File "Stemmer.pyx", line 159, in Stemmer.Stemmer.__purgeCache (src/Stemmer.c:1451)
AttributeError: 'dict' object has no attribute 'iteritems'

----------------------------------------------------------------------
Ran 11 tests in 0.056s

FAILED (errors=1)
```

With Cython 0.17:

```
~/dev/pystemmer$ .tox/py26/bin/pip install Cython==0.17 && .tox/py26/bin/cython src/Stemmer.pyx && .tox/py26/bin/python setup.py sdist && .tox/py33/bin/pip uninstall -y PyStemmer && .tox/py33/bin/pip install dist/PyStemmer-1.2.0.tar.gz && .tox/py33/bin/nosetests –v
…
~/dev/pystemmer$ .tox/py33/bin/nosetests -v
test_stemWord (test_pystemmer.PyStemmerEnglishTests) ... ok
test_stemWord_many_times (test_pystemmer.PyStemmerEnglishTests) ... ok
test_stemWords (test_pystemmer.PyStemmerEnglishTests) ... ok
test_stemWords_unicode_simple (test_pystemmer.PyStemmerEnglishTests) ... ok
test_stemWord (test_pystemmer.PyStemmerFrenchTests) ... ok
test_has_algorithms (test_pystemmer.PyStemmerGenericTests) ... ok
test_has_version (test_pystemmer.PyStemmerGenericTests) ... ok
test_import (test_pystemmer.PyStemmerGenericTests) ... ok
test_stemWord (test_pystemmer.PyStemmerGermanTests) ... ok
test_stemWord (test_pystemmer.PyStemmerHungarianTests) ... ok
test_stemWord (test_pystemmer.PyStemmerRussianTests) ... ok

----------------------------------------------------------------------
Ran 11 tests in 0.077s

OK
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tartarus.org/mailman/private/snowball-discuss/attachments/20130222/a1aedeb3/attachment.htm>


More information about the Snowball-discuss mailing list