Skip to content

Japanese handwriting recognition systems

When I was in Japan, one of the things that helped me get around was a free program for my PDA that would let me input Japanese characters using the stylus and look them up in a dictionary. However, the handwriting input method was very sensitive to stroke errors which was sometimes frustrating, as it is not always obvious what the stroke count and order is for a character encountered for the first time.

So I’ve always wanted to try my hand at writing a Japanese handwriting input method and see how far I could get. But before that, I thought it would be a good idea to do some research and find out what’s already out there. Googling for “Japanese handwriting recognition”, I found KanjiPad, a simple GTK reimplementation of JavaDict, which seems to be the first popular Japanese handwriting recognition program, judging by the number of ports. Indeed, the program I used, jpensip, was a port of JavaDict to Windows CE.

The algorithm JavaDict uses is particularly simple. The author provides a list of kanji characters and their stroke orders with a number assigned to each direction. The program would assume that each lift of the pen marked the end of a stroke and compared the user input to each kanji with the same number of strokes. Basically, for each stroke, it would try to divide it up into manageable pieces. Once it had a small enough segment of the user stroke and a correspondingly small dictionary substroke, it would compare the angle formed by the start and end points of the user stroke to the known angle of the dictionary substroke and calculate a score based on the difference. Then after the scoring process, the program would simply rank the kanji by score and display the ones with the lowest score.

The algorithm is quite effective, but only if you get the stroke count and order right. Also, the original JavaDict program only handled 2,000 or so common kanji. Some ports, like jpensip, added support for hiragana, katakana, arabic numerals, and punctuation, necessitating some enhancements; the above algorithm works poorly for short and curved strokes which are more common outside of kanji.

There’s also an interesting paper on using AI techniques to train a neural network to recognize hiragana. However, this is only practical for writing systems with a low character count, of which kanji is definitely not. Also, the training requirement is a disadvantage.

Decuma Japanese seems to be the leading commercial product for Japanese handwriting recognition. Its creators claim “[r]ecognition of Kanji characters written in non-standard stroke orders or in cursive form”; I’d be interested in seeing how well it actually performs. Perhaps I’ll pick up a Nintendo DS to see.

Anyway, I hammered out a rough prototype in Ruby that implements JavaDict’s algorithm. It’s not fully implemented yet, but it looks promising. Here are some screenshots (the top match is on the upper-left):

One Comment

  1. bobq wrote:

    Heh, horse-stable. You wrote horse-stable. Yeah, I know, it means subway station in Japan, but that’s what it means: horse-stable, or rather, a way station for horses.

    By the way, why don’t you try some Chinese pen input software? Can’t imagine it would be that different. Microsoft Office even has pen input.

    Posted on 24-Oct-06 at 5:52 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*