| | import jsonlines |
| |
|
| | |
| | dataset_file = "data/train200.jsonl" |
| |
|
| | |
| | output_file = "data/firstStep_file.jsonl" |
| |
|
| | |
| | try: |
| | with jsonlines.open(dataset_file) as reader, jsonlines.open(output_file, mode='w') as writer: |
| | for obj in reader: |
| | text = obj.get("text") |
| | label = obj.get("accept", [])[0] |
| | if text and label: |
| | writer.write({"text": text, "label": label}) |
| | else: |
| | print("Warning: Text or label missing in the JSON object.") |
| | print("Processing completed. Output written to:", output_file) |
| | except Exception as e: |
| | print("Error:", e) |
| |
|