4 ms·
> Presumably someone could do that if they wanted even faster lookup performance, although I don't need it in this case. I actually wanted to do that. I've bee
by chime 16y ago
> Presumably someone could do that if they wanted even faster lookup performance, although I don't need it in this case.
I actually wanted to do that. I've been following your dictionary posts because I'm doing something similar for an iPad PhoneGap app. I created a dictionary with 600k words & n-grams ( http://ktype.net/wiki/research:articles:progress_20110209 http://ktype.net/wiki/research:articles:progress_20110209 ) and want to make really smart predictions (not just basic spell-check/auto-correct). My raw dictionary is 6MB (too large for localStorage) and I load it from a string into a 1D JS array but it randomly crashes the iPad because of memory issues.
I was going to change my code to use a space-saving trie next week and lo and behold you posted your two posts and saved me a lot of ground work (so thanks for that!). But unlike you, I need to loop through large parts of the dictionary in order to make good predictions. E.g. 'mxm' should suggest 'maximum' and 'gd mrong' should suggest 'good morning'. While one could come up with really complex ways on minimizing the number of word lookups, it is far easier to just cycle through all dictionary words that begin with 'm' and filter for specific letters.
I'm still uncertain what I'll do. Maybe iOS Sqlite DB or iOS CoreData or JS optimized-trie. But once again, thanks for these posts. They've directly helped me.