University of Washington has a project with the awesome name dollar family of gesture recognizers.

They have demonstrations to go with their recognizers, but:

  • the JavaScript implementation they provided is a single JS file which pollutes the global namespace and cannot be used together with other recognizers they provide (e.g you cannot $1 and $P recognizers because the definition of Point class is different in both).
  • the demos do not work on touch devices D:

So I wrapped it in bower and made a demo where you teach a $P recognizer about Latin alphabets.

I was amazed by how quickly it learns and well it is able to generalize from even a single example to categorizing cursive handwriting which barely looked like the original templates.