From: Scott James <ascribbler@earthlink.net>
Date: Tue, 3 Oct 2000 14:13:11 -0400
To: steele@cs.brandeis.edu
Cc: Scott James <ascribbler@earthlink.net>
Subject: Hack for wordnet.py
Many Thanks for your wordnet.py. Very cool.
I made a little hack to extractVerbFrames (ver 1.2)
which you
may/may not be interested in (a BASE change to
atoi in
one spot .... see bottom).
I got into problems when I started playing with
forms like:
wordnet.V['love]
I got a traceback:
File "wordnet.py", line 290, in senses
self._senses = tuple(map(getSense,
self._synsetOffsets))
File "wordnet.py", line 289, in getSense
return getSynset(pos, offset)[form]
File "wordnet.py", line 1022, in getSynset
return _dictionaryFor(pos).getSynset(offset)
File "wordnet.py", line 788, in getSynset
return _entityCache.get((pos, offset), loader)
File "wordnet.py", line 1221, in get
value = loadfn and loadfn()
File "wordnet.py", line 787, in loader
return Synset(pos, offset, _lineAt(dataFile,
offset))
File "wordnet.py", line 411, in __init__
senseVerbFrames.append(extractVerbFrames(ind
ex, vfTuples))
File "wordnet.py", line 407, in extractVerbFrames
return tuple(map(lambda t:string.atoi(t[1]),
filter(lambda t,i=index:string.atoi(t[2]) in (0, i),
vfTuples)))
File "wordnet.py", line 407, in <lambda>
return tuple(map(lambda t:string.atoi(t[1]),
filter(lambda t,i=index:string.atoi(t[2]) in (0, i),
vfTuples)))
ValueError: invalid literal for atoi(): 0e
So I checked things out and found what look like
hex codes:
data.verb:6284:00977560 35 v 17 love 0 make_out
0 make_love 0 sleep_with 0 get_laid 0 have_sex 0
know 0 do_it 0 be_intimate 0 have_intercourse 0
have_it_away 0 have_it_off 0 screw 4 fuck 0 jazz 0
eff 0 hump 0 lie_with 0 bed 0 have_a_go_at_it 0
bang 4 get_it_on 0 bonk 1 004 @ 00979316 v
0000 $ 00977352 v 0000 ~ 00978092 v 0000 ~
00978251 v 0000 05 + 02 00 + 09 12 + 09 11 + 09
0e + 09 0d | have sexual intercourse with; "This
student sleeps with everyone in her dorm"; "Adam
knew Eve" (know is archaic); "Were you ever
intimate with this man?"
And made the change. Seems to "work" but I'm
afraid
I didn't do much more analysis. Just wanted to get
it to work and move on.
best wishes & thanks
scott
-------------------------------------------------------------
def extractVerbFrames(index, vfTuples):
# return tuple(map(lambda t:string.atoi(t[1]),
filter(lambda t,i=index:string.atoi(t[2]) in (0, i),
vfTuples)))
return tuple(map(lambda t:string.atoi(t[1]),
filter(lambda t,i=index:string.atoi(t[2],16) in (0, i),
vfTuples)))
Logged In: YES
user_id=564753
Thanks, I ran into the same problem looking for:
hyponyms(word)
where word was "act(v.)".
This patch solved the problem.
- Ged
Logged In: YES
user_id=731378
I just submitted a patch for the same problem (along with an
explanation from the wn documentation about why it should be
that way). I should have read the forum first. :-)