Update WikiConvert.py
Browse files- WikiConvert.py +15 -11
WikiConvert.py
CHANGED
|
@@ -113,14 +113,18 @@ class WikiConvert(datasets.GeneratorBasedBuilder):
|
|
| 113 |
logger.info("generating examples from = %s", filepath)
|
| 114 |
key = 0
|
| 115 |
with open(filepath, encoding="utf-8") as f:
|
| 116 |
-
ds = json.load(f)
|
| 117 |
-
for row in
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
logger.info("generating examples from = %s", filepath)
|
| 114 |
key = 0
|
| 115 |
with open(filepath, encoding="utf-8") as f:
|
| 116 |
+
#ds = json.load(f)
|
| 117 |
+
for row in f:
|
| 118 |
+
print(row[:100])
|
| 119 |
+
ds = json.loads(row)
|
| 120 |
+
print(len(ds))
|
| 121 |
+
for row in ds:
|
| 122 |
+
yield key, {
|
| 123 |
+
"id": row["id"],
|
| 124 |
+
"offset": row["offset"],
|
| 125 |
+
"length": row["length"],
|
| 126 |
+
"magnitude": row["magnitude"],
|
| 127 |
+
"comment": row["comment"],
|
| 128 |
+
"number": row["number"],
|
| 129 |
+
}
|
| 130 |
+
key += 1
|