From the course: Deep Learning Foundations: Natural Language Processing with TensorFlow
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Solution: Generate poetry - TensorFlow Tutorial
From the course: Deep Learning Foundations: Natural Language Processing with TensorFlow
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.