antoinelouis
commited on
Commit
•
049deae
1
Parent(s):
b446608
Update bsard.py
Browse files
bsard.py
CHANGED
@@ -80,7 +80,7 @@ class BSARD(datasets.GeneratorBasedBuilder):
|
|
80 |
features = {
|
81 |
"id": datasets.Value("int32"),
|
82 |
"question": datasets.Value("string"),
|
83 |
-
"article_ids": datasets.Value("
|
84 |
"category": datasets.Value("string"),
|
85 |
"subcategory": datasets.Value("string"),
|
86 |
"extra_description": datasets.Value("string"),
|
@@ -104,7 +104,7 @@ class BSARD(datasets.GeneratorBasedBuilder):
|
|
104 |
def _split_generators(self, dl_manager):
|
105 |
if self.config.name == "corpus":
|
106 |
dl_path = dl_manager.download_and_extract(_URLS["corpus"])
|
107 |
-
return [datasets.SplitGenerator(name=
|
108 |
elif self.config.name == "questions":
|
109 |
splits = ["train-questions", "test-questions", "synthetic-questions"]
|
110 |
dl_paths = dl_manager.download_and_extract({split: _URLS[split] for split in splits})
|
@@ -148,7 +148,7 @@ class BSARD(datasets.GeneratorBasedBuilder):
|
|
148 |
features = {
|
149 |
"id": int(row["id"]),
|
150 |
"question": row["question"],
|
151 |
-
"article_ids": row["article_ids"],
|
152 |
"category": "" if split == "synthetic" else row["category"],
|
153 |
"subcategory": "" if split == "synthetic" else row["subcategory"],
|
154 |
"extra_description": "" if split == "synthetic" else row["extra_description"],
|
|
|
80 |
features = {
|
81 |
"id": datasets.Value("int32"),
|
82 |
"question": datasets.Value("string"),
|
83 |
+
"article_ids": datasets.Sequence(datasets.Value("int32")),
|
84 |
"category": datasets.Value("string"),
|
85 |
"subcategory": datasets.Value("string"),
|
86 |
"extra_description": datasets.Value("string"),
|
|
|
104 |
def _split_generators(self, dl_manager):
|
105 |
if self.config.name == "corpus":
|
106 |
dl_path = dl_manager.download_and_extract(_URLS["corpus"])
|
107 |
+
return [datasets.SplitGenerator(name="corpus", gen_kwargs={"filepath": dl_path})]
|
108 |
elif self.config.name == "questions":
|
109 |
splits = ["train-questions", "test-questions", "synthetic-questions"]
|
110 |
dl_paths = dl_manager.download_and_extract({split: _URLS[split] for split in splits})
|
|
|
148 |
features = {
|
149 |
"id": int(row["id"]),
|
150 |
"question": row["question"],
|
151 |
+
"article_ids": [int(num) for num in row["article_ids"].split(",")],
|
152 |
"category": "" if split == "synthetic" else row["category"],
|
153 |
"subcategory": "" if split == "synthetic" else row["subcategory"],
|
154 |
"extra_description": "" if split == "synthetic" else row["extra_description"],
|