bell hooks and python NLP

I have a pile of to read books in the shelves by the door. Before I left the apartment for a weekend away, I grabbed a random book and it happened to be all about love by bell hooks.  It fit perfectly in my jacket pocket and I started to read it in the car.  Immediately the work resonated with me. The feeling of being lovable as a young child and then, suddenly, of being unlovable. Of spending you life looking for this love you once had, or to be the child that was once lovable, and not finding it.  Then realizing that it is futile to go back or to recover this love, since it is lost forever.  Instead, you must find a new love or new way to be loved. I am not sure if this is even what bell hooks talks about or meant, but it is what I felt.

The book is non fiction but it felt like poetry.  So I figured I would write some electronic poetry. I know this is sort of a non-sequitur when here I was talking about bell hooks. But I wondered, what makes this non-fiction instead of poetry? Is it arguments, is it language, is it marketing?  What would it look like to take a work of non-fiction, or of prose even and turn it into poetry?

One way to do this would be to train a model on a particular body of poetry and then extract the language from a non-fiction or prose book and use this lexicon to generate poetry according to the ml model. Another way to do this would be to extract each sentence and then rewrite them as lines according to the ml model. Paragraphs could be converted into stanzas or something else. Again this all is depended on the poetry used to train the model.

Years ago I use the python NLP library to generate different poetic forms such as a sonnets or villanelles from a corpus like Shakespeare or the bible. I thought, what sort of interesting thing could I do with python NLP.   There are, for sure, a ton of boring, uninteresting and uninventive things I could do.

I went and did:

from nltk.book import *

And saw that Moby Dick was the first book included with nltk.  I read it a long time ago.  I also read Charles Olson’s,  Call Me Ishmael during my weekly sonograms while pregnant with my second child while stricken with a mild case of gestational diabetes.  This is a work of poetic literary criticism centered on Moby Dick, it is excellent and inspiring. Charles Olson is a character, a poet and teacher (perhaps one time president) at Black Mountain College , he wrote an poetic epic on Worcester MA that I own but have not finished.  A few years back, I  picked up an Olson bio from Canio’s in Sag Harbor. It was a great read. I love reading poet biographies!

This is a round about way of saying that  I want to use Moby Dick for my poetic experiments. In this current experiment I used all the texts included in the nltk. But maybe eventually I’ll move back and focus on Moby Dick.

The tools in chapter 1 of the online nltk book are: frequency, distribution, word length, colocation and bigrams (ie words that are often together). However  I have to do some weird stuff to get some of the functions to output to a list instead of stdout.

The first chapter also focuses on the issues with translation and ambiguity.    For example:

The people were found by the searchers vs people were found by the afternoon 

This represents difference senses of by. In Latin a temporal sense would use a different preposition and would probably be in the accusative I think, otherwise it would be in the ablative. But this aint Latin is it now!

My first poetic experiment creates a poem(s) from the included texts by alternating between high frequency short words and low frequency short words and low frequency long words. It is fun. This was one poem generated:

foul four woods
foul four woods
circumstances significance encountering, Nevertheless superstitious

four woods hanging
four advantage uncertain
accommodation circumstances respectable, inclination understanding

four second here
four second here
Philistines everlasting exceedingly, peradventure generations

four Until advantage
four advantage Western
contributed circumstances willingness, responsible remembering

woods second fingers
fingers here NOT
foul four Until
second here Three
four Until advantage
four advantage Western
contributed transactions Connecticut, complicated introduction

reliable music travel
music travel A
foul four marching
four yellow Does
considerable impatiently intellectual, extraordinary astonishment

A few things – I think this poem should just have four stanzas. I love the last line. I love the repetition of four. I added in the commas manually, but I think I have to consider punctuation in the generation of these poems. Also I am interested in how this creates new poetic forms. Instead of rhyme and meter, iambic pentameter and what not, we are thinking in terms of statistics. What is a poetic form based on statistics? This is sort of interesting.  Am I creating a poem, or a poetic form? Here is the first bit of code – I think even the source code is sort of poetic.

Finally, here is a NYTimes published this article about bell hooks and I highly recommend it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.