Showing posts with label random. Show all posts
Showing posts with label random. Show all posts

Wednesday, December 7, 2011

Halloa from my new computer

I know that my three loyal readers have been disappointed by Poesytron 575's writer's block of recent months.

Well, that scrappy little computer code isn't dead.  I've finally transferred the files over from my dying netbook to my brand-new Lappy 486, and took her for a test drive:

paludism halloaed
staidness brit quandary fern
puckery sawyer


That's my new lappy's first random haiku, and I think it makes a pretty good introduction.

Wednesday, March 2, 2011

Two Random Word Haiku for March 2

sulfathiazole
eradicating brownprint
premenstrual smile

Sulfathiazole is an antibiotic, and brownprint is a reproduction technique that produces white lines or image on a brown or sepia background.

guestimating pya
envoi sandwich compound crave
alchemically

Pya is, apparently, a form of currency in Myanmar.  Surprisingly, that's something that you could indeed guesstimate, with a little bit of a stretch, like you could be 'guesstimating dimes.'  An envoi is a short final stanza at the end of some poems, serving as an explanation or a dedication or a summary.  (Why, Poesytron, are you becoming self-referential?)

I enjoy trying to imagine what it feels like to "crave alchemically" a "sandwich compound."  It doesn't sound very appetizing...

Sunday, February 27, 2011

Random Word Haiku for Feb. 27

aggressive rainwear
ungoverning Klondike Kirk
forty-eight global

I don't know who Klondike Kirk is, but I'd like to meet him.  I just hope he isn't wearing aggressive rainwear when I do.

Friday, February 25, 2011

Random Word Haiku for Feb. 25

associated
maestro di cappella Krogh
Pecksniffism timing


Sometimes I am surprised to see the words that come out of the Moby lexicon.  I mean, Pecksniffism!?  How strange and wonderful is that?  I am not sure what all resources were used to compile Moby, but I do know that a word was included in the common word list if it was contained in at least two dictionaries.  But the hyphenation file is not limited to just common words--whereas the common word list has about 75,000 words, the hyphenation list that I'm using has about 185,000.

Maestro di cappella is a fancy name for a conductor or music director.  The most famous people with the last name Krogh are Egil Krogh, a lawyer involved in Watergate, and August Krogh, a Nobel Prize winner in physiology.  (Neither, to my knowledge, ever conducted an orchestra.  However, Hanne Krogh is a Norwegian singer who won the Eurovision song contest in 1985.) Pecksniff comes from the Charles Dickens novel Martin Chuzzlewit, which I had never heard of, despite my tendency to hang out with Victorian enthusiasts.  Apparently Mr. Pecksniff was a big ol' hypocrite, who claimed to have superior morals and then went around mistreating everyone.  So to be a Pecksniffian is to hypocritically tell other people what to do and to intrusively interfere in other people's business.


I am finding it a bit of a stretch to find connections between the three lines today.  Anyone care to take a stab at it?

Wednesday, February 23, 2011

Random Word Haiku for Feb. 23

Poissons ratio
Wallensis mostly greenhouse
psychometrics melt


Deconstructing this:

Poisson's ratio has to do with contraction and expansion of objects when pressure is applied.

The most famous person with the last name Wallensis appears to be Thomas Wallensis, Bishop of St. David's in Wales in the 13th century.

Psychometrics has to do with measuring educational achievements and psychological traits (think IQ tests).

So does the "meaning" of this haiku lie in the relationship between science, religion, and education?  My mind also connects the words 'greenhouse,' a very warm place, and 'melt.'

Tuesday, February 22, 2011

Random Word Haiku for Feb. 22

spindleshanks impi
off-season curvey sharklike
submarginal clam

Monday, February 21, 2011

Random Word Haiku for Feb. 21

Marquis cutline vain
yelp inelasticity
acquiescently

Sunday, February 20, 2011

How It All Began

The whole idea for writing computer code to generate haiku struck me one day while I was at work.

Ecologists use a lot of statistical programs, but a popular one is R, which is more than just a statistical program in that it is also a programming language.  I've been learning to use this program and language recently to work with ecological data and analyses.  A few weeks ago, I began a project where I wrote code in R to parse text.  We had species descriptions for over 9,000 plant species in South Africa, and I started to learn how to use regular expressions to extract usable bits of data from the paragraph descriptions (for example, the height of the plants or the months when they flower).

While I was learning how to manipulate text in this way, my mind wandered to imagining other possibilities for this type of code.  And that's how the idea was born.

Honestly, I may never have followed up on the idea if I hadn't shared it with my friend Jared, poet and editor of the online magazine The Jivin' Ladybug.  Jared got really, really excited, which got me even more excited, which meant that I went home after talking with him and spent the next two nights up late at night, working on code.

In order to get syllable counts for words, I downloaded a file of 185,000 words with hyphenation marks from the Moby Project, which is a public-domain lexicon.  I was very grateful to find something I could freely use to let me easily calculate syllables.

And that was all I needed in order to generate random-word haiku.

The code I wrote starts out by selecting a random word and then checks the syllable count.  If adding that word to the first line won't make the syllable count for the line go over 5, it adds the word to the line.  Then it does it again, until there are 5 syllables in the first line.  Then it does the same thing for the second line (only with 7 syllables instead of 5), and the third line.

Here is another random word haiku-- the second one that the program wrote:

urushiol glaze
smallholding jabbing Pliny
hypostyle hinder

For those of you who are familiar with R or other programming languages, the code used to generate random word haiku is after the cut.  For the rest of you, all that junk after 'Read More' is just the stuff that tells the computer do to what I described a couple paragraphs above.

The First Poem My Computer Ever Wrote

fragmentizing cobb
exclamatory hurst smash
subchorioidal


There it is, the very first haiku produced by Poesytron 575.  The original, most basic form of my haiku-generation program selects words completely at random.*  I had big ideas about making rules for word selection based on how often words were paired together in real, human-written haiku-- but first of all, I had to make sure that it could do the most basic things like count the syllables in a line and so forth.  And this haiku, though it may not make much sense, proved that I was on the right track!

*In my next post, I'll tell you a little bit about the word list it was selecting from and how it worked.