We enjoy poetry, but we find that writing it ourselves is often a challenge. Writers can gain inspiration and have fun generating poems with this website. The poems can be random and funny, and it's an exciting way to get involved with poetry.
What it does
The Poem Generator allows users to create four types of poems, copy the poems to their clipboards, and save their poems. The four types include the famous "Roses are red..." poem, acrostics, rhyming scheme poems, and haikus. Using the poem type and user input, the generator will create unique poems.
How we built it
We knew that to create poems, we would need access to a variety of words in the English language, so we decided to use the Datamuse API, allowing us to access a database of rhyming words, words' number of syllables, and more. We used this database for all parts of speech except verbs because we could not change the tense of the verbs in the generator easily. Instead, we modified a verb list we found online. We also created structure templates like 'noun verb noun' and 'adjective noun verb' to generate a variety of sentences. With the templates and the API, we were able to create poems that followed syllable restraints and rhyming patterns.
We used Jquery to make our API calls and decide button behavior. We had a set of generic functions calling the API and filtering the response, and we could use these functions in all of our poems. Additionally, we utilized local storage to save user poems.
To style our site, we used a combination of custom css and bootstrap. We used bootstrap for parts like the nav bar, buttons, pop up forms, and cards on the home page.
Challenges we ran into
Some challenges we faced were designing sentence structures that were grammatically correct and also had correct verb agreement. In order to get the correct verb agreement, we had to use two different databases and cross-reference them to get the number of syllables. Implementing the API’s was a challenge throughout working on this project.
Accomplishments that we're proud of
What we learned
We learned how to use API’s, how to style using Bootstrap, and how to save to local storage.
What's next for Poem Generator
We would like to incorporate various other poem structures and more complex sentence structures. We would like to do more research on English grammar and how we can incorporate different algorithms to form sentences. We would also continue styling the site to make it more visually appealing.