From the course: Deep Learning Foundations: Natural Language Processing with TensorFlow

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Solution: Generate poetry

Solution: Generate poetry - TensorFlow Tutorial

From the course: Deep Learning Foundations: Natural Language Processing with TensorFlow

Start my 1-month free trial

Solution: Generate poetry

(upbeat music) - [Instructor] So here's how we are going to solve the Poetry Generation Challenge. So first of all, let's import all of the packages. Make sure again, you're using TensorFlow to one X. Then we are going to use this sonnet text which I've hosted on my GitHub repo. So here's the link. So quickly download the data and then read the data. So we are printing the length of the Shakespeare text, which has turned out to be 28,000. This is a fairly good and large dataset to train on. So let's quickly create the Corpus, which is the first step. So shakespeare.text for the first of all, convert it into lower case. And then we have to split it on new line. So once that is done, let's see what the Corpus look like. So what does this look like? So we have quite a few sentences over here. As you can see, the Corpus is ready. The next step is to set up the tokenizer. So the tokenizer we have instantiated…

Contents