Update proof-pile-2.py
#14
by
Jyantkumar
- opened
- proof-pile-2.py +9 -0
proof-pile-2.py
CHANGED
|
@@ -197,3 +197,12 @@ class ProofPile2(datasets.GeneratorBasedBuilder):
|
|
| 197 |
instance["meta"] = dict()
|
| 198 |
yield key, {"text": instance["text"], "meta": json.dumps(instance["meta"])}
|
| 199 |
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
instance["meta"] = dict()
|
| 198 |
yield key, {"text": instance["text"], "meta": json.dumps(instance["meta"])}
|
| 199 |
key += 1
|
| 200 |
+
except:
|
| 201 |
+
with open(name, "r", encoding="utf-8") as f:
|
| 202 |
+
for x in f.readlines():
|
| 203 |
+
instance = json.loads(x)
|
| 204 |
+
if instance:
|
| 205 |
+
if "meta" not in instance:
|
| 206 |
+
instance["meta"] = dict()
|
| 207 |
+
yield key, {"text": instance["text"], "meta": json.dumps(instance["meta"])}
|
| 208 |
+
key += 1
|