delete origin
Browse files- soybean_dataset.py +0 -38
soybean_dataset.py
CHANGED
@@ -157,41 +157,3 @@ class SoybeanDataset(datasets.GeneratorBasedBuilder):
|
|
157 |
|
158 |
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
#### origin
|
164 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
165 |
-
urls_to_download = self._URLS
|
166 |
-
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
167 |
-
|
168 |
-
return [
|
169 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
170 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
171 |
-
]
|
172 |
-
|
173 |
-
def _generate_examples(self, filepath):
|
174 |
-
"""This function returns the examples in the raw (text) form."""
|
175 |
-
logging.info("generating examples from = %s", filepath)
|
176 |
-
with open(filepath) as f:
|
177 |
-
squad = json.load(f)
|
178 |
-
for article in squad["data"]:
|
179 |
-
title = article.get("title", "").strip()
|
180 |
-
for paragraph in article["paragraphs"]:
|
181 |
-
context = paragraph["context"].strip()
|
182 |
-
for qa in paragraph["qas"]:
|
183 |
-
question = qa["question"].strip()
|
184 |
-
id_ = qa["id"]
|
185 |
-
|
186 |
-
answer_starts = [answer["answer_start"] for answer in qa["answers"]]
|
187 |
-
answers = [answer["text"].strip() for answer in qa["answers"]]
|
188 |
-
|
189 |
-
# Features currently used are "context", "question", and "answers".
|
190 |
-
# Others are extracted here for the ease of future expansions.
|
191 |
-
yield id_, {
|
192 |
-
"title": title,
|
193 |
-
"context": context,
|
194 |
-
"question": question,
|
195 |
-
"id": id_,
|
196 |
-
"answers": {"answer_start": answer_starts, "text": answers,},
|
197 |
-
}
|
|
|
157 |
|
158 |
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|