Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.5: from nltk.books import * | Attribute Error: parsed_pattern.pattern.groups = 1 #1135

Closed
Zenohm opened this issue Sep 17, 2015 · 1 comment

Comments

@Zenohm
Copy link

Zenohm commented Sep 17, 2015

Running Python version 3.5

>>> from nltk.book import *
*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\book.py", line 19, in <module>
    text1 = Text(gutenberg.words('melville-moby_dick.txt'))
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\text.py", line 295, in __init__
    tokens = list(tokens)
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\corpus\reader\util.py", line 233, in __len__
    for tok in self.iterate_from(self._toknum[-1]): pass
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\corpus\reader\util.py", line 291, in iterate_from
    tokens = self.read_block(self._stream)
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\corpus\reader\plaintext.py", line 117, in _read_word_block
    words.extend(self._word_tokenizer.tokenize(stream.readline()))
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\tokenize\regexp.py", line 126, in tokenize
    self._check_regexp()
  File "C:\Users\Name\AppData\Local\Programs\Python\Python35-32\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\Name\AppData\Local\Programs\Python\Python35-32\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\Name\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nltk\internals.py", line 52, in convert_regexp_to_noncapturing_parsed
    parsed_pattern.pattern.groups = 1
AttributeError: can't set attribute
@stevenbird
Copy link
Member

Duplicate of #1106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants