tiendung commited on
Commit
521bfaa
1 Parent(s): 0a192cf

Add 100k_sampling.py

Browse files
Files changed (1) hide show
  1. 100k_sampling.py +13 -0
100k_sampling.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import glob, sys, gzip, random, json
2
+
3
+ for file in glob.glob("*.jsonl.gz"):
4
+ with gzip.open(file, "rt") as fin:
5
+ count = 0
6
+ for line in fin:
7
+ if random.randint(0, 90) < 3:
8
+ count += 1
9
+ text = json.loads(line)["content"]
10
+ ss = json.dumps({ "text" : text }, ensure_ascii = False)
11
+ print(ss)
12
+ if count == 1100: break
13
+