(self, data_id)
| 13 | self.text_key = text_key |
| 14 | |
| 15 | def __getitem__(self, data_id): |
| 16 | data = self.data_list[data_id] |
| 17 | text = data[self.text_key] |
| 18 | if isinstance(text, list): |
| 19 | text = text[0] |
| 20 | if 'sample_id' in data: |
| 21 | sample_id = data['sample_id'] |
| 22 | elif 'test_sample_id' in data: |
| 23 | sample_id = str(data['test_sample_id']) |
| 24 | elif 'global_id' in data: |
| 25 | sample_id = str(data['global_id']) |
| 26 | else: |
| 27 | raise ValueError("No sample_id or test_sample_id found in the data.") |
| 28 | |
| 29 | data_dict = {"text": text, "sample_id": sample_id} |
| 30 | |
| 31 | return data_dict |
| 32 | |
| 33 | def __len__(self): |
| 34 | return len(self.data_list) |
nothing calls this directly
no outgoing calls
no test coverage detected