nltk/nltk — Issue #183: max_depth and min_depth goes in a recursive infinite loop for certain lemmas in wordnet
Author: alexrudnick
Created: 2012-01-17 06:27:58+00:00
State: open

What version of NLTK are you using? (See nltk.__version__). Please only
submit bug reports for the current version.
2.0.1rc1

What steps will reproduce the problem? (e.g. include Python source code)
#includes
from collections import defaultdict
from nltk.corpus import wordnet as wn
import nltk

#does not work
syn=wn.synset("localize.v.03")
print syn.max_depth()
print syn.min_depth()

#works
syn=wn.synset("localize.v.02")
print syn.max_depth()
print syn.min_depth()

What is the expected output? What do you see instead?
expect to see an integer with the maximum distance to the root hypernym and the minimum distance to the root hypernym for max_depth and min_depth respectively

I am getting
RuntimeError: maximum recursion depth exceeded in cmp

Please use labels and text to provide additional information.

Migrated from http://code.google.com/p/nltk/issues/detail?id=729

earlier comments

jordanbg said, at 2011-12-27T17:51:11.000Z:

I can't reproduce this error - is this using WordNet 3.0?

>>> from nltk.corpus import wordnet as wn
>>> syn=wn.synset("localize.v.03")
>>> syn.min_depth()
6
>>> syn.max_depth()
6
>>> syn.hypernyms()
[Synset('restrict.v.02')]
>>> syn.instance_hypernyms()
[]

gmatty said, at 2012-01-04T00:24:56.000Z:

This is using wordnet 3.0. It seems to be following restrict back to localize and from localize back to restrict.

jordanbg said, at 2012-01-04T01:44:24.000Z:

Hmm ... this does not seem consistent with my copy of WN 3.0. Could you send me your index.verb file? If I had a WordNet that had a loop, I could make sure this didn't happen.

gmatty said, at 2012-01-11T04:29:29.000Z:

No problem. I've attached the index.verb file.