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
text.generate() does not exist, but is still referenced #736
Comments
Sorry for the confusion. There were problems with NLTK's language modelling -Steven Bird On 20 August 2014 17:12, Kasran notifications@github.com wrote:
|
Alright! Totally understandable. I guess I'll have to write my own chatterbots with applied Markov chains, the old crude way, until it gets fixed. Thanks for your prompt response. |
I also met with this same issue which puzzled me a little bit. Thanks for this thread which google search had taken me to. |
hmmm. does this help (https://github.com/alvations/nltk/blob/develop/nltk/translate/decoder.py#L33)? The language model seems to work fine when decoding. I'll be pushing up an updated and properly documented code for the Sorry I was out for hackathon, workshops and conferences back to back. I'll try to push it by the end of this week, i hope. Ah but my model loads a precacluated model, not building the model from scratch. Is anyone building a language model module? |
I see two issues with the current code (besides the fact that it does not work), user-experience-wise:
If you agree with these changes but do not have the time or motivation to implement them, just let me know and I will send a merge request. |
I also wonder if we could remove the references to |
In my opinion, I totally agree with you guys to remove (generate() references). |
This is still referred to in Chapter one of the book: http://www.nltk.org/book/ch01.html It's no biggy, but I'm probably typical in spending a few minutes googling this as an issue. Those few minutes times however many people are working their way through the book... :) |
Bump, generate() references are still there. |
It's still there now. |
1 similar comment
It's still there now. |
It's still there now (on the Safari Online version of the NLTK book) |
Oh I see there was a note inserted after the example, that generate() was removed from NLTK 3 -- sorry |
It's still throwing error |
The |
Hi, what are possible current alternatives to auto generate text, in replacement to this function? I am reading the generated text from the Chapter 1 of the book, and I too would like to produce marvelous sentences such as "In the beginning of his brother is a hairy man" or this fundamental question : "so shall thy wages be?". |
Sorry @eric-burel I don't quite understand your comment. I'm going to try phrasing it in my words and you tell me if that's correct, ok? Do you want some other way to generate text other than training a language model and using its |
Hi, sorry I was unclear, I was just having a good laugh reading the NLP with Python book when reaching the text generation part, as the sentences are very realistic while still being weird, and I find this subject interesting in general. |
Well, starting with NLTK version 3.4 you actually have access to >>> from nltk import lm
>>> help(lm) |
Could also build your own generate, if ya want: http://www.cyber-omelette.com/2017/01/markov.html¶ |
I am attempting to follow the examples in the O'Reilly Natural Language Processing with Python book, which is how I got to this discussion. I think people are talking about the nltk.text.generate function and not the nltk.parse.generate function, which seems to be causing some confusion. I type in text1.generate(), I'm supposed to get a list of phrases in the style of Moby Dick. Instead, all I get is the error message This appears to be coming from site-packages/nltk/text.py which is defined as I'm using nltk version 3.5.2. |
This can be closed now since |
Thanks @copper-head |
Was generate removed again? I'm following the book, and got the error |
Still having troubles with this function :/ |
@Tserewara @AlbertSawZ what version of NLTK are you using? Could you post a minimal example that we can try running to reproduce this problem? It's a bit difficult to help you based on what information you sent so far :( |
I am also following the book but the issue still persists
|
text7.generate('words') |
I've been trying to follow along with the Natural Language Processing book, but right in the first chapter I'm coming across some issues. After
import
ing everything fromnltk.book
, my first thought was to trytext3.generate()
as was demonstrated in one of the examples. Of course, I got a lovelyAttributeError
because the Text class apparently doesn't have that method in the NLTK that I installed.Furthermore, even running
nltk.text.demo()
tries to do generated text - and returns the same error.Of course, I couldn't find any documentation for the
generate()
method, so I'm assuming it was removed; if that's the case, you should remove references to it fromnltk.text.demo()
and from the textbook.I'm using Python 2.7.8 with NLTK 3.0.0b1 (which was the version available via Windows installer package from PyPI at the time of this writing). The
text3.generate()
example is in both the old and current versions of the textbook.The text was updated successfully, but these errors were encountered: