getting error 'module' object is not callable

308 views
Skip to first unread message

Freeda

unread,
May 21, 2012, 2:58:25 AM5/21/12
to nltk-users
Hi,
I am using the follwoing:

>>>from nltk import wordnet as wn
>>>wn.synsets('dog')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'synsets'


If I use this,
>>> wn.synset('dog')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable


This I tuk it from the tutorial. How shud I proceed..?


Thanks,
Freeda

Alex Rudnick

unread,
May 26, 2012, 9:17:27 PM5/26/12
to nltk-...@googlegroups.com
Hey Freeda,

Hrm, it looks like the packages have moved around a little bit. This
works for me, though:

>>> from nltk import wordnet as wn
>>> wn.wordnet.synsets("dog")
[Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'),
Synset('cad.n.01'), Synset('frank.n.02'), Synset('pawl.n.01'),
Synset('andiron.n.01'), Synset('chase.v.01')]

Could you send a link to the tutorial that you're using?

Thanks!
--
-- alexr

Alex Rudnick

unread,
May 26, 2012, 9:21:48 PM5/26/12
to nltk-...@googlegroups.com
Hrm, so the examples in the book still work fine, at least for me!

http://nltk.googlecode.com/svn/trunk/doc/book/ch02.html#wordnet

On Sat, May 26, 2012 at 6:17 PM, Alex Rudnick <alex.r...@gmail.com> wrote:
> Hey Freeda,
>
> Hrm, it looks like the packages have moved around a little bit. This
> works for me, though:
>
>>>> from nltk import wordnet as wn
>>>> wn.wordnet.synsets("dog")
> [Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'),
> Synset('cad.n.01'), Synset('frank.n.02'), Synset('pawl.n.01'),
> Synset('andiron.n.01'), Synset('chase.v.01')]
>
> Could you send a link to the tutorial that you're using?
>
> Thanks!

--
-- alexr

Steven Bird

unread,
May 26, 2012, 11:07:42 PM5/26/12
to nltk-...@googlegroups.com


On May 27, 2012 11:22 AM, "Alex Rudnick" <alex.r...@gmail.com> wrote:
>
> Hrm, so the examples in the book still work fine, at least for me!
>
> http://nltk.googlecode.com/svn/trunk/doc/book/ch02.html#wordnet

I reorganised NLTK's top level imports, and tested things as well as I could (we're still getting our testing process fixed up, so I might have overlooked something).

In general, if a book example doesn't work, please check that you've got the latest version of NLTK installed, and if the problem persists, report it via the NLTK issue tracker, or else to this list.

Thanks,
-Steven Bird

Reply all
Reply to author
Forward
0 new messages