forked from InsaneLife/dssm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
39 lines (32 loc) · 996 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# encoding=utf-8
def load_vocab(file_path):
word_dict = {}
with open(file_path, encoding='utf8') as f:
for idx, word in enumerate(f.readlines()):
word = word.strip()
word_dict[word] = idx
return word_dict
class Config(object):
def __init__(self):
self.vocab_map = load_vocab(self.vocab_path)
self.nwords = len(self.vocab_map)
unk = '[UNK]'
pad = '[PAD]'
vocab_path = './data/vocab.txt'
file_train = './data/oppo_round1_train_20180929.mini'
# file_train = './data/oppo_round1_train_20180929.txt'
file_vali = './data/oppo_round1_vali_20180929.mini'
# file_vali = './data/oppo_round1_vali_20180929.txt'
max_seq_len = 10
hidden_size_rnn = 100
use_stack_rnn = False
learning_rate = 0.001
# max_steps = 8000
num_epoch = 50
summaries_dir = './Summaries/'
gpu = 0
if __name__ == '__main__':
conf = Config()
print(len(conf.vocab_map))
pass