Listen to this article
Download the Visual Studio Project
Download the Database
View Video
Contact Rick
Twitter
RSS

Haiku Generator

Richard C. Leinecker, January 2014

Many computer scientists believe that computers can exhibit creativity. This includes writing music, poetry, and prose. Ray Kurzweil offers a program on his web site ("Cybernetic Poet," 2001) named Cybernetic Poet that uses analyzed lexicons from various poets, and then generates new poetry based on the selected style. Many computer scientists such as Kurzweil have dedicated their lives to developing software that demonstrates creativity. Alan Turing (1948) proposed a test for computer intelligence. If a blind participant could not tell the difference between the responses of a computer and a human, then the computer passes the test. If the computer passes the test, then it is thought to exhibit a plausible level of intelligence.

While Turing proposed the test and Kurweil developed software to create poetry, other computer scientists have taken a more abstract approach. Douglas Hofstadter (1979) has spent a great deal of time dealing with two related issues: creating metaphors and analogies. According to Hofstadter, these two creative processes are difficult for computers because they require abstract thinking. In the future, this web site will feature a program that generates metaphors and a program that generates analogies. These two programs may add to the understanding of computer-generated metaphors and analogies.

The project featured on this page generates random haiku. The words are retrieved from a database that was created from an old dictionary from the project Gutenberg site (Project Gutenberg, n.d.). Because there are so many English words that are not commonly used, selecting random words from this dictionary yielded some seemingly unintelligible haiku. In order to try to limit to more common words, a word frequency list was added to the database. A free list of 5,000 words can be retrieved from the Word frequency data site (Word frequency data, n.d.). Longer lists can be purchased from the same web site.

You can download a backed up Microsoft SQL Server database from this page. There is a C# project that you can also download that shows the basics of creating a haiku from the database. The code that is embedded in this page is an iFrame that loads an external aspx file which generates the actual haiku. While there are several haiku versions, the one that this code creates consists of a line of five syllables, a line of seven syllables, and a line of five syllables.

This app could be significantly expanded. The first expansion to the C# app is to use the frequency rank to get a more intelligible haiku. The web-based code does this, and it is left as an exercise for the reader in the C# project. Another enhancement would be to service the other haiku types. Finally, giving this app some sort of intelligence rather than simply a random selection would provide something approaching a haiku that might pass the Turing test.

The challenge that is offered to readers is this: create a haiku generator app that shows some creativity and intelligence. If a reader creates an app, and it can be converted to a web-based app using the dictionary that can be downloaded from this web site, then the app will get posted with full credit to the author. The author can also write a description of the changes so that readers will understand the changes that were made.


References

Hofstadter, D. (1979). Godel, Escher, Bach: an eternal golden braid (20th ed.). New York: Basic Books.

Poetry by the Cybernetic Poet. (2001). Retrieved from http://www.kurzweilcyberart.com/poetry/rkcp_overview.php

Project Gutenberg. (n.d.). http://www.gutenberg.org/

Turing, A. (1948). Machine Intelligence. Oxford: Oxford University Press.

Word frequency data. (n.d.). http://www.wordfrequency.info/

Citations

APA

Leinecker, R. C. (2014). Haiku Generation. Retrieved from http://rickleinecker.com/Rick-Leinecker-Haiku-Generator.html

MLA
Leinecker, Richard C. "Haiki Generation." Artificial Intelligence Takes Many Forms. Rick Leinecker, Jan. 2014. Web. 11 Jan. 2014.