The Cal in the Hacks
A program to repurpose public domain books into poetry, created for CalHacks 2016.
How it works
Rhyme scheme
The Cal in the Hacks works by making a matrix, where one axis is rhymes and the other axis is related words. To make a poem with an AABB rhyme scheme, you make a sentence ending on a word in the matrix, then slide to a rhyming word for the end of the next sentence, then a related word for the next, and then rhyme for the next.
Verse generation
Sentences are generated by finding relevant passages in some source material (in our case, The Great Gatsby and The Wizard of Oz) that are around the right number of syllables. Multiple options are ranked by their relevancy to the subject of the line. This is done by training a word-to-vector model on the source text and ranking based on vector distance to the subject.
Text-to-Speech
We use the IBM Watson API and HTML5 Audio to read the poetry for you. (This has since been turned off in the live site because our api key will expire eventually.)