Stern5497 commited on
Commit
b0976d9
·
1 Parent(s): 4c1f949

Update qrel.py

Browse files
Files changed (1) hide show
  1. qrel.py +4 -19
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
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
73
- line_counter = 0
74
- try:
75
- with xz.open(open(filepath, "rb"), "rt", encoding="utf-8") as f:
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