wordnet icon indicating copy to clipboard operation
wordnet copied to clipboard

WordNet.words() has invalid default argument for 'lang'

Open goodmami opened this issue 5 years ago • 0 comments

Calling WordNet.words() without an argument raises an error (although not the one expected; see #22):

>>> import wn
>>> w = wn.WordNet()
>>> next(w.words())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/goodmami/postdoc/wnsd/env/lib/python3.8/site-packages/wn/__init__.py", line 189, in all_lemma_names
    self._load_lang_data(lang)
  File "/home/goodmami/postdoc/wnsd/env/lib/python3.8/site-packages/wn/omw.py", line 79, in _load_lang_data
    raise WordNetError("Language is not supported.")
NameError: name 'WordNetError' is not defined

The initial problem is that the default value of the lang parameter is 'lang':

https://github.com/nltk/wordnet/blob/4adcbae7f58bcdd0574bd75c4f094b97ddab6d42/wn/init.py#L193

This should probably be 'eng' to be consistent with the other methods.

goodmami avatar Jun 03 '20 09:06 goodmami