(file_path)
| 46 | |
| 47 | |
| 48 | def process_jsonl(file_path): |
| 49 | new_data = [] |
| 50 | with open(file_path, 'r', encoding='utf-8') as file: |
| 51 | for line in file: |
| 52 | json_data = json.loads(line) |
| 53 | new_dict = { |
| 54 | 'question': json_data['question'], |
| 55 | 'capability': json_data['category'], |
| 56 | 'others': { |
| 57 | 'subcategory': json_data['subcategory'], |
| 58 | 'reference': json_data['reference'], |
| 59 | 'question_id': json_data['question_id'] |
| 60 | } |
| 61 | } |
| 62 | new_data.append(new_dict) |
| 63 | return new_data |
| 64 | |
| 65 | |
| 66 | def save_as_json(data, output_file='./alignment_bench.json'): |
no test coverage detected