Could an algorithm write poetry as well as a human? A team of computer scientists from Australia, along with an expert from the English department at the University of Toronto, set about answering that question by designing an algorithm capable of writing poetry all while adhering to the rules of rhyme and meter.
To test the algorithm, called Deep-speare, the team asked people online to determine which verses were written by the algorithm and which were constructed by a human. With certain verses, the algorithm was selected as the human-written prose 50 percent of the time.
To create the algorithm, the computer scientists trained the network on over 2,500 sonnets held in a free digital library. Using rhyming, meter and language models as well as probability to select the appropriate words, the computer created quatrains (four lines of verse) in iambic pentameter.
For those unfamiliar with poetry, the online respondents couldn’t tell that the following verses had been authored by the computer:
"With joyous gambols gay and still array
No longer when he twas, while in his day
At first to pass in all delightful ways
Around him, charming and of all his days"
Yet, Adam Hammond, an assistant professor of English at University of Toronto and co-author of the paper outlining the algorithm had little trouble spotting the hand of the algorithm in the grammatical errors such as “he twas.”
"It's very easy for me to tell what's by a computer or not — ridiculously easy," said Hammond
"We solved two out of four problems," Hammond said, referring to rhyme and meter. "The other two are much harder: making something that's readable and something that can evoke emotion in a reader."
Hammond applauded the algorithm’s quatrains on rhyme and meter, calling them superior to most of those created by humans.
"You have metre in a poem to create expectation," he explained. "You do that so you can break the pattern. It's about creating expectations and then violating them at some point."
Still, Hammond suggests that the system is far from being able to mimic the work of an actual writer.
"Imagine teaching a computer to come up with a problem, express that problem and then offer a solution to it. It's impossible to imagine," said Hammond
"Our results suggest that future research should look beyond metre and focus on improving readability," the researchers said.
Their work was published last month in the Proceedings of the Association for Computational Linguistics.