-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
72 lines (59 loc) · 1.26 KB
/
constants.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import torch
from torch.autograd import Variable
import numpy as np
#
# Tokenizing constants
#
SOS_INDEX = 0
EOS_INDEX = 1
UNK_INDEX = 2
BRK_INDEX = 3
PAD_INDEX = 4
ELP_INDEX = 5
NL_INDEX = 6
UNK = "<unk>"
BRK = "<brk>"
EOS = "<eos>"
SOS = "<sos>"
PAD = "<pad>"
ELP = "<elp>"
NL = "<nl>"
RST = "<rst>"
END = "<end>"
PAIR = "<p>"
PUNCTUATION=",.?!;:"
TOKENS = {r'\.\.\.': ' '+ELP+' '}
RESERVED_I2W = {SOS_INDEX: SOS, EOS_INDEX: EOS, UNK_INDEX: UNK, BRK_INDEX: BRK,
PAD_INDEX: PAD, ELP_INDEX: ELP, NL_INDEX: NL}
RESERVED_W2I = dict((v,k) for k,v in RESERVED_I2W.items())
RMV_TOKENS = [EOS, SOS]
#
# I/O Constants
#
TEMP_DIR = "current_model/"
DATA_DIR = "data/"
MODEL_DIR = "trained_models/"
ENC_FILE = "enc.pt"
DEC_FILE = "dec.pt"
MEM_FILE = "mem.pt"
I2W_FILE = "i2w.dict"
W2I_FILE = "w2i.dict"
U_I2W_FILE = "unk_i2w.dict"
U_W2I_FILE = "unk_w2i.dict"
INF_FILE = "info.dat"
TRAIN_INF_FILE = "train_info.dat"
FIG_FILE = "losses.png"
LOSS_FILE = "losses.dat"
SCORE_FILE = "scores.dat"
LOG_FILE = "log.txt"
DATA_FILE = "conv_cornell.txt"
DICTS_FILE = "vocab.tar"
TRAIN_FILE = "train.dat"
VAL_FILE = "val.dat"
TEST_FILE = "test.dat"
#
# Model Constants
#
USE_CUDA = torch.cuda.is_available()
MAX_SENTENCE_LENGTH = 10
MAX_SEQUENCE_LENGTH = MAX_SENTENCE_LENGTH + 2