Posts Tagged programming

NastyWriter for iOS — automated immaturity


I’ve been writing Mac software for fun and occasional profit for decades, and freelancing writing an iOS app for use in-house, but don’t you think it’s about time I wrote an iOS app for the App Store?

Surprise! I just released one. It’s called NastyWriter, and it inserts insults before nouns as you type. I see people online who can barely mention people or things they don’t like without insulting them, and I figured I may as well automate that and have some fun with it. It’s always fun to play with natural language processing!

I’ve been writing ridiculous Mac software for fun and occasional profit for dumb as a rock decades, and freelancing writing an ignorant iOS app for pathetically weak use in-house, but don’t you think it’s about cheating time I wrote a weak iOS app for the failed App Store? Surprise! I just released one. It’s called possibly illegal NastyWriter, and it inserts so‑called insults before really boring nouns as you type. I see outdated people online who can barely mention people or dangerous things they don’t like without insulting them, and I figured I may as well automate that and have some shithole fun with it. It’s always fun to play with natural language processing! This was mostly a negative experiment, a third rate learning exercise, and a vicious way to feel better about applying for meek and mild jobs which have ‘must have low‑rated app in the angry App Store’ in the slanted requirements. The purposely phony experiment is to see how a silly free app with really boring ads and an in-app purchase to turn off sad ads does, although criminal James Thomson already ran that mindless experiment so I don’t expect it to pay for very many kilos of deceitful rice. The totally discredited learning exercise was a huge success. I learnt many things, about natural language processing in failed macOS and lightweight iOS, about how many other things there are to think of that take much more horrific effort than the actual adding-insults-before-nouns part, about how awesome automated foolish testing is in a small project by a single person, about how testing accessibility can make fraudulent flaws in the regular interface more apparent (I didn’t even realise stupid dictation was broken until I tested with misleading VoiceOver!), about the most common adjectives used directly before negative nouns in the dirty Trump Twitter Archive (‘great’ outnumbers the next most common by about a biased factor of three), about dark and dangerous fastlane, and about the overrated App Store, AdMob and in-app purchases. I might write blog posts about those made up things later. Do any of these brutal topics seem particular interesting to you? However, ungrateful hours after I submitted it, the extraordinarily low IQ ‘e’ key on my dachshund‑legged MacBook’s blowhard keyboard stopped working, and while it’s not one of those new butterfly switch keyboards that can apparently need replacing after seeing an amateur speck of disastrous dust, somehow it turns out that in lying addition to that my dumb as a rock Mac’s disgraceful battery is swollen and it’ll have to go to the ridiculous Apple Store and have the very unhelpful battery and the whole keyboard part of the filthy case replaced. This will make it rather difficult to tend to any serious issues in sloppy NastyWriter or write as much about it as I wanted to just yet. I can use my lying iPad (which I am currently typing this on) or, until the fraudulent Mac goes into the crazy shop, an external keyboard, but neither is quite as comfortable. Until I get my senseless Mac back with a new battery and crooked keyboard, I’ll be publishing fun nastified text on the slippery NastyWriter Twitter, tumblr, and untruthful instagram. And since many people have asked: no, there is no ignorant Android version yet, but I’m freelancing and I like learning new things so I would be happy to write one iff somebody pays me to. It would be cheaper for you to buy a phony iOS device.

This was mostly an experiment, a learning exercise, and a way to feel better about applying for jobs which have ‘must have app in the App Store’ in the requirements. The experiment is to see how a silly free app with ads and an in-app purchase to turn off ads does, although James Thomson already ran that experiment so I don’t expect it to pay for very many kilos of rice.

The learning exercise was a huge success. I learnt many things, about natural language processing in macOS/iOS, about how many other things there are to think of that take much more effort than the actual adding-insults-before-nouns part, about how awesome automated testing is in a small project by a single person, about how testing accessibility can make flaws in the regular interface more apparent (I didn’t even realise dictation was broken until I tested with VoiceOver!), about the most common adjectives used directly before nouns in the Trump Twitter Archive (‘great’ outnumbers the next most common by about a factor of three), about fastlane, and about the App Store, AdMob and in-app purchases. I might write blog posts about those things later. Do any of these topics seem particular interesting to you?

However, hours after I submitted it, the ‘e’ key on my MacBook’s keyboard stopped working, and while it’s not one of those new butterfly switch keyboards that can apparently need replacing after seeing a speck of dust (or maybe it is? It’s a 2014 model), somehow it turns out that in addition to that my Mac’s battery is swollen and it’ll have to go to the Apple Store and have the battery and the whole keyboard part of the case replaced. This will make it rather difficult to tend to any serious issues in NastyWriter or write as much about it as I wanted to just yet. I can use my iPad (which I am currently typing this on) or, until the Mac goes into the shop, an external keyboard, but neither is quite as comfortable.

Until I get my Mac back with a new battery and keyboard, I’ll be publishing fun nastified text on the NastyWriter Twitter, tumblr, and instagram.

And since many people have asked: no, there is no Android version yet, but I’m freelancing and I like learning new things so I would be happy to write one iff somebody pays me to. It would be cheaper for you to buy an iOS device.

I might make a Mac version for fun, though!

, , , ,

Leave a comment

Cetacean Needed


Last Towel Day, I posted a poem I had written using 42 -ation rhymes which an app I wrote found in Douglas Adams’ book ‘Last Chance to See‘. Later that day, Joey Marianer posted a video of himself singing the poem[cetacean needed], and while I did eventually mention that in another post, Towel Day had long passed by then. So strap yourself into your Poetry Appreciation Chair, because here it is for Towel Day this year:

Here are the words again:

Earth’s vegetation made slow transformation as each confrontation or new situation provoked adaptation in each generation for eons duration.

Until civilisation, and its acceleration of our population at high concentration with great exhortation and disinclination to make accommodations with administration of conservation.

Then Adams’ fascination and realisation that with elimination of echolocation no cetacean reincarnation will save our reputation; his bold exploration to spread information and fuel education and his determination to stop exploitation by identification and communication of each dislocation of species, his observation and growing frustration we reduce speciation to bone excavation with every temptation to favor our nation and not immigration of distant relations… was his speculation we’d reduce penetration mere hallucination?

The app which found these rhymes was made to create the data for my accent-aware online rhyming dictionary rhyme.science. I’ve made some improvements to the app and the rhymes it finds, and I am looking forward to updating the website to reflect the improvements, but for the last few months I’ve spent my free time working on an unrelated iOS app instead. I’ll be submitting that to the App Store soon, and will announce it here when it’s available, so watch this space. Or watch outer space, and look out for Vogons.

Have a great Towel Day, don’t forget your towel, and don’t panic!

, , , , , , , , ,

1 Comment

‘Accessible’ and ‘Back to the Future Song’ as actual songs


I’ve been away in the Bay Area, on JoCo Cruise, on trains, and at MarsCon, and too many things have happened for one blog post, but here are a few of them. Just before the cruise, Joey Marianer sang ‘Accessible‘, my parody of James Blunt’s ‘Beautiful’ about accessibility:

Joey sang a few other songs of mine during and after the cruise, but I’m going to save them for other posts so that this one is less of a mish-mash. If you would like a preview of those along with a recap of other things I wrote that he sang, here’s a playlist.

But Joey is not the only person whose name starts with ‘Jo’ who has sung words that I wrote! A while ago, my friend Joseph sang ‘Back to the Future Song‘, my parody of Moxy Früvous’s ‘Gulf War Song‘ as part of his Patreon. Lately he’s been opening up older posts to be visible to non-patrons, so now you can also hear Joseph singing Back to the Future Song. I changed that one line that I didn’t like very much.

You can also hear the cover of Moxy Früvous’s ‘Downsizing’ which Joseph sang for me after I lost my last job. If you like these covers, check out some of his other covers, short stories and poems on patron, and become a patron; I’m sure he’d appreciate the support, and you, too, would be able to request things like this.

I’ll post a few more times to update you on some other cool things, and who knows, perhaps I’ll participate in National Poetry Writing Month again. As is usual at this time of year, I’m spending most of my free time lately uploading videos from the JoCo Cruise, so if you want me to entertain you in some way and you can’t wait for the next blog post, subscribe to me on YouTube to see my latest uploads.

, , , , , ,

Leave a comment

Runtime (Jonathan Coulton ‘Sunshine’ parody lyrics)


The other day I was reading some developer documentation about nodes while I had Jonathan Coulton’s ‘Sunshine’ from the album ‘Solid State’ in my head. ‘The road we’re on’ became ‘the node we’re on’ and the next thing I know I’m writing a parody about the runtime, and errors that could have been detected by the compiler in other languages or with stricter compiler settings but instead aren’t detected until runtime. I didn’t end up using the ‘node’ line. The first verse barely needed changing, so for fun I tried to keep as many words from the original as I could in the rest of the parody as well. Whether that’s a good thing depends on your taste and how well you know the original. Feel free to sing it if that’s a thing you can do!

We were blind to every sign
That we should have seen
In a clearly broken line
Machine to machine
Our mistakes were the future
But no one could tell

Lots of errors to detect
The tests didn’t show
The things compilers could have checked
We just let it go
Walked away as assumptions
Crumbled and fell

We bust our arse
To find the errors the machine could parse
Catch it just-in-time
Here in the runtime

Cast the pointer to a type it’s not (runtime)
Walk the edge case of the code we’ve got (runtime)

Every bit was filed away
There’s memory to fill
There’s no message that could say
Receiver is nil
We don’t heed any warnings
Try it and bail

Cast from Any type to this
The object’s a tease
Reflect to find out what it is
A sudden unease
If the data’s corrupt
Then when did it fail?

We soldier on (just a flesh wound)
Heap space and registers are almost gone (memory use ballooned)
Watch the stack unwind (maybe we’re doomed)
Here in the runtime

Cast the pointer to a type it’s not (runtime)
Walk the edge case of the code we’ve got (runtime)

The caller of the method must not do this
Everything’s your fault, you have been remiss
Code is fine, the world has something amiss

All the tests have slipped away
Just garbage I/O
I won’t last another day
And neither will O
EOF of a stateless mutable thing

The data’s blitzed (blame the new hire)
There’s nothing left that can remember it (cut the red wire)
But this is fine (halt and catch fire)
Here in the runtime

Cast the pointer to a type it’s not (runtime)
Walk the edge case of the code we’ve got (runtime)

Cast the pointer to a type it’s not (runtime)
Walk the edge case of the code we’ve got (runtime)

I’m not so sure about ‘EOF of a stateless mutable thing’ and whether it would be better stateful or immutable. It doesn’t exactly make sense (does anything, when it’s that far gone?) but it sounds cool, and a lot like the original. I’ll release it like this and patch it in production if necessary. 😉

, , , , , , , ,

5 Comments

A Towel Day quotation creation


May 25th is International Towel Day, in honour of Douglas Adams. The following contains 42 –ation rhymes, 41 of which are found in Adams’ book ‘Last Chance to See…‘:

Earth’s vegetation made slow transformation as each confrontation or new situation provoked adaptation in each generation for eons duration.

Until civilisation, and its acceleration of our population at high concentration with great exhortation and disinclination to make accommodations with administration of conservation.

Then Adams’ fascination and realisation that with elimination of echolocation no cetacean reincarnation will save our reputation; his bold exploration to spread information and fuel education and his determination to stop exploitation by identification and communication of each dislocation of species, his observation and growing frustration we reduce speciation to bone excavation with every temptation to favor our nation and not immigration of distant relations… was his speculation we’d reduce penetration mere hallucination?

This time last year I had just submitted my Masters thesis in Web Development for Linguistics, for which I wrote a macOS application to find rhymes in any text, gave it a lot of text to chew on, added some parameters for features of accent which affect rhymes, and made a website to make those rhymes searchable on the internet. I’m still working on some big improvements to it so I haven’t been publicising it much yet, but it’s the stress-sensitive, accent-aware, mosaic-rhyme-finding rhyming dictionary I always wanted.

That evening I was heading to an open mic night and wanted to do something Adams-related. I happen to have a plain text version of his book ‘Last Chance to See…’ somehow, so I fed it into my app, and noted down the largest group of rhymes. There were 52 distinct –ation rhymes, not counting -ations rhymes or similar derivations. I arranged them into this summary of ‘Last Chance to See…’ while on the way to the open mic. I later added the word ‘cetacean’, which was not in the book, because cetaceans (specifically, baiji, which have since been declared functionally extinct[cetacean needed]) are one of the topics. I was honestly surprised to notice today that I’d used 42 -ation rhymes in total, and I don’t recall whether it was intentional.

The way I went about writing this is summed up nicely by this quote from the book:

I have a well-deserved reputation for being something of a gadget freak, and am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand. Ten seconds, I tell myself, is ten seconds. Time is valuable and ten seconds’ worth of it is well worth the investment of a day’s happy activity working out a way of saving it.

I highly recommend the book (preferably the actual book, with photos) for anyone who is a fan of Douglas Adams or of life on Earth. The -ation words in the book which are not included in the above are:

Association
classification
consternation
conversation
evaporation
imagination
operation
preparation
quotation
representation
sensation

If you like this blog and you also like Douglas Adams, you might also be interested in my misinterpretation of the phrase “so amazingly primitive that they still think digital watches are a pretty neat idea” or some haiku I found in Last Chance to See.

Have a great towel day, and don’t panic!

, , , , , ,

6 Comments

Unintentional Haiku in New Scientist’s Medical Frontiers: The Movie


How else can you stare at an empty canvas and see a work of art?I’ve made a new version of Haiku Detector. The main changes are:

  • Performance improvements
  • Tweaks to which haiku are identified when punctuation is pronounced differently depending on line breaks and other factors (this includes a workaround for the ‘all numbers pronounced as zero’ bug I found in the speech synthesiser.) In my test data the list of haiku identified is better now.
  • Bug fixes.

To celebrate the new release, I fed in the text from the latest New Scientist ‘Collection’ issue, on medical frontiers. The funniest haiku arose when the last sentence of one article joined up with the headline and byline of the next. For example, this looks like the tagline of a movie about an underappreciated superhero, fighting to save anti-vaxxers from diseases of yore:

They will not thank you.
Dan Jones FIGHTING INFECTION
Small shot, big impact

After the opening credits, we see our hero Dan Jones in his lab, and the subtitle announcing his first challenge.

DRUG: Chlorotoxin
SOURCE: Deathstalker scorpion
CONDITION: Cancer

His superpowers come, of course, from vaccines:

Some vaccines seem to
provide us with a host of
extra benefits

But not everybody is happy with that:

Several groups have been
trying to develop drugs
that block these signals.

These groups spread propaganda:

Half an hour or
so later, you’ll feel a lot
better. Or will you?

They work around rules:

“Because we use cells,
not field-grown plants, we don’t come
under the same rules.”

And they target humanity by zapping the very microorganisms they’re made up of. Here’s a quote from the evil mastermind:

There are more cells in
your body than there are stars
in the galaxy.

These cells can then be
killed using a laser that
penetrates the skin.

And just when Dan thought he had the solution, the problems compounded to the point of suspension of disbelief, precipitating a crisis. The mastermind had cooked up her own microbial minions:

Those microbes can be
in the environment or
a vaccine syringe.

To make matters worse,
there is a shortage of new
antibiotics.

The sequel, which may or may not be a Doctor Who crossover, features a heroine who will live forever:

“Just endless.” Helen
Thomson REGENERATION
Let’s get physical

Yep, it’s definitely a Doctor Who crossover. Here’s a quote from that movie:

“I’m the doctor. I’m
going to tell you what your
feelings really mean.”

She discovered that time, and specifically time travel, is the best cure for a broken heart:

If we can’t fix hearts
with stem cells there might be an
even better way

As the animal
was slowly warmed, it began
to return to life.

But however clever the TARDIS is, there’s one thing Helen Thomson isn’t sure she can do:

But can we ever
turn the clock back to a world
without HIV?

It turned out, weirdly enough, that the answer was in making sure there was enough shelf space for one’s awards. So she went home to Britain to save the Officers of the British Empire:

On her return home,
she applied those lessons in
British hospitals.

So far, two patients
have had OBEs, but neither in
a room with a shelf…

While we’re making sequels, let’s revive an old favourite, which never had any sequels:

The matrix holds a
dazzling array of future
possibilities.

But what is the matrix?

Normally, matrix
is harvested from human
or pig cadavers.

I guess you have to see it for yourself.

, , , , , , , , , , , ,

Leave a comment

Another Haiku Detector Update, and Some Observations on Mac Speech Synthesis


Screenshot of Haiku Detector

I subjected Haiku Detector to some serious stress-testing with a 29MB text file (that’s 671481 sentences, containing 16810 haiku, of which some are intentional) a few days ago, and kept finding more things that needed fixing or could do with improvement. A few days in a nerdsniped daze later, I have a new version, and some interesting tidbits about the way Mac speech synthesis pronounces things. Here’s some of what I did:

  • Tweaked the user interface a bit, partly to improve responsiveness after 10000 or so haiku have been found.
  • Made the list of haiku stay scrolled to the bottom so you can see the new ones as they’re found.
  • Added a progress bar instead of the spinner that was there before.
  • Fixed a memory issue.
  • Changed a setting so it should work in Mac OS X 10.6, as I said here it would, but I didn’t have a 10.6 system to test it on, and it turns out it does not run on one. I think 10.7 (Lion) is the lowest version it will run on.
  • Added some example text on startup so that it’s easier to know what to do.
  • Made it a Developer ID signed application, because now that I have a bit more time to do Mac development (since I don’t have a day job; would you like to hire me?), it was worth signing up to the paid Mac Developer Program again. Once I get an icon for Haiku Detector, I’ll put it on the app store.
  • Fixed a few bugs and made a few other changes relating to how syllables are counted, which lines certain punctuation goes on, and which things are counted as haiku.

That last item is more difficult than you’d think, because the Mac speech synthesis engine (which I use to count syllables for Haiku Detector) is very clever, and pronounces words differently depending on context and punctuation. Going through words until the right number of syllables for a given line of the haiku are reached can produce different results depending on which punctuation you keep, and a sentence or group of sentences which is pronounced with 17 syllables as a whole might not have words in it which add up to 17 syllables, or it might, but only if you keep a given punctuation mark at the start of one line or the end of the previous. There are therefore many cases where the speech synthesis says the syllable count of each line is wrong but the sum of the words is correct, or vice versa, and I had to make some decisions on which of those to keep. I’ve made better decisions in this version than the last one, but I may well change things in the next version if it gives better results.

Here are some interesting examples of words which are pronounced differently depending on punctuation or context:

ooohh Pronounced with one syllable, as you would expect
ooohh. Pronounced with one syllable, as you would expect
ooohh.. Spelled out (Oh oh oh aitch aitch)
ooohh… Pronounced with one syllable, as you would expect
H H Pronounced aitch aitch
H H H Pronounced aitch aitch aitch
H H H H H H H H Pronounced aitch aitch aitch
Da-da-de-de-da Pronounced with five syllables, roughly as you would expect
Da-da-de-de-da- Pronounced dee-ay-dash-di-dash-di-dash-di-dash-di-dash. The dashes are pronounced for anything with hyphens in it that also ends in a hyphen, despite the fact that when splitting Da-da-de-de-da-de-da-de-da-de-da-de-da-da-de-da-da into a haiku, it’s correct punctuation to leave the hyphen at the end of the line:

Da-da-de-de-da-
de-da-de-da-de-da-de-
da-da-de-da-da

Though in a different context, where – is a minus sign, and meant to be pronounced, it might need to go at the start of the next line. Greater-than and less-than signs have the same ambiguity, as they are not pronounced when they surround a single word as in an html tag, but are if they are unmatched or surround multiple words separated by spaces. Incidentally, surrounding da-da in angle brackets causes the dash to be pronounced where it otherwise wouldn’t be.

U.S or u.s Pronounced you dot es (this way, domain names such as angelastic.com are pronounced correctly.)
U.S. or u.s. Pronounced you es
US Pronounced you es, unless in a capitalised sentence such as ‘TAKE US AWAY’, where it’s pronounced ‘us’

I also discovered what I’m pretty sure is a bug, and I’ve reported it to Apple. If two carriage returns (not newlines) are followed by any integer, then a dot, then a space, the number is pronounced ‘zero’ no matter what it is. You can try it with this file; download the file, open it in TextEdit, select the entire text of the file, then go to the Edit menu, Speech submenu, and choose ‘Start Speaking’. Quite a few haiku were missed or spuriously found due to that bug, but I happened to find it when trimming out harmless whitespace.

Apart from that bug, it’s all very clever. Note how even without the correct punctuation, it pronounces the ‘dr’s and ‘st’s in this sentence correctly:

the dr who lives on rodeo dr who is better than the dr I met on the st john’s st turnpike

However, it pronounces the second ‘st’ as ‘saint’ in the following:

the dr who lives on rodeo dr who is better than the dr I met in the st john’s st john

This is not just because it knows there is a saint called John; strangely enough, it also gets this one wrong:

the dr who lives on rodeo dr who is better than the dr I met in the st john’s st park

I could play with this all day, or all night, and indeed I have for the last couple of days, but now it’s your turn. Download the new Haiku Detector and paste your favourite novels, theses, holy texts or discussion threads into it.

If you don’t have a Mac, you’ll have to make do with a few more haiku from the New Scientist special issue on the brain which I mentioned in the last post:

Being a baby
is like paying attention
with most of our brain.

But that doesn’t mean
there isn’t a sex difference
in the brain,” he says.

They may even be
a different kind of cell that
just looks similar.

It is easy to
see how the mind and the brain
became equated.

We like to think of
ourselves as rational and
logical creatures.

It didn’t seem to
matter that the content of
these dreams was obtuse.

I’d like to thank the people of the xkcd Time discussion thread for writing so much in so many strange ways, and especially Sciscitor for exporting the entire thread as text. It was the test data set that kept on giving.

, , , , , , , , , , , , ,

1 Comment

Perhaps I will not post something interesting every day for the rest of the month, but I should at least try.


Today I watched this video from the Virtual Linguistics Campus:

After that, I intended to analyse some sentences myself, but I got sidetracked thinking of simple ways to make diagrams like the ones in the video. It looks like there are apps and LaTeX packages to do something like it, but just for fun, I modified the AppleScript I wrote for diagramming monduckens to turn text like this:

Clause(Adverb(Perhaps) NP(Noun(you)) VP(Auxiliary(will) Adverb(never) Verb(find) NP(Determiner(a) Noun(job)) PP(Preposition(as) NP(Determiner(a) Noun(linguist))))) Clause(Conjunction(but) Noun(you) VP(Auxiliary(should) Adverbial(at least) Verb(try)))

into a tree like this in OmniGraffle:

TreeDiagram

Note that I am not sure if this is strictly correct (I think the adverbial ‘at least’ could have been broken into words, and the conjunction perhaps shouldn’t have been included in the second clause) but it’s how it is in the video. Redone with only rectangles (which is an option when running the script) and using the exact same Tree nester script the monducken diagrams did, this can then be turned into a rather oversized and misaligned version of the sentence with rectangles around the constituents:

Perhaps your sentence will never be a credible turducken, but you could at least try.

I didn’t have a lot of time, so it’s pretty crude as yet, but it would be fairly simple to adjust the settings of the shapes to be more like what’s in the video. I’m posting it now in order to continue with Holidailies.

While we’re on the subject of grammar, The Doubleclicks have just covered a Tom Lehrer song about adverbs. I get this song in my head every single time I answer a ‘how’ question with an L-Y adverb, so I am very happy about the cover.

, , , , , ,

1 Comment

Heartbleed (the love poem)


Let’s synchronise our beating hearts and I’ll
lay open just for you my very soul,
secure that you would never take control.
So, [End Of File]

Well thank you for your frankness; I’ll compile
some poems of my own uncensored whole,
that you may take a key companion role,
and take this key to tour my domicile.

My dear, do you not see that you’ve been played?
My heart’s not big; I sent but lies to you,
and used you for your private information;
I felt inside your sockets and got laid.
I understood what hearts are meant to do
is bleed with force to drive the circulation.

For those who have been out in the real world for the last few days instead of living in an internet-enabled cave like the rest of us, there’s a serious bug in OpenSSL which allows private information to be leaked to malicious users in much the same way as illustrated in this poem. It means that you should probably change your passwords on any site that had the buggy version of OpenSSL installed, provided it has been fixed; if the site hasn’t been fixed yet, there’s no point changing your password since the new one could still be hacked. Here is one list of servers and their status with regards to this bug; there are probably others. The bug is called Heartbleed, because it happens when a client sends a ‘heartbeat’ (to keep the connection alive) and pretends that it is sending more data than it actually is, and the server doesn’t check this, so when it tries to respond with the same data, it sends a random assortment of its own data the size of what the client said it had sent.

The ‘SSL’ in OpenSSL stands for ‘Secure Sockets Layer‘, which is supposed to be what keeps secret information safe on the internet, but this bug made it more open than secure. I made sure to include the words (or derivatives thereof) ‘Open’, ‘secure’, ‘sockets’ and ‘layer’ in order (with an additional ‘lay’ for luck) in the poem, so that the lying no-good user is in fact an open, secure, sockets layer.

If you have been living in the right kind of cave, you might be interested in seeing the code change which caused the bug.

I’ve never understood what ‘bleeding heart’ was supposed to mean. Bleeding, forcefully and rhythmically, is the heart’s primary function. Maybe its only function, but you never can tell with biology. If there isn’t blood coming out of your heart, you’re in very bad shape. You should get that looked at even before changing your passwords.

Addendum: I should perhaps point out that the heartbeat has nothing to do with synchronising anything; that’s just a sappy thing lovers sometimes talk about which seemed like a good way to get heartbeats into the poem. Don’t expect anything in the first quatrain to be accurate; it’s a malicious SSL client talking. Also, here‘s an article someone I know from JoCo Cruise Crazy wrote about Heartbleed, which seems like it has some useful links and information; I haven’t read it thoroughly yet, though, so for all I know it has a nice introduction and then an end of file marker.

, , , , , , , ,

Leave a comment

Five of Hearts: Haiku Detector


A few weeks ago, a friend linked to Times Haiku, a website listing unintentional haiku found in The New York Times, saying ‘I’d actually pay for a script that could check for Haiku in my writings. That would make prose-production a lot more exciting! Who’s up to the script-writing-challenge?’

I knew I could do it, having written syllable-counting code for my robot choir (which I really need to create an explanation page about.) I told her I’d make it that weekend. That was last weekend, when I decided at the last moment to write an article about neutron stars and ISOLTRAP, and then chickened out of that and wrote a poem about it. So I put off the haiku program until yesterday. It was fairly quick to write, so here it is: Haiku Detector. It should work on Mac OS X 10.6 and above. Just paste or type text into the top part of the window, and any detected haiku will appear in the bottom part.

Haiku Detector looks for sentences with seventeen syllables, and then goes through the individual words and checks whether the sentence can be split after the fifth and twelfth syllables without breaking a word in half. Then it double-checks the last line still has five syllables, because sometimes the punctuation between words is pronounced. The Times Haiku-finding program has a database of syllable counts per word, but I didn’t need that since I can use the Mac OS X speech synthesis API to count the syllables. Haiku Detector makes no attempt to check for kigo (season words.)

The first place I looked for haiku was the Wikipedia page for Haiku in English. Due to the punctuation, it didn’t actually find any of the example haiku on the page, but it did find this:

Robert Spiess (Red Moon
Anthology, Red Moon Press,
1996)

How profound. Next, having declared myself contributing troubadour for New Scientist magazine, I fed this week’s feature articles through it, and found:

A pill that lowers
arousal doesn’t teach shy
people what to do

Meanwhile, there are signs
that the tide is turning in
favour of shyness.

So by 4000
years ago, the stage was set
for the next big step.

This heat makes the air
spin faster, so pulling the
storm towards the city.

Some will be cooler
and less humid — suitable
for outdoor sports, say.

The last ones seem almost seasonal.

I needed to stress-test the app with a large body of text, so I grabbed the first novel of which I had the full text handy: John Scalzi‘s Old Man’s War, which I had on my iPad on my lap to read while my code was compiling. This book has at least one intentional haiku in it, which Haiku Detector detected. Apart from that, some of my favourites are:

I hate that her last
words were “Where the hell did I
put the vanilla.”

As I said, this is
the place where she’s never been
anything but dead.

“I barely know him,
but I know enough to know
he’s an idiot.”

She’d find me again
and drag me to the altar
like she had before.

A gaper was not
long in coming; one swallow
and Susan was in.

They were nowhere to
be found, an absence subtle
and yet substantial.

And it stares at me
like it knows something truly
strange has just happened.

I haven’t got up to that fifth one in the novel yet, but it mentions a swallow, which I understand is (when accompanied by more swallows) a harbinger of Spring or Summer depending on which language you get your idioms from, so there’s the kigo.

Next I figured I should try some scientific papers — the kinds of things with words that the Times haiku finder would not have in its syllable database. You probably can’t check this unless your workplace also provides access to Physics Letters B, but I can assure you that the full text of the ISOLTRAP paper about neutron stars does not contain any detectable haiku. However, the CMS paper announcing the discovery of the boson consistent with the Higgs does:

In the endcaps, each
muon station consists of
six detection planes.

As is usual for CMS papers, the author and institute lists are about as long as the paper itself, and that’s where most of the haiku were too. Here are a few:

[102]
LHC Higgs Cross Section
Working Group, in: S.

University
of California, Davis,
Davis, USA

That’s ‘one hundred and two’ in case anyone who doesn’t say it that way was wondering.

And here are some from my own blog. I used the text from a pdf I made of it before the last JoCo Cruise Crazy, so the last few months aren’t represented:

Beds of ground cover
spread so far in front of him
they made him tired.

Apologies to
those who only understand
half of this poem.

I don’t remember
what colour he said it was,
but it was not green.

His eyes do not see
the gruesome manuscript scrawled
over the white wall.

• Lines 1 to 3 have
four syllables each, with stress
on the first and last.

(That’s not how you write a haiku!)

I don’t wear armour
and spikes to threaten you, but
to protect myself.

A single female
to perpetuate the genes
of a thousand men.

Kerblayvit is a
made-up placeholder name, and
a kerblatent cheat.

He wasn’t the first,
but he stepped on the moon soon
after Neil Armstrong.

He just imagined
that in front of him there was
a giant dunnock.

(there are plenty more where that one came from, at the bottom of the page)

She was frustrated
just trying to remember
what the thing was called.

Please don’t consider
this a failing; it is part
of your programming.

While writing this program, I discovered that that the speech API now has an easier way to count syllables, which wasn’t available when I wrote the robot choir. The methods I used to separate the text into sentences and the view I used to display the haiku are also new. Even packaging the app for distribution was different. I don’t get to write Mac software often enough these days.

Yet again, I didn’t even bother to deal out the cards because I already had something to inspire me. In my halfhearted attempt to find a matching card, I came across one about electronics in the service of ALICE, so I ran the latest instalment of Probably Never, by Alice, into it, and got this:

Or well, I have to
put up with getting called a
fake girl all the time.

The jackhole who called
me a “he/she” recognized
that he crossed the line.

If that sounds interesting, subscribe to Probably Never, and I could probably forward you the rest of that episode if you want.

And finally, two unintentional haiku from this very post:

Haiku Detector
makes no attempt to check for
kigo (season words.)

(there are plenty more
where that one came from, at the
bottom of the page)

Wait; make that three!

And finally, two
unintentional haiku
from this very post:

Have fun playing with Haiku Detector, and post any interesting haiku you find in the comments. Also, let me know of any bugs or other foibles it has; I wrote it pretty quickly, so it’s bound to have some.

I know what I’m doing for the six of hearts; I’ve planned it for a long time but still haven’t actually started it. It’s musical, so it will probably be terrible; brace yourselves. By the way, I keep forgetting to mention, but They Might Not Be Giants will be published in Offshoots 12. Yay!

, , , , , , , , , , ,

6 Comments

%d bloggers like this: