Skip to Main Content
Impractical Python Projects
book

Impractical Python Projects

by Lee Vaughan
November 2018
Beginner content levelBeginner
424 pages
11h 43m
English
No Starch Press
Content preview from Impractical Python Projects

9WRITING HAIKU WITH MARKOV CHAIN ANALYSIS

image

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tiny Python Projects

Tiny Python Projects

Ken Youens-Clark

Publisher Resources

ISBN: 9781492069454