Haiku #1 - with a Chen Chen poem
Haiku #2 - with an e.e. cummings poem
As a kid, I used to think poetry was exclusively written by angry wizened aristocrats. I was wrong, of course - now I write my own poetry and am absolutely enamored by the art form. However, poetry is still one of the most stigmatized forms of literature & can be hard for kids to relate to. I wanted to create something that could make poetry accessible to children, and a generator that stirs up somewhat sensible, silly nonsense from the "angry wizened aristocrats" who are now part of their own dead poets society seemed like a fun project to undertake. The project is named sqwalk as a nod to birds, who are a popular symbol in poetry (re: Edgar Allen Poe's "The Raven") and to represent children's growing familiarity with language, which expands as they learn to walk.
What it does
Given a relatively small text file, such as an existing poem, the generator will take a random sample of words and organize them into a haiku. It also analyzes the sentiment of the haiku to show whether the haiku was positive, negative, or neutral, and by what percent.
How I built it
I used the natural language toolkit & textblob to aid me with processing of the text, then used python to play around with different features of the generator. I also used python to strip away extraneous characters & more common words.
Challenges I ran into
I attempted to use larger text files (i.e. text files of books), but the processing time took too long, so I ended up sticking to smaller files. In addition, creating a template for the words - the 5-7-5 syllabic pattern of a haiku was I also focused too much on the generator, as opposed to creating the website I intended to link it to (sqwalk.net).
Accomplishments that I'm proud of
I was able to wrangle the random samples of words from the text and wrangle them, for the most part, into a haiku format, which took longer than I expected; though I found a function that counted syllables of the words, I still had to alter it in places & format the checking of the haiku template.
What I learned
I learned how to use the natural language toolkit & TextBlob, both of which I had never used before. I am interested in working closely with language and programming in the future, and thus this project was right up my alley.
What's next for Sqwalk
I plan to link the generator to the domain in order for kids - including my own six-year-old sister - to experiment & play with it. I would also like the generator to be able to access files from the Web, instead of having to run directly on my own console & work with a poem/text file within my own directory.