def prepare_data(self, type=None): # get dialogs from file if type == 'Train': dialogs, dialog_indices = util.read_dialogs( with_indices=True, file_name= '/root/jude/data/dialog-bAbI-tasks/dialog-babi-task6-dstc2-trn.txt', babi_num=6) elif type == 'Test': dialogs, dialog_indices = util.read_dialogs( with_indices=True, file_name= '/root/jude/data/dialog-bAbI-tasks/dialog-babi-task6-dstc2-tst.txt', babi_num=6) # get utterances utterances = util.get_utterances(dialogs) # get responses responses = util.get_responses(dialogs) responses = [self.get_template_id(response) for response in responses] trainset = [] for u, r in zip(utterances, responses): trainset.append((u, r)) return trainset, dialog_indices
def prepare_data(self): # get dialogs from file dialogs, dialog_indices = util.read_dialogs(with_indices=True) # get utterances utterances = util.get_utterances(dialogs) # get responses responses_id = util.get_responses() trainset = [] for u, r in zip(utterances, responses_id): trainset.append((u, int(r)-1)) return trainset, dialog_indices # [(utterance_1, action_template_id_1),..] [{'start':0, 'end':20},...]
def prepare_data(self): # get dialogs from file dialogs, dialog_indices = util.read_dialogs(with_indices=True) # get utterances utterances = util.get_utterances(dialogs) # get responses responses = util.get_responses(dialogs) responses = [self.get_template_id(response) for response in responses] trainset = [] for u, r in zip(utterances, responses): trainset.append((u, r)) return trainset, dialog_indices