Word Prediction Implemented using Trie

I know i talked about use of Ternary Search Tree TST earlier and TST is probably more efficient but i couldn’t the most comprehensive TST implementation could only return user specific matches based on length.

if you entered hi, it would return hi
if you entered hi*, you will get his, him etc.
if you entered hi**, you will get high, hind etc.

TST however had a simple contains for preliminary match.

This meant that i will need to run it multiple number of times to get overall matches and then sort it based on relevance. Too many calls equals eventually slower plus knowing keeping constant tab max word length and keep padding wildcards.

so I have settled on Trie, which allows individual char entries and provides option to see if its a full match (similar to contains) and gives you all matches in a single list. Sorting takes care of relevance and it works perfectly.

Thank goodness… One user complained about match list being a bit iffy, i am going to make each item have larger area which would allow more touch area !!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s