The strategy that we'll adopt to generate text is as follows:
- Import project Gutenberg's Alice's Adventures in Wonderland dataset, which can be downloaded from https://www.gutenberg.org/files/11/11-0.txt.
- Preprocess the text data so that we bring every word to the same case, and remove punctuation.
- Assign an ID to each unique word and then convert the dataset into a sequence of word IDs.
- Loop through the total dataset, 10 words at a time. Consider the 10 words as input and the subsequent 11th word as output.
- Build and train a model, by performing embedding on top of the input word IDs and then connecting the embeddings to an LSTM, which is connected to the output layer through a hidden layer. The value in the output layer ...