This AI Tool Generates Personalized Shakespearean Sonnets to Give to Your Love

Brooklyn-based agency Huge created v*AI*lentine

Huge's team fed all of Shakespeare's sonnets through Markov chains to predict which word should come next. Illustration: Dianna McDougall; Sources: Huge, Getty Images
Headshot of Marty Swant

Interested in learning more about AI? You should attend Adweek’s Elevate: AI summit March 6 in New York. Register here.

If a robot were to write sonnet, what would it sound like? And, perhaps more importantly, what would it feel like?

This Valentine’s Day, teams of developers and designers at Brooklyn-based agency Huge wanted to use technology to help star-crossed lovers stay out of the Hallmark aisle. During a one-day employee hackathon, the winning team created a “machine intelligent love poem generator.” Combining the heart of William Shakespeare with the mind of artificial intelligence, love poems never looked so mechanically soulful.

To create v*AI*lentine—which creates personalized AI-generated poetry—the team at Huge fed all 154 of Shakespeare’s sonnets through Markov chains, which use natural language processing and algorithms to predict which word should come next.

The team then created inputs to let users enter characteristics about their crush, such as their name, favorite color, favorite season and best physical trait. For example, if a user said their heartthrob’s favorite color is blue, the Markov chain would pull lines that related to words such as “water,” “sea,” “sail” and “sorrow.” If they said red, it would look for “fire,” “birth” or “desire.”

The machine generates lines based on the answers and algorithms, creating something that’s part Mad Lib, part poetry puzzle.

“They end up sounding pretty close to Shakespeare’s sonnets,” said BJ Warshaw, a senior web engineer at Huge. ” … Hopefully all of them end up sounding like love.”

V*AI*lentine, which debuted today, even looks like the kind of cutesy digital Valentine Day card that a young robot might make for its kindergarten crush.

“Essentially, I [wanted] to give a nod to old-school graphics in order to capture the computer [and] AI generation part of the project,” said Huge designer Win Giamportone. “The rest was really to reflect the vibe of Valentine’s Day. Lots of hearts, trims, and pastels for maximum cuteness. I wanted it to be 8-bit overboard.”

So of all the poets, why Shakespeare? Warshaw said they settled on him right away since the structure is already both familiar to modern ears and also easy for the AI to quickly understand (even with all the “thee’s” and “thou’s”). However, he said they’re considering adding more musicians and writers in the future. For example, if they had accessed the API of the music lyrics website Genius, it would have allowed the user to pick their favorite songwriter, whether it’s Beyonce or Bon Iver.

“As technical as it is under-the-hood, we wanted to make it as loving and immediate as possible,” he said.

@martyswant Marty Swant is a former technology staff writer for Adweek.