TypeAhead is a continuous predictive text editor that I wrote many years ago. It always tries to help you auto-complete the current word by using words in (a) the current document, as well as (b) a dictionary.
This short video shows a very rough prototype of how this might work:
A few improvements are possible and easy.
Second, the UI could be improved by offering a series of words in a drop-down list. Right now I only guess one word, but having a drop-down UI would let me guess multiple words, like Sublime Text does in certain documents:
Third, TypeAhead could get into grammatical analysis. For instance, it drives me crazy when the auto-complete/spelling feature on my iPhone makes horrible suggestions, or worse yet, changes words I’ve written. If their code would just look at the previous word or two and realize that nobody in the history of mankind has used their word after those words ... sigh ... but I digress.
Hmm, where was I? Oh, yes, if TypeAhead really understood ’context’ well, things could get very interesting, not just completing the current word, but possibly the one after that, and so on. Obviously there are limits to this, but what I’m thinking of here is something in the way that a Google search result shows you not just the current word you’re typing, but the next most common matching words.
This editor currently has a few problems, all related to the fact that I wrote it in just one night, many years ago. The biggest issue is that when you go back to edit text that you’ve already written, it fails miserably. If I keep working on this editor, the first thing I’ll do is add a toggle switch to disable the predictive stuff, letting you enable and disable it as desired.
It also doesn’t let you do normal editor-ish things like opening and saving files, but those are very low on my priority list. I pretty much just want a tool that I can fire up to write blog posts like this one that will help reduce my typing significantly, so I have no plans to add features like those. The TypeAhead editor component (
LookAheadTextPane) extends a Java JTextPane, so you can always plug it into your own Java editor and add those features, as desired.
The source code
I actually wrote this code a long time ago, cranking almost all of it out in one evening. Of course that means the code is crap, lol, but at least it offers a glimpse into what can be done, and how to do it, at least in Java.
I recently took a little time to package that old code into an SBT project so you can easily build it, and you can find the code here:
Feel free to do with it what you’d like, just try not to laugh too hard at the code. :)
P.S. - You can also use the shell scripts included in the project to build TypeAhead into a Mac OS X application.