===
Lesson 2
=> combine what you've learned about data types to build a predictive text algorithm.This exercise comes in three levels of difficulty. Everyone should aim to complete the first function - parse_content. It's worthwhile to attempt the make_tree function. Lastly, the predict function is the hardest and most complex, but the most rewarding. Finishing the predict function is evidence that you solidly understand the contents of this lesson.
parse_content
: simply read raw txt file and parse every word to it's t9 frequency.make_trie
: Trie is a very useful data structure. It is commonly used to represent a dictionary for looking up words in a vocabulary. To implement such a function, we need several things at the backend. The first, obviously, is a list of common queries. Or it can be a list of proper English words for the purpose of auto-completion). Secondly, we will need to have an algorithm to quickly look up words starting with the characters input by the user, and this is where we need to use the trie data structure.predict
:
New Terms In This Lesson Term Definition