Jeff Duntemann's Contrapositive Diary Rotating Header Image

What Coding Starvation Does to You

I haven’t done any programming in so long I’m starting to hallucinate. Here is today’s hallucination. Lor’ help me, I would have written the whole thing if I hadn’t already read somewhere that counting syllables in arbitrary words is hard.

Open Dictionary text file; 
Create new output text file;

WHILE NOT EOF(Dictionary) DO
UNTIL WordIsNoun(WordEntry);
If CountSyllables(WordItself) = 1 THEN
Writeln(OutputFile, WordItself+'y Mc'+

Close dictionary file;
Close output file;


  1. Rick H says:

    REPEAT 4

  2. Michael Covington says:

    Boaty McBoatface? 🙂

    To relieve your coding starvation, you are ready for Steven Bird’s NLTK (Natural Language Toolkit). It’s a set of free Python programs and data sets, plus an O’Reilly book about how to use it (and learn Python as you go, if you’re not already into it or the relevant parts of it).

    BTW, counting syllables is not that hard, especially if all you want to do is find the 1-syllable words, so you don’t tangle with peculiarities of longer words. I give this problem to my students very early in the NLP course, as an example of formulating rules and testing them against natural language data.

    1. Yes. The idea was to create every possible [X]y Mc[X]face using ordinary 1-syllable dictionary words. This seems to be a fad right now; we have seen Trainy Mc Trainface and Schooly McSchoolface, and probably a lot more.

      There are some shortcomings with the generator, as some final consonants have to be doubled, as in Squiddy McSquidface, but it was good silly fun writing it out.

      That toolkit sounds like it’s worth a close look. I’m much better at Python than perl, which is what another one of my readers used to implement the pseudocode above, over on my LiveJournal mirror:

      He used a free Webster’s Unabridged dictionary file from Project Gutenberg that actually divides syllables with asterisks and double quotes, which makes syllable counting trivial. Here’s the file I’m pretty sure he was using:

  3. TRX says:

    My main problem with programming is that there’s usually *something* out there that will do 90% of what I want if I spend a few hours downloading and playing around. The other 10% always includes something I really want, but isn’t quite worth the time it would take to write my own application from scratch.

  4. Bob Fegert says:

    int getRandomNumber()
    return 4; //chosen by fair dice roll.
    //guaranteed to be random.

    1. TRX says:

      Back in the mid-1980s someone was selling hardware random number generators. They were little boxes that listened to cosmic ray events(?) and talked to the PC via a serial port.

      1. Carrington Dixon says:

        I’ve heard that the Las Vegas casinos use some form of analog random number generator rather than a software pseudo-random number generator

Leave a Reply

Your email address will not be published. Required fields are marked *