View Single Post
Old 02-02-2020, 04:25 PM   #37
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 2,808
Karma: 7423683
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
Kobo prefix logic

Here's all the logic used to generate the prefixes. I've tested it against libnickel, and it's also based on the disassembly of DictionaryParser::htmlForWord (it was slightly annoying that most of the Qt stuff was inlined). I've simplified it and improved the performance, and also left in the original code for reference.

I'll write some proper documentation and make a thread when I finish dictutil later.

Here is the code: https://sourcegraph.com/github.com/g...util.go#L30-86

v1/v2 dictionary stuff

And here are some useful notes about v1/v2 dictionaries (this hasn't ever been discussed, or even noticed before AFAIK): https://pgaskin.net/dictutil/dicthtml/v1v2

Last edited by geek1011; 02-02-2020 at 11:03 PM. Reason: added header
geek1011 is offline   Reply With Quote