import json
import random
# 读取 JSON 文件
with open('devtest1.0.json', 'r', encoding='utf-8') as file:
data = json.load(file)
# 打乱文本数据
random.shuffle(data)
# 保存成新的 JSON 文件
with open('shuffled_dev.json', 'w', encoding='utf-8') as file:
json.dump(data, file, ensure_ascii=False)
文本数据集随机打乱
最新推荐文章于 2024-06-13 02:48:16 发布