Datasets:
Tasks:
Text Retrieval
Sub-tasks:
entity-linking-retrieval
Languages:
Chinese
Size:
1M - 10M
ArXiv:
License:
change _generate_examples function according to kilt_task
Browse files
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 |
-
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|