On 09/06/2013 09:52 PM, Brad Anderson wrote:
hyphenate.js uses a big language lookup table to insert thousands of
­ into all of the words on the entire page so that the browser can
hyphenate the words.  It seems the author has spent a lot of time trying
to make it run fast but it's going to be slow just by the nature of what
it has to do.  A proper hyphenation algorithm is faster because it takes
place during the layout stage so it doesn't need to consider every word
for hyphenation (and also would be written in native code) but that
option isn't available to javascript as far as I know.

The trie compression algorithm is actually quite interesting.
It uses prefix and suffix compression at the same time with some priority system to disambiguate longer matches.
I went and wrote a D library.
http://code.dlang.org/packages/hyphenate
It's not capable of processing HTML but if somebody had an idea how to integrate it in the doc generation we could use it. Otherwise I'm hoping for https://github.com/D-Programming-Language/tools/tree/master/dpl-docs.

Reply via email to