mapping a dictionary to a trie for optimal search