Zhaoming213 commited on
Commit
cd9daa6
·
verified ·
1 Parent(s): 8714020

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -3
README.md CHANGED
@@ -1,3 +1,23 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ ## 数据集介绍
5
+ 这是百度百科数据集,对原始数据集进行了简单清洗,最终变成了类似:{"text":....}对结构,jsonl文件。
6
+
7
+ ## 清洗代码
8
+ ```
9
+ import json
10
+
11
+ input_file = "百度百科.jsonl"
12
+ output_file = "filtered_data.jsonl"
13
+
14
+ with open(input_file, 'r', encoding='utf-8') as infile, \
15
+ open(output_file, 'w', encoding='utf-8') as outfile:
16
+ for line in infile:
17
+ if not line.strip():
18
+ continue
19
+ try:
20
+ data = json.loads(line)
21
+ outfile.write(json.dumps(data, ensure_ascii=False) + '\n')
22
+ except json.JSONDecodeError:
23
+ continue