| 8 | |
| 9 | |
| 10 | def _parse(item): |
| 11 | item['start'] = chr(65) |
| 12 | item['end'] = chr(65 + len(item.get('options', [])) - 1) |
| 13 | new_options = [] |
| 14 | choices = '' |
| 15 | for i in range(len(item['options'])): |
| 16 | new_options.append(item['options'][i].split(': ')[-1]) |
| 17 | choices += chr(65 + |
| 18 | i) + '. ' + item['options'][i].split(': ')[-1] + '\n' |
| 19 | item['question'] = (f'\nQuestion: {item["question"]}\n' |
| 20 | f'Answer Choices: \n{choices}') |
| 21 | item['options'] = new_options |
| 22 | item['label'] = chr(65 + int(item['answer'].split(' ')[-1]) - |
| 23 | 1) # Index from 1 in answer |
| 24 | return item |
| 25 | |
| 26 | |
| 27 | @LOAD_DATASET.register_module() |