I'm guessing it precomputes a tree for the dictionary. With each stroke, it drills down the tree along the most likely path. If it runs out of nodes, it backtracks and tries a more likely path somewhere,possibly using a precomputed list of vectors most likely to be mistaken for each other.
That gives On for the best case.
I'd think that they try to calculate the focus of each direction change and see what letter it landed on, then try a fuzzy match to words that have the smallest hamming distance between their input. After you get a good approximation of all the letters, then you can try hashing techniques.
Also, pivoting on first and last letter of each word isn't fool-proof, as the first and last letters are also not guaranteed to be hit dead-on.
The best I can come up (after not so much thinking about it) with is using Bloom Filters. Precompute the bit vector for every word in your dictionary, then after they swype, compute a vector for the string of characters and run it up against all the words in your dictionary that start and end with the same letters. Still kind of an expensive linear search, albeit fast (since it's just boolean AND).