Update chess_ground-targz.py
Browse files- chess_ground-targz.py +7 -9
chess_ground-targz.py
CHANGED
@@ -52,13 +52,11 @@ class ChessGroundTargz(datasets.GeneratorBasedBuilder):
|
|
52 |
|
53 |
def _generate_examples(self, filepath):
|
54 |
idx = 0
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
except json.JSONDecodeError:
|
63 |
-
raise ValueError(f"File {filepath} is not a valid JSONL file.")
|
64 |
|
|
|
52 |
|
53 |
def _generate_examples(self, filepath):
|
54 |
idx = 0
|
55 |
+
# open the file and read the lines
|
56 |
+
with open(filepath, encoding="utf-8") as fp:
|
57 |
+
for line in fp:
|
58 |
+
# load json line
|
59 |
+
obj = json.loads(line)
|
60 |
+
yield idx, obj
|
61 |
+
idx += 1
|
|
|
|
|
62 |
|