9WRITING HAIKU WITH MARKOV CHAIN ANALYSIS
Computers can write poetry by rearranging existing poems. This is basically what humans do. You and I didn’t invent the language we speak—we learned it. To talk or write, we just recombine existing words—and rarely in a truly original manner. As Sting once said about writing music, “I don’t think there’s such a thing as composition in pop music. I think what we do in pop music is collate . . . I’m a good collator.”
In this chapter, you’re going to write a program that puts the “best words in the best order” in the form of haiku. But to do this, Python needs good examples, so you’ll need to provide a training ...
Get Impractical Python Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.