in data.py [0:0]
def load_dialog(self):
"""
Load dialogs
Load all true and corrupt dialogs here
:return:
"""
# if os.path.exists(self.args.data_loc) and os.path.isfile(self.args.data_loc):
# self.logbook.write_message_logs("Loading dialogs from {}".format(self.args.data_loc))
# data_dump = pkl.load(open(self.args.data_loc,'rb'))
# self.dialogs = data_dump['raw']
# self.train_indices = data_dump['train_indices']
# self.test_indices = data_dump['test_indices']
# self.logbook.write_message_logs("Loaded {} dialogs".format(len(self.dialogs)))
# else:
# self.logbook.write_message_logs("Extracting dialogs")
# self.extract_dialogs()
# self.logbook.write_message_logs("Extracted {} dialogs".format(len(self.dialogs)))
# self.split_train_test()
# self.save_dialog()
for fs in fixed_suffixes:
file_path = os.path.join(
self.args.data_loc,
"{}_{}_{}.csv".format(self.args.data_name, self.args.mode, fs),
)
if os.path.exists(file_path) and os.path.isfile(file_path):
self.dialogs[fs] = pd.read_csv(file_path)
else:
raise FileNotFoundError("file {} not found".format(file_path))
ep_id = 0
found = True
while found:
for fs in variable_suffixes:
new_fs = "{}_{}".format(fs, ep_id)
file_path = os.path.join(
self.args.data_loc,
"{}_{}_{}.csv".format(self.args.data_name, self.args.mode, new_fs),
)
if os.path.exists(file_path) and os.path.isfile(file_path):
self.dialogs[new_fs] = pd.read_csv(file_path)
else:
found = False
break
ep_id += 1
self.check_nans()
print("all dialog files loaded for mode {}".format(self.args.mode))