Handwriting recognition inside the VKB

Since my last post, MaemoCJK has been released for beta-testing with support for Japanese/Chinese handwriting recognition, together with a few new interesting features such as switch between input methods at runtime.

Tomoe inside the VKB

This screenshot showcases the latest development I made. This is not shipped with the beta-release mentioned above but should hopefully be part of the upcoming release. As suggested in the comments of my last post, I tried to include the input pad directly inside the VKB (Virtual Keyboard) rather than using a separate window. Quite unexpectedly (for me), it gave very good results in terms of usability. The main advantage of this approach is that the input pad doesn’t take the whole screen and therefore you can still see the characters getting input when you click on them. Even though, the input pad is much smaller than before, it doesn’t seem to affect recognition accuracy, which is a very good point. As you can see from the screenshot, you can switch between VKB mode and handwriting mode with the button on the right. You can also switch between Chinese and Japanese with the menu on the left. A positive side-effect of the inclusion in the VKB is that we are sure that the dictionary gets loaded only once.

Attentive readers will have noticed that there is a small bug with fonts. Even though on this screenshot Chinese is selected, Pango (GTK’s text layout engine) picks up a Japanese font for some characters and a Chinese font for some others. This explains why the characters’ font don’t look consistent and the first candidate is displayed as (Japanese) instead of (Chinese). The problem comes from the fact that that those two characters share the same Unicode value so if Pango cannot detect the language from the context, no assumption can be made as to which font will be selected to render the character (see Han unification controversy for more details). To solve this problem, we just have to tell Pango explicitly which language it is.

Apart from inclusion in the VKB, I gave a hand for other parts of the MaemoCJK project. I added scim-anthy support, added a French keyboard layout (had to fix a problem in libfakekey for that) and improved the scim-config UI on small screens, among other things.

In other news, Nokia announced this week that they released their proprietary Hildon IM engine under LGPL. I wonder how this will affect the overall MaemoCJK project.

The Google Summer of Code is now over. I think overall it went really not bad. I reached my objectives which were adding handwriting recognition in MaemoCJK with particular focus on performance and smooth integration. Performance is now quite reasonable and integration is pretty good with inclusion in the VKB. One big regret that I have is that many of my changes to Tomoe have not been merged yet to the upstream project and I think I could have contributed much more to the project if the maintainers had been ready for that. However, I now have a good knowledge of the source base so I’m quite confident that I can help the project in the future. My main interest is in adding handwriting recognition using Hidden Markov Model. And of course, I’ll continue to maintain the handwriting recognition portion of MaemoCJK.

10 Responses to “Handwriting recognition inside the VKB”

  1. Uraka.Lee Says:

    Another congratulations!

    And I wonder that is this new function a module of VBK? I mean if people do not install handwriting, will they still see this screen or have a button between common VBK and handwriting? Or we have 2 different VBK for people who use and do not use handwriting?

  2. pascal Says:

    C’est une super idée la reconnaissance de caractères (chinois pour ma part). D’après ce que je comprends cet OCR est lié au Maemo CJK, est-ce qu’il est possible de le faire fonctionner de façon autonome sur mon N800 (qui possède les fonts chinois simplifié – je ne souhaite pas installer le maemo CJK parce que le clavier de saisie devient qwerty…) ?

  3. Mathieu Says:

    Uraka.Lee > Thanks. I guess we’ll ship handwriting recognition by default. The package is not so big (something like 3MB) so it shouldn’t be a problem.

    Pascal > La nouvelle version (celle en beta-release) permet de passer du clavier par défaut de Nokia au clavier de MaemoCJK sans rédémarrer et sans rien désinstaller. Qui plus est, j’ai ajouté un fichier de configuration pour pouvoir utiliser un clavier français (azerty et accents) dans MaemoCJK. Ce fichier est chargé automatiquement si ton environnement est en français. Donc tu pourras utiliser le clavier virtuel de MaemoCJK ou si tu préfères, tu pourras toujours facilement repasser au clavier par défaut.

  4. pascal Says:

    Merci pour la réponse.

    Dans la version beta, d’après la doc, il semblerait que la reconnaissance de caractère n’est disponible que pour le japonais…

    Autre question : ton application sera t-elle disponible un jour indépendante de Maemo CJK ?

  5. Mathieu Says:

    Pascal > Ce n’est pas tout à fait exact. Elle n’est pour l’instant disponible que pour UIM (qui est pour l’instant la méthode préférée pour écrire en japonais mais qui permet aussi d’écrire en chinois) et n’est pas disponible pour SCIM (qui est la méthode de saisie préférée pour le chinois). Cependant, même si tu installes UIM, la reconnaissance de caractère marchera aussi en chinois car nous n’avons pas décidé de dissocier les données pour le japonais et le chinois. Aussi note que la beta ne sera pas exactement comme le screenshot de mon billet : la zone pour dessiner n’est pas inclue dans le VKB mais utilise une fenêtre séparée.

    Je ne pense pas que l’application sera disponible hors de MaemoCJK car elle utilise des composants dans MaemoCJK. Mais je ne comprends pas pourquoi installer MaemoCJK te gêne vu que comme je te l’ai dit le clavier virtuel fourni par MaemoCJK est automatiquement en français si ton environnement est en français et même si tu n’aimes pas ce clavier, tu peux toujours facilement retourner au clavier par défaut grâce à une icône en haut à droite de l’écran (c’est une nouveauté de la beta). Si tu t’inquiètes un peu d’installer MaemoCJK, mieux vaut peut-être attendre que ce ne soit plus une beta ?

  6. Peter Maydell Says:

    Cool! I’ve just installed the beta version, but I’d like to try the integrated-with-VKB code. Could you possibly give a quick summary of the commands to build it from source? I’ve already installed scratchbox and checked the sources out of subversion.

    Thanks in advance.

  7. Mathieu Says:

    Ok here we are (This is from memory, I’m not using my own computer right now)

    In Scratchbox:

    Install MaemoCJK:

    1) Add “deb http://maemocjk.garage.maemo.org bora test” to /etc/apt/sources.list (this url can be found in the .install file downloadable from the maemocjk site)
    2) fakeroot apt-get update
    3) fakeroot apt-get upgrade
    4) fakeroot apt-get install maemo-japanese-support-n800 libtomoe libtomoe-gtk

    Generate your own package of tomoe-gtk:

    5) cd tomoe-gtk-svn-maemo
    6) ./configure
    7) install *-dev packages that were said to be missing by configure
    8) fakeroot dpkg-buildpackage
    9) cd ..
    10) install the generated .deb package with fakeroot dpkg -i

    Generate your own package of uim-gtk:

    11) cd uim-1.2.1-maemo/
    12) ./configure
    [..., same as above]
    13) install the uim-gtk deb package

    Test on scratchbox:

    14) run uim-toolbar-gtk
    15) open Maemopad and the VKB should show up when you click on the text area
    Note: recognition is slower in scratchbox than on the device

    Test on the device:

    16) scp the two deb packages you’ve generated and install them and restart

  8. pascal Says:

    Après quelques pb d’install et de config, finalement j’ai réussi à mettre maemo cjk avec Tomoe… et je te remercie pour tes infos, entre autre sur la bascule clavier cjk et fr.

    Maintenant je teste la reconnaissance pour le chinois… va falloir que je maîtrise le geste ;-). Je n’ai pas trouvé comment réduire la fenêtre pour obtenir une zone plus pettie de reconnaissance… et à quoi correspond le bouton “best fit” ?

    En tout cas, chapeau !

  9. Mathieu Says:

    Pour l’instant la fenêtre est obligatoirement en plein écran. L’intégration dans le clavier virtuel est dans le dépôt SVN (version de développement), il faudra attendre la prochaine release pour la tester. Le bouton “best fit” adapte le caractère à la taille du carré et permet d’obtenir les meilleures proportions possibles. Il donne parfois de meilleurs résultats. En général, on dessine le caractère, on clique sur “find” et puis si on n’obtient pas le caractère souhaité, on clique sur “best fit”. Il arrive alors que le caractère soit trouvé.

  10. Mulder Says:

    hello, thanks for ur contribution. I went to the website(http://maemocjk.garage.maemo.org/os2006_os2007.html). it seems like just only for N770/N800 with OS2006/os2007, right?
    or I could install it for my N810 w chinese handwriting function? Thank u so much.

Leave a Reply

CAPTCHA Image