def _create(words): trie_load_iterations = 0 numbered_words = [] bytes_words = [] for word in words: numbered_word = '' for letter in phone.safe_word(word): trie_load_iterations+=1 numbered_word += phone.dial[letter] if numbered_word: numbered_words.append(unicode(numbered_word)) bytes_words.append(bytes(word)) return marisa_trie.BytesTrie(zip(numbered_words, bytes_words))
def convert_word_to_numbers(word): return ''.join([number for number in [phone.dial[letter] for letter in phone.safe_word(word)]])