Xinyu Crystina ZHANG commited on
Commit
0a9bdc2
1 Parent(s): 3506bca

bugfix: duplicate Key when loading combined

Browse files
Files changed (1) hide show
  1. mr-tydi.py +3 -1
mr-tydi.py CHANGED
@@ -132,11 +132,13 @@ class MrTyDi(datasets.GeneratorBasedBuilder):
132
  return splits
133
 
134
  def _generate_examples(self, filepath):
 
135
  with open(filepath) as f:
136
  for i, line in enumerate(f):
137
  data = json.loads(line)
 
138
  for feature in ['negative_passages', 'positive_passages']:
139
  if data.get(feature) is None:
140
  data[feature] = []
141
 
142
- yield data['query_id'], data
 
132
  return splits
133
 
134
  def _generate_examples(self, filepath):
135
+ lang = self.config.name
136
  with open(filepath) as f:
137
  for i, line in enumerate(f):
138
  data = json.loads(line)
139
+ qid = data['query_id'] if lang != 'combined' else f'fake-{i}'
140
  for feature in ['negative_passages', 'positive_passages']:
141
  if data.get(feature) is None:
142
  data[feature] = []
143
 
144
+ yield qid, data