Last time I blogged about the project (which was quite a long back ago), I was able to build only an in-memory dictionary. This dictionary will get wiped out as soon as the device was turned off, or the keyboard process was shut down. The timeout was a full 30s but it is way too small in real usage examples.
This is where indexedDB comes to the rescue. The HTML5 specification, along with many other great additions, now allows support for a script to write to disk with the help of indexedDB API. It was possible to have some data cached earlier too using localStorage, but that was a mess. It was a synchronous read/write operation, blocked the UI, and gave a limited amount of (usable) space. With indexedDB, the storage space has no bounds, at least not with Gecko, and since the API calls are asynchronous, the whole thing just works flawlessly. Gecko uses a SQLite engine to store indexedDB data.
0. The changes committed:
The full commit is here: gargsms/gaia - GitHub. A new commit is on the way with some minor changes.
Major changes from last commit:
- modified the word insertion criteria - now adding a word at suggestion dismiss, auto-correct revert, or a punctuation at the end of a word if there are no suggestions,
- prevent insertion of random stuff - things like #!@$ don't get added to the dictionary now, numbers do (will need to think about that).
1. Roadmap ahead:
- Import of Contacts - using contacts API,
- generation of a dynamic TST to feed to prediction algorithm
For the time being, I am trying to decipher the current binary dictionaries. If the generation of these dictionaries becomes clear, we can derive new methods to update them on the fly, thereby removing the need to consider a new data structure totally. Till then, a new tree needs to be generated for the indexedDB.
-- An addon came very helpful for the purpose of viewing the SQLite database. There are limited number of tools available to operate on SQLite databases, but this addons kicks everything out of the water. A must try thing.