Load the tables
()
| 73 | |
| 74 | |
| 75 | def load_tables(): |
| 76 | """ |
| 77 | Load the tables |
| 78 | """ |
| 79 | words = [] |
| 80 | utable = numpy.load(path_to_tables + 'utable.npy') |
| 81 | btable = numpy.load(path_to_tables + 'btable.npy') |
| 82 | f = open(path_to_tables + 'dictionary.txt', 'rb') |
| 83 | for line in f: |
| 84 | words.append(line.decode('utf-8').strip()) |
| 85 | f.close() |
| 86 | utable = OrderedDict(zip(words, utable)) |
| 87 | btable = OrderedDict(zip(words, btable)) |
| 88 | return utable, btable |
| 89 | |
| 90 | |
| 91 | def encode(model, X, use_norm=True, verbose=True, batch_size=128, use_eos=False): |