View Single Post
Old 11-24-2018, 08:16 AM   #45
Hopkins
Enthusiast
Hopkins began at the beginning.
 
Posts: 42
Karma: 10
Join Date: Jun 2016
Location: Minnesota USA
Device: Amazon Paperwhite 3G
Version 2.3.2 Improve conversion speed

Version 2.3.2 24 Nov 2018
Improved conversion speed by approximately 25%
Default to convert entire book for first time installation of the plugin
Minor change to traditional->simplified phrases dictionary

Details for those who are interested:
The code selects conversion look-up tables based on the user settings. It then splits the book text into sentence fragments at each punctuation mark. Each sentence fragment is scanned with an ever smaller window looking for a match in the table. When a match is found, the matching text is replaced and the operation repeated recursively on the unmatched portions of the sentence fragment.

The old code set the initial scanning window to the full length of the sentence fragment. The new code sets the initial scanning window to the smaller of the longest table entry or the sentence fragment length. This modification eliminated a lot of useless scans at the expense of adding one comparison statement.

As always, see the Github page for implementation details.
Hopkins is offline   Reply With Quote