ds300 / jetzt

Speed reader extension for chrome
Other
485 stars 124 forks source link

Use hyphenization algorithm. #150

Open flowchartsman opened 8 years ago

flowchartsman commented 8 years ago

Pursuant to the discussion in #149, I have started work on incorporating Hypher into jetzt. I've made an initial checkin on my dev branch that seems to work pretty well, but it's currently hard-coded for en-us. Should I support any other languages, or should I just push on with this as-is, making sure I fall back to the default behavior in case of other languages?

ds300 commented 8 years ago

I don't mind as as long as language detection involves looking at the text. :+1:

flowchartsman commented 8 years ago

Current version is up and communicates with the background page to make a call to the chrome.tabs API to detect language. It then uses this to look up the patterns based on their ID. Having said that, I'm still having a couple errors that I could use the help of someone more experienced in extension design to help error out.

One is Attempting to use a disconnected port object showing up in the background page. The other is No tab with id: <some number>. One or both of them may be related to my choice to stick the hyphenator initialization at the top level of the parse module. Not sure. Would someone mind taking a look?

After these two are ironed out, the only thing left to do is import more language patterns from https://github.com/bramstein/hyphenation-patterns, and hashify them into a lookup table so that it's not doing O(n^2) lookups through the language IDs.

ds300 commented 8 years ago

Sorry I don't know what either of those errors are about. I'm not really a chrome extension guy either. I also don't really have the time to go debugging for you at the moment, but you have my best wishes!

flowchartsman commented 8 years ago

Righto. I'll ask around and, when I'm satisfied, I'll issue a pull request.

sergeevabc commented 7 years ago

In case hyphenation is implemented, make sure to add an option to turn it off as there are ppl like me who are not thrilled with the idea of inwardly gluing pieces of words divided by dashes when there is enough space on the screen to present the whole word and it takes less focus to grasp it.