Here is a link to Pretentious Poet on GitHub. Please refer to the README for how to build and run the project and our wiki and slides for further documentation and technical explanations of the project works.

What it does

Generate pretentious poems from images! We provide a responsive webpage to allow for easy poem generation on the go.

How we built it

We built a single page React JS page that utilizes Redux to manage application state. This passes an image URL to our RESTful API written in Spring. This then passes the image information to ClarifAi which responds with tags related to the image. We then take those tags and pass them to, which we then DOM scrape to get the synonym's part of speech as well as synonyms themselves. We then generate the singular and plural form of these synonyms using a custom fork of JBoss DNA's inflector. Then, we take those synonyms and combine them with our context free grammar, in order to generate a single poem. We then generate several pools of multiple poems and then take the highest scoring poems from each pool and breed them together, generating a new set of pools. We do this across several generations, ultimately spitting out a finished poem that best fits our scoring function.

Challenges we ran into

It's difficult to generate quality poems as well as quantify the quality of a given poem. It's even harder to understand the semantics of a poem than it is to understand regular text, so this added an additional challenge to our project.

Accomplishments that we're proud of

In order to solve these problems, we started by defining a context free grammar that created a subset of English that would always be grammatical. Additionally, to further to attempt to build high quality poems, we built our own genetic programming implementation and algorithm from the ground up as well as intensely tuned our scoring algorithm to consistently create high quality poems. Finally, in order to tie together ClarifAi's classifier with our poem generation algorithm, we had to DOM scrape and appropriately use a custom fork of JBoss DNA's Inflector in order get all the pieces to work together properly.

What we learned

The success of genetic programming is heavily based upon having a scoring algorithm that models the goal well. In the case of poem generation, it's nearly impossible to quantify poems, so we learned about tricks to design scoring functions to closely approximate the actual situation.

What's next for PretentiousPoet

Full scale literary work generation.

Share this project: