Version 2019.11.28

Charec

Charec is a minimalistic handwriting recognition program, written in 229 lines of JavaScript.

Download

charec-0.2.zip (2017-10-06, 47.9kb)

If you want to peek into the source code, go to the cgit repository.

Demonstration

Draw a single digit number (1-9) on the canvas using mouse.

How it works

Charec identifies handwriting characters using Levenshtein distance.

A common view of Levenshtein distance is that it is a measure of string similarity. You have a pair of strings (maybe English words, DNA sequences or whatever) that you want to know how alike they are, so you input them to the edit distance function and get some distance metric. This is pretty common stuff and nothing is wrong with that view.

A more interesting, albeit less common, view about Levenshtein distance is that it's an universal measure of similarity. That is, it can measure the similarity of anything (e.g. images, languages or graphs) as long as these things are encodable as strings. Here is how it typically goes like:

  1. Take object X that you want to measure the similarity.
  2. Find some way to convert X into a sequence of characters.
  3. Measure the edit distance.
  4. Now you have similarity metrics for X.

This is essentially how charec works. It takes a set of strokes traced by a mouse cursor, and compare their similarity by inputting them into Levenshtein distance function as strings. For encoding, I used the Schimke-Vielhauer-Dittman technique [link] and it turned out to work surprisingly well.

License

I hereby place my work "charec" into the public domain. All my copyrights, including related and neighbouring rights, of this work are abandoned.

2019 Fujimoto Seiji <fujimoto@ceptord.net>


Back to ceptord.net