I have a windows 7 64 bit machine and just installed the 64 bit version of python 3.5 and the nltk package (which I downloaded as a .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#nltk and pip installed from the windows command prompt). I've also downloaded all the corpora and other data associated with nltk.
In python IDLE I am able to import nltk and the brown corpus all right, but when I try to examine some words in the Brown corpus I get an AttributeError ("can't set attribute"). Here is my code:
>>> import nltk
>>> from nltk.corpus import brown
>>> brown.words()
It is the last line which generates the error. The error message is several lines long so will not include all of it here. The last line of the error is: AttributeError: can't set attribute.
I have experience in R and Matlab but I am completely new to python and have no idea what to do.
EDIT: Here is the full error text
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
brown.words()
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\idlelib\rpc.py", line 611, in displayhook
text = repr(value)
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\util.py", line 664, in __repr__
for elt in self:
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\corpus\reader\util.py", line 394, in iterate_from
for tok in piece.iterate_from(max(0, start_tok-offset)):
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\corpus\reader\util.py", line 291, in iterate_from
tokens = self.read_block(self._stream)
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\corpus\reader\tagged.py", line 243, in read_block
for sent_str in self._sent_tokenizer.tokenize(para_str):
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tokenize\regexp.py", line 126, in tokenize
self._check_regexp()
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\tokenize\regexp.py", line 121, in _check_regexp
self._regexp = compile_regexp_to_noncapturing(self._pattern, self._flags)
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\internals.py", line 56, in compile_regexp_to_noncapturing
return sre_compile.compile(convert_regexp_to_noncapturing_parsed(sre_parse.parse(pattern)), flags=flags)
File "C:\Users\Ben\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\internals.py", line 52, in convert_regexp_to_noncapturing_parsed
parsed_pattern.pattern.groups = 1
AttributeError: can't set attribute