recast task definition
@@ -1168,3 +1168,25 @@ class VAETask(SequenceGenerationTask):
'''Get metrics specific to the task'''
ppl = self.scorer1.get_metric(reset)
return {'perplexity': ppl}
+
+class RecastNLITask(PairClassificationTask):
+ ''' Task class for NLI Recast Data'''
+
+ def __init__(self, path, max_seq_len, name="recast"):
+ super(RecastNLITask, self).__init__(name, 2)
+ self.load_data(path, max_seq_len)
+ self.sentences = self.train_data_text[0] + self.train_data_text[1] + \
+ self.val_data_text[0] + self.val_data_text[1]
+
+ def load_data(self, path, max_seq_len):
+ tr_data = load_tsv(os.path.join(path, 'train.tsv'), max_seq_len,
+ s1_idx=1, s2_idx=2, targ_idx=None, targ_map=targ_map, skip_rows=0)
+ val_data = load_tsv(os.path.join(path, 'dev.tsv'), max_seq_len,
+ s1_idx=0, s2_idx=1, targ_idx=2, targ_map=targ_map, skip_rows=0)
+ te_data = load_tsv(os.path.join(path, 'test.tsv'), max_seq_len,
+ s1_idx=1, s2_idx=2, targ_idx=None, targ_map=targ_map, skip_rows=0)
+
+ self.train_data_text = tr_data
+ self.val_data_text = val_data
+ self.test_data_text = te_data
+ log.info("\tFinished loading recast probing data.")
