Update pico-breast-cancer.py
Browse files- pico-breast-cancer.py +7 -2
pico-breast-cancer.py
CHANGED
@@ -22,11 +22,12 @@ The abstracts were annotated using BRAT (https://brat.nlplab.org/) and later
|
|
22 |
converted to IOB format.
|
23 |
"""
|
24 |
|
25 |
-
_URL = "https://raw.githubusercontent.com/Martin-Masson/pico-breast-cancer/main/
|
26 |
_TRAINING_FILE = "train.txt"
|
27 |
_DEV_FILE = "dev.txt"
|
28 |
_TEST_FILE = "test.txt"
|
29 |
_ALL_FILE = "all.txt"
|
|
|
30 |
|
31 |
|
32 |
class PicoBreastCancerConfig(datasets.BuilderConfig):
|
@@ -46,6 +47,7 @@ class PicoBreastCancer(datasets.GeneratorBasedBuilder):
|
|
46 |
BUILDER_CONFIGS = [
|
47 |
PicoBreastCancerConfig(name="split", version=datasets.Version("1.0.0"), description="Train/Validation/Test splits containing respectively 80%/10%/10% of all the abstracts."),
|
48 |
PicoBreastCancerConfig(name="all", version=datasets.Version("1.0.0"), description="Single dataset containing all the absracts for custom splitting."),
|
|
|
49 |
]
|
50 |
|
51 |
DEFAULT_CONFIG_NAME = "split"
|
@@ -130,6 +132,7 @@ class PicoBreastCancer(datasets.GeneratorBasedBuilder):
|
|
130 |
"dev": f"{_URL}{_DEV_FILE}",
|
131 |
"test": f"{_URL}{_TEST_FILE}",
|
132 |
"all": f"{_URL}{_ALL_FILE}",
|
|
|
133 |
}
|
134 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
135 |
if self.config.name == "split":
|
@@ -139,9 +142,11 @@ class PicoBreastCancer(datasets.GeneratorBasedBuilder):
|
|
139 |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
140 |
]
|
141 |
else:
|
|
|
142 |
return [
|
143 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files[
|
144 |
]
|
|
|
145 |
|
146 |
def _generate_examples(self, filepath):
|
147 |
logger.info("⏳ Generating examples from = %s", filepath)
|
|
|
22 |
converted to IOB format.
|
23 |
"""
|
24 |
|
25 |
+
_URL = "https://raw.githubusercontent.com/Martin-Masson/pico-breast-cancer/main/pico_iob/"
|
26 |
_TRAINING_FILE = "train.txt"
|
27 |
_DEV_FILE = "dev.txt"
|
28 |
_TEST_FILE = "test.txt"
|
29 |
_ALL_FILE = "all.txt"
|
30 |
+
_SHORT_FILE = "all_short.txt"
|
31 |
|
32 |
|
33 |
class PicoBreastCancerConfig(datasets.BuilderConfig):
|
|
|
47 |
BUILDER_CONFIGS = [
|
48 |
PicoBreastCancerConfig(name="split", version=datasets.Version("1.0.0"), description="Train/Validation/Test splits containing respectively 80%/10%/10% of all the abstracts."),
|
49 |
PicoBreastCancerConfig(name="all", version=datasets.Version("1.0.0"), description="Single dataset containing all the absracts for custom splitting."),
|
50 |
+
PicoBreastCancerConfig(name="short", version=datasets.Version("1.0.0"), description="Similar to 'all' but with shortened examples to account for embeddings size."),
|
51 |
]
|
52 |
|
53 |
DEFAULT_CONFIG_NAME = "split"
|
|
|
132 |
"dev": f"{_URL}{_DEV_FILE}",
|
133 |
"test": f"{_URL}{_TEST_FILE}",
|
134 |
"all": f"{_URL}{_ALL_FILE}",
|
135 |
+
"short": f"{_URL}{_SHORT_FILE_FILE}",
|
136 |
}
|
137 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
138 |
if self.config.name == "split":
|
|
|
142 |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
143 |
]
|
144 |
else:
|
145 |
+
file = "all" if self.config.name == "all" else "short"
|
146 |
return [
|
147 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files[file]}),
|
148 |
]
|
149 |
+
|
150 |
|
151 |
def _generate_examples(self, filepath):
|
152 |
logger.info("⏳ Generating examples from = %s", filepath)
|