Python Natural Language Processing text3.generate () command error in NLTK package ' Text ' object has no attribute ' generate '

Source: Internet
Author: User
Tags nltk

The 28th page of Python natural language processing has such a command--text3.generate ()---function is to produce some random text similar to the Text3 style.

errors occur when implemented with NLTK3.0.4 and Python2.7.6: ' Text ' object has no attribute ' generate '.


Discover the problem after exploring:

Open the NLTK folder text.py found, the original version of the NLTK did not have the "text1.generate ()" The function of the author has been the demo text.generate () commented out, But I downloaded the nltk2.0.1 version of the installation package, after unpacking the NLTK folder to open the text.py, found in the old version of this feature ("Python Natural Language Processing" in the book is used in the NLTK2.0 version ), So if you want to use this function of the classmate please install nltk2.0.1 version, nltk3.x version is not, good comparison :

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Python Natural Language Processing text3.generate () command error in NLTK package ' Text ' object has no attribute ' generate '

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.