Showing posts with label Mobile. Show all posts
Showing posts with label Mobile. Show all posts

Thursday, October 18, 2012

Implement Mobile T9 using TRIE


T9's objective is to make it easier to type text messages. It allows words to be entered by a single keypress for each letter. T9's objective is to make it easier to type text messages. It allows words to be entered by a single keypress for each letter.  For instance, in English, 4663 matches "good", "home", "gone", "hood", etc. 

This program takes in a dictionary file as input, reads it and creates a Ternary Search Trie (TST). Once the Trie is created, any word can be searched. The matching words for a given sequence are stored in ascending order (instead of word ranking). This code can be modified to accomplish word ranking and machine learning. 

The above code can be implemented with HashMap. However hashing does not provide efficient searching. 
For the purpose of benchmarking, I have enabled the runtime stats in this class. I have tested with 3 types of dictionaries. The biggest dictionary I could get hold off was containing 3.7 million words. The program currently accepts only alphabets. 

Solution



UA-36403895-1