[docs]classRTEDataset(AbstractTEDataset):def__init__(self,split_set:str)->None:super().__init__()try:ifsplit_setnotinSPLIT_SETS_TRAIN_VAL:raiseSplitSetError(SPLIT_SETS_TRAIN_VAL)ifnotos.path.exists(RTE_DATASET_FOLDER):download_dataset(RTE_DATASET_ZIP_URL,RTE_DATASET)self.split_set=split_setself.dataset_path=f"{RTE_DATASET_FOLDER}/{self.split_set}.csv"self.premises,self.hypotheses,self.labels=self.__read_dataset("sentence1","sentence2","label")exceptSplitSetErroraserr:print(err.message)def__read_dataset(self,premises_key:str,hypotheses_key:str,labels_key:str)->Tuple[List[str],List[str],List[int]]:data=pd.read_csv(self.dataset_path)premises_list=[]hypotheses_list=[]labels_list=[]forpremise,hypothesis,labelinzip(data[premises_key].tolist(),data[hypotheses_key].tolist(),data[labels_key].tolist(),):premises_list.append(str(premise))hypotheses_list.append(str(hypothesis))labels_list.append(label)returnpremises_list,hypotheses_list,labels_listdef__getitem__(self,index:int)->Tuple[str,str,int]:returnself.premises[index],self.hypotheses[index],self.labels[index]def__str__(self)->str:returnf"The {self.split_set} set of RTE has {self.__len__()} instances"def__len__(self)->int:returnlen(self.premises)