Update qrel.py
Browse files
qrel.py
CHANGED
|
@@ -69,22 +69,7 @@ class Qrel(datasets.GeneratorBasedBuilder):
|
|
| 69 |
|
| 70 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 71 |
def _generate_examples(self, filepath, split):
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
for id, line in enumerate(f):
|
| 77 |
-
line_counter += 1
|
| 78 |
-
if line:
|
| 79 |
-
data = json.loads(line)
|
| 80 |
-
if self.config.name == "full":
|
| 81 |
-
yield id, {
|
| 82 |
-
"id": data["id"],
|
| 83 |
-
"corp_id": data["corp_id"],
|
| 84 |
-
"match": data["match"],
|
| 85 |
-
"language": data["language"]
|
| 86 |
-
}
|
| 87 |
-
except lzma.LZMAError as e:
|
| 88 |
-
print(split, e)
|
| 89 |
-
if line_counter == 0:
|
| 90 |
-
raise e
|
|
|
|
| 69 |
|
| 70 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 71 |
def _generate_examples(self, filepath, split):
|
| 72 |
+
with open(filepath, encoding="utf-8") as f:
|
| 73 |
+
for id_, row in enumerate(f):
|
| 74 |
+
data = json.loads(row)
|
| 75 |
+
yield id_, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|