Datasets:

Tasks:
Other
Languages:
English
Multilinguality:
monolingual
Size Categories:
10M<n<100M
Language Creators:
expert-generated
Annotations Creators:
expert-generated
Source Datasets:
original
Tags:
disambiguation
License:
albertvillanova HF staff commited on
Commit
6110dd4
1 Parent(s): 7ec7ce7

Update loading script

Browse files
Files changed (1) hide show
  1. medal.py +14 -20
medal.py CHANGED
@@ -18,13 +18,11 @@
18
 
19
 
20
  import csv
 
21
 
22
  import datasets
23
 
24
 
25
- logger = datasets.logging.get_logger(__name__)
26
-
27
-
28
  _CITATION = """\
29
  @inproceedings{wen-etal-2020-medal,
30
  title = "{M}e{DAL}: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining",
@@ -45,12 +43,15 @@ _DESCRIPTION = """\
45
  A large medical text dataset (14Go) curated to 4Go for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. For example, DHF can be disambiguated to dihydrofolate, diastolic heart failure, dengue hemorragic fever or dihydroxyfumarate
46
  """
47
 
48
- _URL = "https://zenodo.org/record/4482922/files/"
49
  _URLS = {
50
- "train": _URL + "train.csv",
51
- "test": _URL + "test.csv",
52
- "valid": _URL + "valid.csv",
53
- "full": _URL + "full_data.csv",
 
 
 
 
54
  }
55
 
56
 
@@ -86,35 +87,28 @@ class Medal(datasets.GeneratorBasedBuilder):
86
  """Returns SplitGenerators."""
87
  # dl_manager is a datasets.download.DownloadManager that can be used to
88
  # download and extract URLs
89
- urls_to_dl = _URLS
90
- try:
91
- dl_dir = dl_manager.download_and_extract(urls_to_dl)
92
- except Exception:
93
- logger.warning(
94
- "This dataset is downloaded through Zenodo which is flaky. If this download failed try a few times before reporting an issue"
95
- )
96
- raise
97
 
98
  return [
99
  datasets.SplitGenerator(
100
  name=datasets.Split.TRAIN,
101
  # These kwargs will be passed to _generate_examples
102
- gen_kwargs={"filepath": dl_dir["train"], "split": "train"},
103
  ),
104
  datasets.SplitGenerator(
105
  name=datasets.Split.TEST,
106
  # These kwargs will be passed to _generate_examples
107
- gen_kwargs={"filepath": dl_dir["test"], "split": "test"},
108
  ),
109
  datasets.SplitGenerator(
110
  name=datasets.Split.VALIDATION,
111
  # These kwargs will be passed to _generate_examples
112
- gen_kwargs={"filepath": dl_dir["valid"], "split": "val"},
113
  ),
114
  datasets.SplitGenerator(
115
  name="full",
116
  # These kwargs will be passed to _generate_examples
117
- gen_kwargs={"filepath": dl_dir["full"], "split": "full"},
118
  ),
119
  ]
120
 
 
18
 
19
 
20
  import csv
21
+ import os.path
22
 
23
  import datasets
24
 
25
 
 
 
 
26
  _CITATION = """\
27
  @inproceedings{wen-etal-2020-medal,
28
  title = "{M}e{DAL}: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining",
 
43
  A large medical text dataset (14Go) curated to 4Go for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. For example, DHF can be disambiguated to dihydrofolate, diastolic heart failure, dengue hemorragic fever or dihydroxyfumarate
44
  """
45
 
 
46
  _URLS = {
47
+ "pretrain": "data/pretrain_subset.zip",
48
+ "full": "data/full_data.csv.zip"
49
+ }
50
+ _FILENAMES = {
51
+ "train": "train.csv",
52
+ "test": "test.csv",
53
+ "valid": "valid.csv",
54
+ "full": "full_data.csv",
55
  }
56
 
57
 
 
87
  """Returns SplitGenerators."""
88
  # dl_manager is a datasets.download.DownloadManager that can be used to
89
  # download and extract URLs
90
+ dl_dir = dl_manager.download_and_extract(_URLS)
 
 
 
 
 
 
 
91
 
92
  return [
93
  datasets.SplitGenerator(
94
  name=datasets.Split.TRAIN,
95
  # These kwargs will be passed to _generate_examples
96
+ gen_kwargs={"filepath": os.path.join(dl_dir["pretrain"], _FILENAMES["train"]), "split": "train"},
97
  ),
98
  datasets.SplitGenerator(
99
  name=datasets.Split.TEST,
100
  # These kwargs will be passed to _generate_examples
101
+ gen_kwargs={"filepath": os.path.join(dl_dir["pretrain"], _FILENAMES["test"]), "split": "test"},
102
  ),
103
  datasets.SplitGenerator(
104
  name=datasets.Split.VALIDATION,
105
  # These kwargs will be passed to _generate_examples
106
+ gen_kwargs={"filepath": os.path.join(dl_dir["pretrain"], _FILENAMES["valid"]), "split": "val"},
107
  ),
108
  datasets.SplitGenerator(
109
  name="full",
110
  # These kwargs will be passed to _generate_examples
111
+ gen_kwargs={"filepath": os.path.join(dl_dir["full"], _FILENAMES["full"]), "split": "full"},
112
  ),
113
  ]
114