[liblouis-liblouisxml] Hyphenation, I think I have got it, but may have found more bugs

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 09 Jun 2009 11:54:55 +0100

Hello,
After looking at the liblouisxml code a bit more and a bit of thinking I believe I now have worked out the hyphenation problems I was having, it seems to work both for mode=0 and mode=1 now. When I say working, it gives what seems sensible although possibly at times I might personally add another potential hyphenation point if I were doing it manually. My work containing this working code has been committed to mercurial on http://bitbucket.org/mwhapples/jlouis should anyone wish to look at it.

Unfortunately I think I have found a few more bugs (I suppose this is what comes of trying to create full bindings for a library).

The first is that when I use mode=1 sometimes my application (Test.java) was crashing with a load of glib errors and messages I didn't understand. The other time I had come across these sorts of errors was when I passed the wrong size arrays to liblouis in some of the other function calls. So I guessed that may be it was something to do with the difference in size of the translated text I passed in and the back translated text lou_hyphenate would create to perform the hyphenation, and sure enough when I set the array size of hyphens to twice the size of inlen, all these errors have gone away. The docs say that hyphens should be of size inlen.

Secondly I previously reported getting values other than '0' and '1' in hyphens, I believe these may be occurring around contractions and only seems to happen for mode=1. Could this be due to the values in each byte for the back translated hyphens being combined (eg. added together) when translation is done back for the calling app? If this is the case may be that's why sometimes I would personally find one more potential hyphenation point than liblouis.

Michael Whapples
For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: