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 '