On May 18, 10:49 pm, Mathieu Blondel <mblon...@gmail.com> wrote:
> For now, like you said, you can use tegaki-train to build your own
> model.
Could you give me a hint on how to combine the handwriting-ja model
with my hiragana/katakana model so that I don't have to switch between
models anymore? I'm guessing I'd have to use tegaki-convert but I'm
not sure how.
> As far as I know, there has been no work on using a tablet with
> Tegaki. I don't own a tablet myself so I can't help on this. If you
> can program, your help is welcome !
I have implemented a new tegaki UI especially for use with a tablet.
Works with a mouse as well though, I called it tegakiOSD.
You can check it out here via: git clone http://github.com/ulim/tegakiOSD.git
If you like you can integrate it into your project.
I think it's quite useful, maybe I should make a short video as well.
I also added some kanjidic support, i.e. when you commit a character
it shows some info from kanjidic.
Unfortunately, I had to write a small C extension for the tablet
support, it seems the gtk XInput support is not sufficient.
Especially, it seems to be impossible to catch events from an
extension device while the core pointer(=mouse) is not over the
window.
However, for me the whole point is that I can write with the pen
without switching tasks/touching the mouse. Works quite fine with the
extension though.
> Recently, I found myself wanting to write entire sentences with Tegaki
> too and the lack of hiragana was a problem. Another key feature that
> would help with inputting entire sentences would be to not only
> consider the character probabilities individually but also the
> character transition probabilities. I mentioned it in this thread:
For japanese one could easily use the EDICT dictionary in order to
find likely Kanji combinations. It should be something similar as
what's used on mobile phones, i.e. where you get a suggestions after
entering a few characters. Maybe it would be worth checking out that
code, e.g. simeji for Android.
Uli
Essentially you can use tegaki-build to make a new model, you can see
how it is done in the tegaki-models folder. It's pretty much like
this: You create meta file for your model and the you run
"tegaki-build [sources] [engine] [metafile]", and you can use more
than one source, i.e. "tegaki-build -t tomoe-data.xml -a
kanjivg-data.xml zinnia japanese_mix.meta" would make a zinnia model
from both tomoe and kanjivg data (provided you have the files in the
same folder).
You could also try the (zinnia) model I use for
http://rokuhara.japanologie.kultur.uni-tuebingen.de:7777/test.html. It
is based on KanjiVG which contains kana.
>
>> As far as I know, there has been no work on using a tablet with
>> Tegaki. I don't own a tablet myself so I can't help on this. If you
>> can program, your help is welcome !
>
> I have implemented a new tegaki UI especially for use with a tablet.
> Works with a mouse as well though, I called it tegakiOSD.
> You can check it out here via: git clone http://github.com/ulim/tegakiOSD.git
> If you like you can integrate it into your project.
This is a great idea, but it segfaults for me.
--
Roger Braun
http://rbraun.net
roger...@student.uni-tuebingen.de
On Fri, May 28, 2010 at 4:04 AM, ulim <a.sp...@gmail.com> wrote:
> I have implemented a new tegaki UI especially for use with a tablet.
> Works with a mouse as well though, I called it tegakiOSD.
> You can check it out here via: git clone http://github.com/ulim/tegakiOSD.git
> If you like you can integrate it into your project.
> I think it's quite useful, maybe I should make a short video as well.
> I also added some kanjidic support, i.e. when you commit a character
> it shows some info from kanjidic.
> Unfortunately, I had to write a small C extension for the tablet
> support, it seems the gtk XInput support is not sufficient.
> Especially, it seems to be impossible to catch events from an
> extension device while the core pointer(=mouse) is not over the
> window.
> However, for me the whole point is that I can write with the pen
> without switching tasks/touching the mouse. Works quite fine with the
> extension though.
That sounds cool! Since you used OSD, this can become a good
alternative client for Tegaki.
I tried it but I got a segfault too. I attach the output at the end of
my email but tell me if you need more feedback. I'm looking forward to
seeing it working.
>> Recently, I found myself wanting to write entire sentences with Tegaki
>> too and the lack of hiragana was a problem. Another key feature that
>> would help with inputting entire sentences would be to not only
>> consider the character probabilities individually but also the
>> character transition probabilities. I mentioned it in this thread:
>
> For japanese one could easily use the EDICT dictionary in order to
> find likely Kanji combinations. It should be something similar as
> what's used on mobile phones, i.e. where you get a suggestions after
> entering a few characters. Maybe it would be worth checking out that
> code, e.g. simeji for Android.
Yes using a dictionary is another way to do it, although the character
candidates re-ranking is probably less straightforward than if you use
character transition probabilities (bigrams). Using bigrams can also
handle entire sentences while with a dictionary, you'd probably need
to detect word boundaries.
Mathieu
---
$ make gdb
CFLAGS="-Wall -g" python setup.py build
running build
running build_ext
building 'xinputextdev' extension
creating build
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -Wall -g -fPIC -I/usr/include/pygtk-2.0
-I/usr/include/glib-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include
-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/include/atk-1.0
-I/usr/include/python2.6 -c xinputextdev.c -o
build/temp.linux-x86_64-2.6/xinputextdev.o
In file included from /usr/include/gtk-2.0/gtk/gtk.h:233,
from /usr/include/pygtk-2.0/pygtk/pygtk.h:8,
from xinputextdev.c:24:
/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning: function
declaration isn’t a prototype
creating build/lib.linux-x86_64-2.6
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wall -g
build/temp.linux-x86_64-2.6/xinputextdev.o -lgtk-x11-2.0 -lX11 -lXi
-lXtst -o build/lib.linux-x86_64-2.6/xinputextdev.so
PYTHONPATH="build/lib.linux-x86_64-2.6" gdb --args python tegakiosd.py
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/python...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/python tegakiosd.py
[Thread debugging using libthread_db enabled]
Device: Virtual core pointer
Device: Virtual core keyboard
Device: Virtual core XTEST pointer
Device: Virtual core XTEST keyboard
Device: Power Button
Device: Power Button
Device: USB Optical Mouse
Device: Dell Dell USB Entry Keyboard
Device: Macintosh mouse button emulation
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaacd63c4 in pthread_mutex_lock () from /lib/libpthread.so.0
Forgot the backtrace.
Mathieu
(gdb) bt
#0 0x00002aaaaacd63c4 in pthread_mutex_lock () from /lib/libpthread.so.0
#1 0x00002aaaaf9b6e47 in XrmQGetResource () from /usr/lib/libX11.so.6
#2 0x00002aaaaf995a10 in XGetDefault () from /usr/lib/libX11.so.6
#3 0x00002aaaaee25ea3 in ?? () from /usr/lib/libcairo.so.2
#4 0x00002aaaaee26188 in ?? () from /usr/lib/libcairo.so.2
#5 0x00002aaaaee268ec in ?? () from /usr/lib/libcairo.so.2
#6 0x00002aaaaee2701f in cairo_xlib_surface_create () from
/usr/lib/libcairo.so.2
#7 0x00002aaaae04f6da in gdk_window_begin_paint_region () from
/usr/lib/libgdk-x11-2.0.so.0
#8 0x00002aaaadb298bb in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#9 0x00002aaaae0538ea in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#10 0x00002aaaae05037b in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#11 0x00002aaaae0521f1 in gdk_window_process_all_updates () from
/usr/lib/libgdk-x11-2.0.so.0
#12 0x00002aaaae052259 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#13 0x00002aaaae02ed56 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#14 0x00002aaaaca3c8c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#15 0x00002aaaaca40748 in ?? () from /lib/libglib-2.0.so.0
#16 0x00002aaaaca40c55 in g_main_loop_run () from /lib/libglib-2.0.so.0
#17 0x00002aaaadb29af7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#18 0x00002aaaad6d7622 in ?? () from
/usr/lib/pymodules/python2.6/gtk-2.0/gtk/_gtk.so
#19 0x00000000004a7d98 in PyEval_EvalFrameEx ()
#20 0x00000000004a9671 in PyEval_EvalCodeEx ()
#21 0x00000000004a9742 in PyEval_EvalCode ()
#22 0x00000000004c9a0e in PyRun_FileExFlags ()
#23 0x00000000004c9c24 in PyRun_SimpleFileExFlags ()
#24 0x000000000041a7ff in Py_Main ()
#25 0x00002aaaabd8bc4d in __libc_start_main () from /lib/libc.so.6
#26 0x00000000004199f9 in _start ()
> Since the segfault is likely to be in the XInput/Tablet code you can
> also disable that and try just with the mouse first.
> To disable the one-liner patch below should work.
For the record, this works for me when I disable XInput/Tablet with
the patch you provided. (I don't have a tablet so maybe a check must
be done somewhere)
For displaying candidates, I'd rather reserve some space at the bottom
and display candidates there. Currently, it may be a bit difficult to
read since the handwritten character and the candidates sometimes
overlap.
Did you implement some way to show/hide the drawing area already?
A way to switch recognizer would be nice too.
Anyway, thanks for coding this !
Mathieu
gtk 2.20.0
libX11 1.3.2
> To verify this, could you move the single line from my patch down to
> immediately after the XInitThreads() statement? Should it crash again
> I'm fairly certain that's the problem.
Indeed, it crashes there.
>> Did you implement some way to show/hide the drawing area already?
>
> Yes. My tablet emits a "proximity" event when the pen comes near the
> tablet and the code catches that and displays the window. On a
> proximity out event it hides the window after a few seconds(5?). Since
> there is no such thing with a mouse there's currently no way to hide
> the window. An option might be to make the window completely
> transparent and once you move over it with the mouse to show the
> contents.
I'm fine with creating a separate OSD client but what was the reason
for not doing it in tegaki-recognize directly? Can't the drawing area
on the tablet be mapped to correspond to the drawing zone in
tegaki-recognize?
> Oh did you see the kanjidic support? I think it's a nice touch to show
> some details after writing a kanji, currently nr. of strokes/meanings/
> readings/school grade. You just need to have the kanjidic file at the
> DEFAULT_KANJIDIC_PATH in the platforms encoding (e.g. I converted it
> to utf8 with iconv).
Yes but I'm a bit undecided on this. If you follow the UNIX way of
thinking, Tegaki shouldn't do any dictionary functionality.
Conversely, dictionaries shouldn't do any handwriting recognition,
unless they need tight integration. Tegaki should be used through
ibus-tegaki for this.
> Thank you for coding Tegaki! ;-) I'm looking forward to writing all my
> Japanese mail "by hand" from now on.
I think we aren't quite there yet ;-) The current recognizers can be
greatly improved and the character-transition thing will greatly
improve the ease of use. In particular, rather than choosing
characters one at a time, we should be able to write all characters
first, hope that the recognized sentence is correct, if not choose in
a list of candidate sentences and optionally fix individual character
mistakes.
> By the way, I'm thinking about adding some way to save the written
> Characters. That way I could for example give "handwritten" homework
> to my teacher. Also, it might be nice to see some "progress" if one
> looks at the handwriting samples after a month or so. Might also be
> nice to detect frequent mistakes. I guess there is already some code
> to save a Writing object to a file?
You can import/export Character objects in XML. There's also some code
to export Writing objects to images (PNG, PDF, SVG, animated GIF,
etc). There's tegakigdk.renderers in tegaki-pygtk and tegaki-render in
tegaki-tools.
Mathieu
This is not completely related, but I think that you could boost
recognition rates by simple favoring kanji candidates that have right
stroke number. Most of the time I get wrong candidates in the first
slot it is something that looks similar but has different number of
strokes.
Completely unrelated: It would be nice to have an implementation of
the Kanjipad algorithm as an engine for Tegaki.
> This is not completely related, but I think that you could boost
> recognition rates by simple favoring kanji candidates that have right
> stroke number. Most of the time I get wrong candidates in the first
> slot it is something that looks similar but has different number of
> strokes.
In Wagomu, I use a window size: the search is limited to the
characters that have +- n strokes than the input character. You can
change the value in the meta file. In Zinnia, Benoit Cerrina seems to
be working on that lately, with the aim of improving recognition
speed.
> Completely unrelated: It would be nice to have an implementation of
> the Kanjipad algorithm as an engine for Tegaki.
Agreed.
Mathieu
> In fact, I did start out with tegaki-recognize and mapped half of the
> tablet to the left side and the other half to the right side. However,
> when I considered to make some UI adjustments I realized that most of
> the tegaki-recognize code is in fact UI and that there wouldn't be
> much left once I started to make all these changes. In retrospective
> I'd say that's true, the UI couldn't be more different. For instance,
> tegakiOSD is entirely drawn with cairo, no gtk widgets at all.
I would rather map the entire tablet to only one drawing area and find
some way to switch to the other drawing area when the current
character is completed. I was thinking that you could use the
proximity event to hide/show the tegaki-recognize window. But I'm
realizing that the main issue is how to select candidates directly
from the tablet. It will be difficult to select more than one
character at a time.
Does your code works with any tablet?
Mathieu