Update TimeTravel.py
Browse files- TimeTravel.py +11 -9
TimeTravel.py
CHANGED
@@ -153,13 +153,15 @@ class TimeTravel(datasets.GeneratorBasedBuilder):
|
|
153 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
154 |
with open(filepath, encoding="utf-8") as f:
|
155 |
for key, row in enumerate(f):
|
156 |
-
|
157 |
data = json.loads(row)
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
153 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
154 |
with open(filepath, encoding="utf-8") as f:
|
155 |
for key, row in enumerate(f):
|
156 |
+
try:
|
157 |
data = json.loads(row)
|
158 |
+
except:
|
159 |
+
print(row)
|
160 |
+
yield key, {
|
161 |
+
"story_id": data["story_id"],
|
162 |
+
"premise": data["premise"],
|
163 |
+
"initial": data["initial"],
|
164 |
+
"counterfactual": data["counterfactual"],
|
165 |
+
"original_ending": data["original_ending"],
|
166 |
+
"edited_ending": data["edited_ending"],
|
167 |
+
}
|