=== Top of the Swiki === Attachments ===

Character Recogniser

From the SqueakList, October 27, 1997, and edited by Russell Allen. The original version of the Character Recogniser Page has the version before I edited it.


Alan Kay wrote:

You might guess correctly that pen-computing and a pen-based Squeak are close to our hearts.

If you go to the class browser, you will find under System Support a class called CharRecog that implements my version of the great original GRAIL character recognizer done at RAND in the sixties by Gabe Groner. The recognizer today most in the spirit of Gabe's is Graffiti, but the latter is not really as good!

It was written quickly (a few days) to help calibrate the original Squeak implementation. It has lots of comments and is very short so you should be able to see how it works and how to experiment with it.

Like GRAIL (and Graffiti) it takes each character as a single stroke. Unlike Graffiti, it is trainable. Each time it doesn't recognize a character, it gives you the opportunity to tell it what the character was supposed to be. A dictionary is gradually built up. You will get good results if you train it on the Graffiti character set. The recognizer is plenty good enough to not need Graffiti's case shifts to have lots of characters.

The current version is set to show you both the stroke and the filtered points that are chosen. You can comment out the latter if you wish. Generally the fewer filtered points the better! You might want to filter out more points since Squeak is at least 10 times faster now than it was when I wrote the code. A more sophisticated version should obviously time sample in order to be uniform over all of the ports.

The recognizer can be activated in any text view by entering command-R. You should be able to make a number of dictionaries that hold different experiments in taking a stroke -> character. Since the start and order of a stroke are features, you can make a shape e.g. "O" mean lots of things in the same dictionary: lower case and caps, zero, rectangle, and oval, etc., can all coexist.