Haiku Detector Update


On Monday I posted a quick-and-dirty Haiku Detector Mac application I’d written which finds haiku (in terms of syllable counts and line breaks, not aesthetics) in any given text. Since then I’ve made it less dirty and maybe more quick. It now shows progress when it’s busy looking for haiku in a long text, and gives you a count of the sentences it looked at and the haiku it found. You can also copy all the haiku (Copy All Haiku in the Edit menu) or save them to a file (Save in the File menu.) Here’s where you can download the new version, which should still work on Mac OS X 10.6 and later. And here are a few more haiku I’ve found with it.

There’s only one (not counting a by-line) in the feature articles of the April 27 edition of New Scientist:

Inside a cosy
new gut the eggs hatch and the
cycle continues.

From Flatland: a romance of many dimensions, by Edwin Abbott Abbott:

On the reply to
this question I am ready
to stake everything.

“I come,” said he, “to
proclaim that there is a land
of Three Dimensions.”

Man, woman, child, thing—
each as a Point to the eye
of a Linelander.

This was the Climax,
the Paradise, of my strange
eventful History.

Here are a few more from Flatland which I’m editing this post to add, since I liked them more on the second reading:

Let us begin by
casting back a glance at the
region whence you came.

Therefore, pray have done
with this trifling, and let us
return to business.

Even if I were
a baby, I could not be
so absurd as that.

From Last Chance to See, by Douglas Adams and Mark Carwardine, which I somehow ended up with a text file of many years ago and eventually got a book of:

I’ve been here for five
days and I’m still waiting for
something to go right.

We each went off to
our respective rooms and sat
in our separate heaps.

They’re nocturnal birds
and therefore very hard to
find during the day.

It looked like a great
horn-plated tin opener
welded to its face.

We keep searching for
more females, but we doubt if
there are any more.

The very laws of
physics are telling you how
far you are from home.

Foreigners are not
allowed to drive in China,
and you can see why.

`Just the one left,’ she
said, putting it down on the
ground in front of her.

Yet it was hunted
to extinction in little
more than fifty years.

And conservation
is very much in tune with
our own survival.

And here’s my own haiku about a particularly amusing passage in that book:

Here Douglas Adams
trudges through his anagram:
Sago mud salad.

Charles Darwin’s most popular work, The Formation of Vegetable Mould Through the Action of Worms with Observations on their Habits, only contained 12 mostly-lacklustre haiku, but I like to think this one is a metaphor:

Worms do not always
eject their castings on the
surface of the ground.

Something about lack of worm castings being only skin-deep.

But most of these don’t mention nature or seasons, as haiku should. So here are some from Sylva, or A Discourse of Forest Trees:

Dieu, and thence rode to
Blois and on to Tours, where he
stayed till the autumn.

How graphic, and how
refreshing, is the pithy
point thus neatly scored—

Meteorology, or Weather Explained, by J.G. M’Pherson contains some very poetic-sounding unintentional haiku:

“It’ll pe aither
ferry wat, or mohr rain”—a
poor consolation!

“Beware of rain” when
the sheep are restive, rubbing
themselves on tree stumps.

The brilliant flame, as
well as the smoky flame, is
a fog-producer.

Till ten o’clock the
sun was not seen, and there was
no blue in the sky.

But, strange to say, there
is a healing virtue in
breathing different air.

There is much pleasure
in verifying such an
interesting problem.

Unfortunately, there are no haiku in Dijkstra’s ‘Go To Statement Considered Harmful‘.

The app still uses a lot of memory if you process a novel or two, and may have trouble saving files in that case; It looks like it’s a bug in the speech synthesis library (or my use of it) or simply a caching strategy that doesn’t work well when the library is used in this rather unusual and intensive way. Anyway, if you ever try to save a file and the Save dialog doesn’t appear, try copying instead, and relaunch the program.

Next I think I’ll experiment with finding the best haiku based on the parts of speech at the ends of lines. But first, I’d better start working on the thing I’ve plan to do for the six of hearts.

If you’ve found any nice unintentional haiku, or if you can’t run Haiku Detector yourself but have ideas for freely-available texts it could be run on, let me know in the comments.

, , , , , , , , ,

  1. #1 by kurukkan on June 20, 2013 - 9:49 pm

    ERB ‘A Princess of Mars’ could be interesting … gutenberg.org/ebooks/62

    Like

    • #2 by Angela Brett on June 23, 2013 - 2:38 am

      Good idea; there are some nice haiku in that. I started preparing a blog post with them, but I went overboard and decided to do the whole series. Then I realised it would be a good post to mention another Mars-related haiku searching operation I want to do, and eventually I decided it would take too long to do tonight. But I will put them up soon. In the mean time, here is my favourite one:

      “I have escaped from
      worse plights than this,” and I tried
      to smile as I lied.

      Like

  2. #4 by lolexistence on April 7, 2014 - 3:59 am

    Have you ever run the finder on a scientific journal article? Do you have a pc version of the program. This is such an amazing tool!

    Like

    • #5 by Angela Brett on April 7, 2014 - 6:28 am

      I originally wrote it because a friend of mine saw the Times Haiku website and wondered if there were any haiku in her thesis, so I think she ran it on that and didn’t find anything. I have run it on one of the papers about the Higgs discovery, and the Princeton Companion to Mathematics.

      The way I did it would not work on PC, since I used the Mac’s built-in speech synthesis API, and I don’t think that exists on PC. It would be necessary to build up a database with the number of syllables in each word, like the Times Haiku people

      Like

  3. #6 by Foolish bean on August 17, 2017 - 9:06 pm

    Do you have any plans for releasing the source code?

    Like

    • #7 by Angela Brett on August 17, 2017 - 9:24 pm

      No concrete plans yet, but I’ve been doing a lot of other things with the speech synthesis API recently, in Swift, so what I might do is factor out some of the common stuff I’ve been doing in various apps, release that code as some kind of doing-weird-stuff-with-speech-synthesis framework, and rewrite Haiku Detector in Swift so it can use it (and possibly serve as example code.) I’ve learnt some more things doing http://rhyme.science which I could probably use to improve Haiku Detector.

      Like

  1. Unintentional Haiku… of Mars | Creative Output
  2. Unintentional Haiku from New Scientist, on Reality, Existence, and God | Creative Output
  3. A Towel Day quotation creation | Creative Output

Leave a comment