Datasets:

Modalities:
Tabular
Text
Languages:
Chinese
ArXiv:
Libraries:
Datasets
License:
imryanxu commited on
Commit
2e1facf
1 Parent(s): 9d1dd27

change _generate_examples function according to kilt_task

Browse files
Files changed (1) hide show
  1. Hansel.py +2 -20
Hansel.py CHANGED
@@ -148,24 +148,6 @@ class Hansel(datasets.GeneratorBasedBuilder):
148
  def _generate_examples(self, data_file, split):
149
  logger.info("generating examples from = %s", data_file)
150
  with open(data_file, encoding="utf-8") as f:
151
- for line in f:
152
  temDict = json.loads(line)
153
- key = temDict["id"]
154
- if "hansel" in self.config.name:
155
- yield key, {
156
- "text": temDict["text"],
157
- "start": temDict["start"],
158
- "end": temDict["end"],
159
- "mention": temDict["mention"],
160
- "gold_id": temDict["gold_id"],
161
- "source": temDict["source"],
162
- "domain": temDict["domain"],
163
- }
164
- else:
165
- yield key, {
166
- "text": temDict["text"],
167
- "start": temDict["start"],
168
- "end": temDict["end"],
169
- "mention": temDict["mention"],
170
- "gold_id": temDict["gold_id"],
171
- }
 
148
  def _generate_examples(self, data_file, split):
149
  logger.info("generating examples from = %s", data_file)
150
  with open(data_file, encoding="utf-8") as f:
151
+ for idx, line in enumerate(f):
152
  temDict = json.loads(line)
153
+ yield idx, temDict