Menu

#11 ValueError with wordnet.N.get('')

open
nobody
None
5
2005-02-14
2005-02-14
No

I get a confusing value error if I call wordnet.N.get
with an empty string:

py> wordnet.N.get('')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Program
Files\Python\lib\site-packages\wordnet.py", line 905,
in get
return self[key]
File "C:\Program
Files\Python\lib\site-packages\wordnet.py", line 884,
in __getitem__
return self.getWord(index)
File "C:\Program
Files\Python\lib\site-packages\wordnet.py", line 825,
in getWord
word = _entityCache.get((pos, key), loader)
File "C:\Program
Files\Python\lib\site-packages\wordnet.py", line 1311,
in _trueget
value = loadfn and loadfn()
File "C:\Program
Files\Python\lib\site-packages\wordnet.py", line 824,
in loader
return line and Word(line)
File "C:\Program
Files\Python\lib\site-packages\wordnet.py", line 214,
in __init__
ints = map(int, tokens[int(tokens[3]) + 4:])
ValueError: invalid literal for int(): FITNESS

Looks like this is a problem in _IndexFile:

py> wordnet.N.indexFile.get('')
' 20 ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
THAT THE USE \r\n'

But off-hand, I don't know how to fix it.

Discussion


Log in to post a comment.