Thursday, October 14, 2010

The poetry machine

I work in IT and have an IT academic background. A couple of days ago, on a bit of spare time, I was doing some light research on the existence of some kind of program to verify metric and rhyme in poems and perhaps even suggest enhancements within certain parameters. I found none. I think this might make an interesting project in the field of Natural Language Processing but will have to research a bit more to be sure it hasn’t been done yet. So far I just found a Princeton Paper on “Semantic Poetry Creation Using Lexicographic and Natural Language Texts” and this interesting blog entry by someone who, ten years ago, was looking for a similar thing. I don’t know if the findings are outdated by now but will follow up.


Poetry Scanner

A possible tool to figure out where the accents are.

I want a computer program to scan poetry and show you the accents and the syllabic inflections. Such a program should be able to guess the meter of a poem - save for that poetry often uses archaic forms of language. I wonder if, ultimately, the problem is intractable for all but the most formally constructed and properly punctuated poems.

What's the point of doing this? Well, once you've broken everything up and gotten the syllables and accents, accurate by part of speech, broken out into a big array of data in the computer's memory, you can put it back together and display it in unique ways. For instance, you could show the number of stresses, counted to the right of each line, or you could analyze the pattern (heptameter! iambic pentameter!). The enterprising poetry analyst, undergraduate, graduate, or even professor-level, has a nifty tool to quickly map the linguistic patterns of a poem, especially if he or she uses the tool in conjunction with the Etymologizer.

One major function would be a rhymical-semantic-suggestotron. You could point to a word you wanted to replace, and the tool would go out and find all the cognitively related words it could that had the same rhythm. Voila!

You could also create some amusing, random, rhymic poetry via these methods.

You could also play around with such functions as “phoneme sort,” where you split out poems and lyrics by phonemes and sort the results to find out which phonemes have prevalence, or a “stress sort,” to find out which syllables get stress. I mean, it's not thrill-a-minute, but it would have helped me during that sophomore poetry 305 I took with Dr. Howard.

Given a block of poetry:

Parse it into sentences, not lines, but remember where the linebreaks are. We need to have full sentences in order to--

Apply a link grammar to each sentence, so that we know the part of speech of each word.

Break each word down into syllables, making sure you're doing it with the right part of speech. This is a problem. While there are web tools to tell you the phonetic breakdown of words, they use data intended for machine reading:

ABROGATED AE1 B R AH0 G EY2 T IH0 D

ABROGATING AE1 B R AH0 G EY2 T IH0 NG

ABROGATION AE2 B R AH0 G EY1 SH AH0 N

ABRON AH0 B R AA1 N

ABRUZZO AA0 B R UW1 Z OW0

ABROGATING AE1 B R AH0 G EY2 T IH0 NG

ABROGATION AE2 B R AH0 G EY1 SH AH0 N

ABRON AH0 B R AA1 N

ABRUZZO AA0 B R UW1 Z OW0

See the problem? It doesn't show you where the words break; abrogated should a*bro*gat*ed; abrupt should be ab*rupt, and trying to deduce where the split of sounds by reverse engineering the pronunciation codes is very difficult. One way around this is to parse the syllable information out of the Merriam Webster dictionary, originally published via Project Gutenberg, but now part of The GNU Dictionary An ambitious dictionary project oriented around GNU philosophy; currently offers an XML markup of a massive Merriam Webster dictionary of the early 1900's, integrated with WordNet data. , and generate a syllabic (not pronouncing) dictionary. Except this doesn't have full syllabic information for every word, just a large number of root words. But it does have a good heap of information, and it does accent the syllables; it might be a starting point.

Actually, this idea isn't going to go anywhere. But it's nice to think about a little poetry machine, I find.


12 comments:

Ruth said...

But it's so fun to do this, humanly. :)

Trulyfool said...

Claudia,

This has intellectual traction for technology -- an edge to 'artificial intelligence' stepping humbly, but hopefully.

Linguists might like to play with something like that, and perhaps aleatory poets.

If there were such a thing as 'the philosophy of poetry', though, I think it would consider such analytics useful for professors but anathema to poetry itself.

Perhaps the opposite of poetry.

Technology has as its motive not just 'knowledge', but knowledge for efficiency's sake.

Poetry's not 'knowledge', but experience, its motive a search for authenticity, however rough-edged, sloppy, or wrong.

Even 'iambic' works aren't strictly that -- or when they're read that way, they become doggerel.

The rhythm of speech, like all human rhythms, can be analyzed, but by being so objectified, it loses what it 'is'.

Perhaps I've gone farther afield than what your posting intended. Ford's point seems to be the usability of laying things out for demonstration purposes?

It's like listening to the 'professional development' talks English departments feel bureaucratically obliged to
promote in order to convince teachers that they're teachers.

We're there because of our love of the language and its art. Or should be. Not because we're 'professionals' savvy about technique.

Well, I don't know for whom I speak. I always seem to be waving from an offshore island. And I hope you don't take this as a rant. This kind of discussion is what I never get enough of!

Trulyfool

rauf said...

i am pretending that i have understood what you wrote here Claudia. Since i am an India and Indians talk about nothing so i will talk.

you say 'see the problem ?'

i say what problem ? where is the problem ?

i don't trust the computer for anything. i take back up of the back up of the back ups.

i don't trust the computer even for my spellings.

Marie's images are highly imaginative, she posts comments in French

Like an idiot i trusted google translator but luckily i did not post comment in French, i nearly made a fool of myself. And i counter checked. copy past french translation it gave back to English

i wanted to write

only you can see the beauty in a weather beaten wall Marie

que vous pouvez voir la beauté dans un mur par les intempéries Marie

i copy pasted the french back to English and this is what i got

you can see the beauty in a weather-Marie Wall


i putted the name Marie in the beginning of the sentence here

Marie, only you can see the beauty in a weather beaten wall

Marie, que vous pouvez voir la beauté dans un mur par les intempéries

this is the counter check - French to English

Mary, you can see the beauty in a wall by weather

it gets even funnier as you go along Claudia. i have screen shots of a couple of them.

rauf said...

oh deeah ! where did my comment go ? i just posted it here, one long comment.. Let me recollect what i wrote and post it back here

rauf said...

when a priest can't answer my questions he says 'these are mysteries of God my child (he is younger than me) we can't understand. these are the mysteries of google which i can't understand

Two blogs were open, Ruth's and yours i thought i might have posted it there, its not on Ruth's blog eeda. deeah o deeah !

This is what i wrote about the poetry machine Claudia.

i am pretending to have understood what you wrote so i'll write. i am an Indian and Indians can talk about nothing.

i don't trust computers and i take back of the back up of the back ups.

i don't trust the computer for spellings too Claudia.

This is one experience with google translator.

Marie's pictures are highly imaginative. Stunning they are. she posts comments in French so i respond in French with the help of google translator. Mostly it will be Mercie Marie. i thought let me post a comment in her blog in French. i nearly made a fool of myself. Luckily i did not post it.

i typed this in the translator box

only you can see the beauty in a weather beaten wall Marie

i got this translation

que vous pouvez voir la beauté dans un mur par les intempéries Marie

i counter checked and copy pasted the French in the box to get English translation. This is what i got

you can see the beauty in a weather-Marie Wall

Now i putted Marie in the beginning of the sentence


Marie, only you can see the beauty in a weather beaten wall

Marie, que vous pouvez voir la beauté dans un mur par les intempéries

counter checked copy paste the translation back to English And i got this.

Mary, you can see the beauty in a wall by weather.

i have screen shots of some of these Claudia

it gets funnier as you go along.

rauf said...

this is even worse, i'll mail you the screen shot of this Claudia


only your eyes can see the beauty in a weather beaten wall Marie

google Translation

que vos yeux ne peuvent voir la beauté dans un mur par les intempéries Marie

Back to English

that your eyes can not see the beauty in a weather-Marie Wall

Claudia said...

I know, Ruth, but it would be quite a fun Natural Language project (the rhyme and metric checker, not the poetic machine). It might also come in handy, like a spelling checker.

Claudia said...

Trulyfool,

I agree with most of what you wrote and that's why my quest isn't for the inevitably soullesss "poetry making machine" but a mere rhyme and metric checker, a tool that might come under the same category as a spelling checker. I think there's too much bad poetry around and an extraordinary use and abuse of [bad] free verse. Of course it can be argued that anything anyone writes aiming to convey feelings and thoughts infused with life experience has some intrinsic poetic value, regardless of form. That might be so, but the truth is that it doesn't make for very pleasant reading if it doesn't display some elements of form. I think I agree with T.S. Eliot's opinion that "no verse is free for the man who wants to do a good job."

Perhaps I'm a bit old fashioned about poetry.

Claudia said...

I've had some laughs doing that, rauf. Online translators will surely be improved in the future. It won't be long before you can enter not only the text you want to see translated but also what you mean to say. After that, automatic translators will probably feed on the immense store of manual translations in the online public domain to fine-tune their work. Artificial intelligence hasn't been applied to the free and widely used online translators yet but it is already available in some expensive software. Still requires human revision, though.

Claudia said...

rauf, I just found out that silly blogger thought your first comment was spam and didn't publish it. I've just taken it out of the filter.

Oh, another thing, anything below the title "Poetry Scanner" belongs to the Paul Ford article, not to me.

Trulyfool said...

Claudia,

Even spell-check has limitations.

We're not in any disagreement about any of this. I love Eliot's poetry -- his cast of mind helped shape mine in some ways.

His essays, now routinely thought 'mandarin' in their orientation, I find smart and sensible.

His politics go to the right of mine, but I like the way he appears in pictures: the conservative suits.

He upholds a poetics that sounds conservative by today's 'standards', but there's a radical irony in his poems. And structural stretching and yanking.

I absolutely agree that 98.467 percent of 'poetry' online isn't. And maybe 80 percent of things that get 'juried' publication in hard copy.

Much of that is 'free verse' (read: no ear). Some of it is singsong adherence to the rules (playing tennis WITH a net -- as Frost would have it).

I've worked with lots of poets, heard many, read many. What we get in the anthologies are the best.

When you 'do workshops' all participants give it a shot: sonnets, haiku, whatever. And the form often gets 'fit'.

I find I can't do that without feeling forced -- occasionally I like what comes out, but not often.

When I 'let loose', only crap comes out.

The creative process, for me at least, is letting phrases, words, form themselves. In scribbles. Then see if there are larger coherences that suggest themselves.

You've seen some of these online things I've done: not seldom quatrains. I never deliberately scan my things, but I 'eyeball' and later find beats pretty regular.

Gone on too long here -- sorry. It's my love for this!

Trulyfool

Kelli Shea said...

Funny how a year later and I'm looking for the EXACT same thing.