This is an implementation of a Prediction by Partial Matching (PPM) language model in Swift. This is implemented as a command-line MacOS application, but in principle the underlying classes should work elsewhere.
This was based closely on the JavaScript implemenation by Google: JSLM.