Ulysses Haikus

I have discovered a very simple algorithm for generating passable English poetry: grab random sentences from the greatest novel ever written and plug them into the most primitive template you can find. I call this project "Ulysses haikus."

To start we need the text itself and a few lines of Python code to parse it, which should leave us with a list of every sentence in the book. From there we can make two sub-lists containing nothing but five- and seven-syllable sentences (for the 5-7-5 haiku pattern) and use those to randomly generate our poems. You can find the full code, including a cute function for the syllable counts by Danny O'Brien, on this page.

Of the one hundred poems I generated in my first trial, about half ended up being readable, which says something both about Joyce's facility with words and the integrity of haikus. Ten, in particular, were actually quite striking:

						
					He waits while you wait 
					Moonlight silver effulgence 
					He is young Leopold 

					Hhhn: burst sideways 
					His gun rusty from the dew 
					Breakfast is ready 

					I'll flay him alive 
					Uncertainly he waited 
					Heavy of the past 

					Holohan told me 
					WHAT'S WRONG WITH HIM? I said 
					No security 

					Watching his water 
					Wonder where it is really 
					where the tide ebbs .. 

					You are cautioned 
					Beware of imitations 
					History to blame 

					Must be his deathday 
					Known as Koch's preparation 
					And the rest nowhere 

					Serum and virus 
					Dreadful life sailors have too 
					I needn't tell you 

					ALLELUIA 
					Wonder how he looks at life 
					Probably neuter 

					Repentance skindeep 
					 --Yes, sir, the chemist said 
					Where I come in 
					

In any case I was pleased with the results, though I encourage more experiments as I'm sure there are plenty of gems yet uncovered. Send your best to haikus AT jsomers.net.