SwiftKey and other keyboards should understand grammar and correct spellings based on that. They do some kind of Markov chain thing currently but they should take it more in the direction of natural language analysis and eliminate words that couldn't possibly occur at that point in the sentence.