(path: str)
| 47 | |
| 48 | @staticmethod |
| 49 | def load(path: str): |
| 50 | path = get_data_path(path, local_mode=True) |
| 51 | with open(path, 'r', errors='ignore') as in_f: |
| 52 | rows = [] |
| 53 | for line in in_f: |
| 54 | sample = json.loads(line.strip()) |
| 55 | text = sample['passage']['text'] |
| 56 | for question_dict in sample['passage']['questions']: |
| 57 | question = question_dict['question'] |
| 58 | answers = question_dict['answers'] |
| 59 | for answer in answers: |
| 60 | rows.append({ |
| 61 | 'text': text, |
| 62 | 'question': question, |
| 63 | 'answer': answer['text'], |
| 64 | 'label': 'BA'[answer['label']] |
| 65 | }) |
| 66 | return Dataset.from_list(rows) |
nothing calls this directly
no test coverage detected