The N-gram Sherlock Holmes

Can I give @Horse_ebooks a run for his money? I wrote a quick program to take in much of the Sherlock Holmes canon and create letter-based N-grams from them. Here's an example of the output with N=10, which seems to strike the right balance between unintelligible and over-fidelity. So I present to you a new Sherlock Holmes short story. I only added the title, some close-quotes and paragraph breaks, and the final "THE END".

With a Cold Sneer upon the Table

  "Crowder, the game-keeper in the temporary office, and Holmes had high hopes, while her pursuer dogged her some little use," he remarked, "if it is indeed, a stranger, that nobody can find this witness for you, perhaps, but at last he broke out at me, spitting and cursing, with a cold sneer upon the table."


The blundering against it, he put all his weight upon it.


Suspicion of treachery never for an instant but a glance of a face in a window, but in spite of my ignorance of the room. Very good, Brother Morris, we'll have the truth. "No doubt it's just what his employer of the woman Douglas. I saw no necessity to disturb the housekeeper's room."


"It looks like one of the mangled body, overwhelmed with grief and despair in his eyes were wild and staring!" An agitated water. He seemed himself during my checkered career, but never anyone in the room was laid down his room. Godfrey read it, and feeling once more. I am not sure that the game in their places.


My lens discloses more than the last. "I should wish to know."


"Well, was there yesterday that I spoke to her of the beautiful of women, and then to my amazement at the last occasion. He had had nothing save what I have it in me to make anything else?"


"'You have carte blanche."




"I tell you, however, another mouthful of dinner before they were bosom friend of yours, and I don't know the day that I cannot help you much. His only accomplishments, sir, may be less than five feet high and impenetrable to light, she stood blinking out that he had got a trap to take her on her own terms, and I have some strong influence on her destiny and that on your arrival had left us," but he said nothing but a curse yet upon the brass salver.


"A young lady has arrived at the tops with rich brown fur, completed his arrangements; but at the trial. Good-night!"


"Good-night, Councillor McGinty, you may not be. But I know nothing, so that I can't put two words together with an apology," he said.



Fixing a Meteor pinball machine


RLK NFS RBmeteor001

Photo by Rachel Kotkoskie, CC-BY

Around 1995, I bought a Meteor pinball machine. It was released in 1979 off the success of the movie Meteor, starring Sean Connery and Natalie Wood. Oh wait. The movie was, in fact, a complete flop. Anyway, I had played this machine in the 80's, and was feeling nostalgic. I think I bought it for about $600, and it was in working condition, except it would reboot every so often. Some short time later, the gas discharge score displays starting flaking out. These displays were Beckman SP-491 6-digit displays, ran off 175 volts DC, and were used before 7-segment LED displays became ubiquitous and cheap.

IMG 0249

IMG 0250

When I moved, I stuck the pinball machine in the basement. I didn't really know where in the house it could go, and the answer was pretty much nowhere sensible. So it stayed in the basement for 15 years.

Finally, a few weeks ago, I decided that if I hadn't used this thing in 15 years, I didn't really need it cluttering up the place. In working condition, Meteor goes for $800 - $1000, but I just didn't want the hassle of selling it, because then I'd have to make sure it worked, and even if it didn't work, I wanted whoever got it to fix it, not part it out. So I decided that the next best thing was to give the pinball machine to NextFab, on condition that they fix it and make it available to members. NextFab was happy to take me up on the offer. Easy, right? The schematics were all online, and the circuits and mechanics weren't very complex.

RLK NFS RBmeteor037

"This? This is not complex." Photo by Rachel Kotkoskie, CC-BY

Long story short, NextFab asked some outside people if they wanted to work on it, they initially said yes, but flaked out, so it was left to me to work on the machine.

RLK NFS RBmeteor011

The culprit. Also, note the totally ghetto light bulb wiring on the left. These are bare wires held in place by staples. Photo by Rachel Kotkoskie, CC-BY

The first thing I found was that none of the solenoids were working. After checking for wiring damage, I traced the solenoid circuitry until I located the fault: a dead chip, a 74154 4:16 decoder. I'm pointing at it in the image above. I could replace it for $3.50. But then I thought, what else is dead? The self-test revealed that some of the lights were not working, even with bulb replacements, and one of the ROM chips looked decidedly iffy. Three of the five score displays were dead.

I discovered that there are modern replacements for three of the four boards used in this machine. Which is really cool. Pinball isn't dead! The sound board doesn't have a replacement, but at least it wasn't dead.

NextFab generously paid for the replacement boards. I installed them, cleaned some of the switch contacts, and the machine worked!

RLK NFS RBmeteor013

The old solenoid driver, and the modern Alltek drop-in replacement. Photo by Rachel Kotkoskie, CC-BY

RLK NFS RBmeteor028

I played a game, and thought that perhaps I had set the game switches to easy mode. Turns out that I just never lost my pinball wizardry skills. Photo by Rachel Kotkoskie, CC-BY

That left the dead displays. Replacement gas discharge displayed cost $65 each, but they were advertised as "new old stock" which means they were manufactured over 30 years ago. How long would they last? Digital LED replacements were $45 each, but I knew I could design and build a replacement easily enough, and it would make a fun project.

RLK NFS RBmeteor017

"These displays? They suck." Photo by Rachel Kotkoskie, CC-BY

Now, the interface to these displays is essentially four data lines encoding the digit to display, and six data lines to select the digit to activate, five to select the display to activate, making 15 lines in total. 17 if you include power and ground. This would be trivial to build. But no, I had to go one better.

I didn't like 17 wires. I wanted something more elegant. I decided that I wanted to use a two-wire twisted wire interface. It had to be immune to noise, and the interface had to be supported in one-chip solutions. I chose I2C, which is really a digital communications protocol for chips on the same board, but there are extenders that can be used to increase the range. And it is also supported by Arduino, which meant I could at least contemplate a full Arduino-based pinball machine.

If I could replace those 17 wires by only four (power, ground, clock, data), I would be very happy. I found a nice little I2C chip, the AS1115 by Austria Microsystems, which could drive eight digits which would make the displays easy to build. It could also read keys, which could also be useful, since the pinball machine has to read the state of switches. The only problem was that the chip could only be programmed with four different addresses, and I had five displays, plus however many I wanted to use for switches.

Luckily, NXP makes an I2C multiplexer, which lets you activate an I2C "branch", so I could just put four AS1115's maximum on each branch. This is also useful when the hardcoded address prefixes on different I2C chips end up being the same, which happens surprisingly often.

Anyway, that's where I am. I'll be looking into making a circuit board for the displays, then another circuit board for taking the 15 data lines using an Arduino and converting them to the I2C scheme.

I'm not dead!

I haven't written in quite a while, almost a year! So, some updates:

  • I completed my Latin studies. I am currently attempting to read Erasmus's 1528 work De recta Latini Graecique sermonis pronuntiatione (On the correct pronunciation of Latin and Greek speech).
  • That acrylic cage thing I built for the Logical Engine? Not practical. I'm working on a new version which seems very practical. The problem I'm struggling with now is getting 14" long 1/8" x 1/4" steel to be straight enough. It would seem to involve 1000°F ovens or buying hot rolled steel instead of cold rolled steel -- although hot rolled steel doesn't come in bars as small as 1/8" x 1/4", which means time spent milling it down. Which could be an option. I don't know -- I'm not a mechanical engineer!
  • I donated my old Meteor pinball machine to NextFab, on the condition that they fix it and let any member play. The machine was fixed, and that is the subject of another post.
  • I've been cutting out the wood parts for the standard DIY Book Scanner and selling them. I've done about 15 of them, but the last two have been delayed, and that is also the subject of another post.
  • I installed a standard DIY Book Scanner at NextFab. More about that in yet another post.

So I'm not really dead, and I hope to write some more posts in the next few days.