Bug 858158 (final) - [keyboard] document prediction algorithm and make it tuneable