Commit ·
1cd73a5
1
Parent(s): b30b958
Update mse.py
Browse files
mse.py
CHANGED
|
@@ -111,7 +111,10 @@ class StackExchange(datasets.GeneratorBasedBuilder):
|
|
| 111 |
|
| 112 |
with open(filepath, encoding="utf-8") as f:
|
| 113 |
dctx = zstandard.ZstdDecompressor()
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
with open(filepath, encoding="utf-8") as f:
|
| 113 |
dctx = zstandard.ZstdDecompressor()
|
| 114 |
+
i = 0
|
| 115 |
+
with dctx.stream_reader(f) as st:
|
| 116 |
+
with io.TextIOWrapper(st) as text_st:
|
| 117 |
+
while (line:=text_st.readline()) != '':
|
| 118 |
+
data = json.loads(line)
|
| 119 |
+
yield i, data
|
| 120 |
+
i += 1
|