Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data structure behind T9 type of dictionary

How does a T9 dictionary work? What is the data structure behind it. If we type '4663' we get 'good' when we press down button we get 'gone' then 'home' etc...

EDIT: If the user types in 46 then it should show 'go' and when pressed down arrow should show 'gone' etc...

like image 678
anony Avatar asked Apr 04 '10 09:04

anony


People also ask

Which data structure is used for dictionary?

If you want to use the dictionary for operations like spell-checking where you need to find words similar to other words, the BK-tree is an excellent data structure to consider. Hope this helps!

What is T9 dictionary?

T9 is a predictive text technology for mobile phones (specifically those that contain a 3×4 numeric keypad), originally developed by Tegic Communications, now part of Nuance Communications. T9 stands for Text on 9 keys.


Video Answer


3 Answers

It can be implemented in several ways, one of them is Trie. The route is represented by the digits and the nodes point to collection of words.

It can be implemented using nested hash tables as well, the key of the hash table is a letter and on every digit the algorithm calculates all possible routes (O(3^n) routes).

like image 185
Elisha Avatar answered Oct 16 '22 08:10

Elisha


4663

translates to

{G,H,I}{M,N,O}{M,N,O}{D,E,F}

T9 works by filtering the possibilities down sequentially starting with the first possible letters. So the first step in your example will be to filter the dictionary list to all words beginning with G, H, or I. Next step, take that list and filter the second letters by M, N, O. And so on...

like image 30
David Johnson Avatar answered Oct 16 '22 09:10

David Johnson


I guess, as those before that T9 uses a trie, where the links are represented by a bitmap (1 bit per letter). This is called a succinct data structure, as Steve Hanov explains very nicely:

http://stevehanov.ca/blog/index.php?id=120

like image 5
Daniel Oderbolz Avatar answered Oct 16 '22 09:10

Daniel Oderbolz