davepagurek / The-Cal-in-the-Hacks

Generative poetry

Home Page:http://poetry.davepagurek.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cal In The Hacks

A poetry generator, trained from The Wizard of Oz and The Great Gatsby.

Live demo: http://poetry.davepagurek.com

Video: https://www.youtube.com/watch?v=j93TF18AdKE

Setup

# Install gsl
brew install gsl # for Mac
sudo apt-get install libgsl0-dev # for Linux

# Install ruby dependencies
bundle install

Running

ruby server.rb

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

About

Generative poetry

http://poetry.davepagurek.com


Languages

Language:Ruby 80.8%Language:JavaScript 8.6%Language:CSS 6.6%Language:HTML 3.9%