albertvillanova HF staff commited on
Commit
3c40ba1
1 Parent(s): a41ac09

Convert dataset to Parquet (#5)

Browse files

- Convert dataset to Parquet (ef16cee1ed5ee1caf9a45e1a67b026e1201e487f)
- Delete loading script (aa266b83217bf99dfc90c6d81e7b962dc1dad784)

README.md CHANGED
@@ -1,5 +1,4 @@
1
  ---
2
- pretty_name: Ohsumed
3
  annotations_creators:
4
  - expert-generated
5
  language_creators:
@@ -18,8 +17,9 @@ task_categories:
18
  - text-classification
19
  task_ids:
20
  - multi-label-classification
21
- paperswithcode_id: null
22
  dataset_info:
 
23
  features:
24
  - name: seq_id
25
  dtype: int64
@@ -37,16 +37,23 @@ dataset_info:
37
  dtype: string
38
  - name: source
39
  dtype: string
40
- config_name: ohsumed
41
  splits:
42
  - name: train
43
- num_bytes: 60117860
44
  num_examples: 54709
45
  - name: test
46
- num_bytes: 338533901
47
  num_examples: 293855
48
- download_size: 139454017
49
- dataset_size: 398651761
 
 
 
 
 
 
 
 
50
  ---
51
 
52
  # Dataset Card for ohsumed
 
1
  ---
 
2
  annotations_creators:
3
  - expert-generated
4
  language_creators:
 
17
  - text-classification
18
  task_ids:
19
  - multi-label-classification
20
+ pretty_name: Ohsumed
21
  dataset_info:
22
+ config_name: ohsumed
23
  features:
24
  - name: seq_id
25
  dtype: int64
 
37
  dtype: string
38
  - name: source
39
  dtype: string
 
40
  splits:
41
  - name: train
42
+ num_bytes: 76530191
43
  num_examples: 54709
44
  - name: test
45
+ num_bytes: 435681911
46
  num_examples: 293855
47
+ download_size: 213196532
48
+ dataset_size: 512212102
49
+ configs:
50
+ - config_name: ohsumed
51
+ data_files:
52
+ - split: train
53
+ path: ohsumed/train-*
54
+ - split: test
55
+ path: ohsumed/test-*
56
+ default: true
57
  ---
58
 
59
  # Dataset Card for ohsumed
ohsumed.py DELETED
@@ -1,225 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """OHSUMED: An Interactive Retrieval Evaluation and New Large Test Collection for Research."""
16
-
17
-
18
- import datasets
19
-
20
-
21
- # TODO: Add BibTeX citation
22
- # Find for instance the citation on arxiv or on the dataset repo/website
23
- _CITATION = """\
24
- @InProceedings{10.1007/978-1-4471-2099-5_20,
25
- author="Hersh, William
26
- and Buckley, Chris
27
- and Leone, T. J.
28
- and Hickam, David",
29
- editor="Croft, Bruce W.
30
- and van Rijsbergen, C. J.",
31
- title="OHSUMED: An Interactive Retrieval Evaluation and New Large Test Collection for Research",
32
- booktitle="SIGIR '94",
33
- year="1994",
34
- publisher="Springer London",
35
- address="London",
36
- pages="192--201",
37
- abstract="A series of information retrieval experiments was carried out with a computer installed in a medical practice setting for relatively inexperienced physician end-users. Using a commercial MEDLINE product based on the vector space model, these physicians searched just as effectively as more experienced searchers using Boolean searching. The results of this experiment were subsequently used to create a new large medical test collection, which was used in experiments with the SMART retrieval system to obtain baseline performance data as well as compare SMART with the other searchers.",
38
- isbn="978-1-4471-2099-5"
39
- }
40
- """
41
-
42
- # TODO: Add description of the dataset here
43
- # You can copy an official description
44
- _DESCRIPTION = """\
45
- The OHSUMED test collection is a set of 348,566 references from
46
- MEDLINE, the on-line medical information database, consisting of
47
- titles and/or abstracts from 270 medical journals over a five-year
48
- period (1987-1991). The available fields are title, abstract, MeSH
49
- indexing terms, author, source, and publication type.
50
- """
51
-
52
- # TODO: Add a link to an official homepage for the dataset here
53
- _HOMEPAGE = "http://davis.wpi.edu/xmdv/datasets/ohsumed.html"
54
-
55
- # TODO: Add the licence for the dataset here if you can find it
56
- _LICENSE = "CC BY-NC 4.0"
57
-
58
- # TODO: Add link to the official dataset URLs here
59
- # The HuggingFace dataset library don't host the datasets but only point to the original files
60
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
61
- _URLs = {"ohsumed": "https://trec.nist.gov/data/filtering/t9.filtering.tar.gz"}
62
-
63
-
64
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
65
- class Ohsumed(datasets.GeneratorBasedBuilder):
66
- """OHSUMED: An Interactive Retrieval Evaluation and New Large Test Collection for Research."""
67
-
68
- VERSION = datasets.Version("1.1.0")
69
-
70
- # This is an example of a dataset with multiple configurations.
71
- # If you don't want/need to define several sub-sets in your dataset,
72
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
73
-
74
- # If you need to make complex sub-parts in the datasets with configurable options
75
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
76
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
77
-
78
- # You will be able to load one or the other configurations in the following list with
79
- # data = datasets.load_dataset('my_dataset', 'first_domain')
80
- # data = datasets.load_dataset('my_dataset', 'second_domain')
81
- BUILDER_CONFIGS = [
82
- datasets.BuilderConfig(
83
- name="ohsumed",
84
- version=VERSION,
85
- description="Config for the entire ohsumed dataset. An Interactive Retrieval Evaluation and New Large Test Collection for Research",
86
- )
87
- ]
88
-
89
- def _info(self):
90
- # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
91
- features = datasets.Features(
92
- {
93
- "seq_id": datasets.Value("int64"),
94
- "medline_ui": datasets.Value("int64"),
95
- "mesh_terms": datasets.Value("string"),
96
- "title": datasets.Value("string"),
97
- "publication_type": datasets.Value("string"),
98
- "abstract": datasets.Value("string"),
99
- "author": datasets.Value("string"),
100
- "source": datasets.Value("string"),
101
- }
102
- )
103
- return datasets.DatasetInfo(
104
- # This is the description that will appear on the datasets page.
105
- description=_DESCRIPTION,
106
- # This defines the different columns of the dataset and their types
107
- features=features, # Here we define them above because they are different between the two configurations
108
- # If there's a common (input, target) tuple from the features,
109
- # specify them here. They'll be used if as_supervised=True in
110
- # builder.as_dataset.
111
- supervised_keys=None,
112
- # Homepage of the dataset for documentation
113
- homepage=_HOMEPAGE,
114
- # License for the dataset if available
115
- license=_LICENSE,
116
- # Citation for the dataset
117
- citation=_CITATION,
118
- )
119
-
120
- def _split_generators(self, dl_manager):
121
- """Returns SplitGenerators."""
122
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
123
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
124
-
125
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
126
- # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
127
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
128
- my_urls = _URLs[self.config.name]
129
- archive = dl_manager.download(my_urls)
130
- return [
131
- datasets.SplitGenerator(
132
- name=datasets.Split.TRAIN,
133
- # These kwargs will be passed to _generate_examples
134
- gen_kwargs={
135
- "filepath": "ohsu-trec/trec9-train/ohsumed.87",
136
- "files": dl_manager.iter_archive(archive),
137
- },
138
- ),
139
- datasets.SplitGenerator(
140
- name=datasets.Split.TEST,
141
- # These kwargs will be passed to _generate_examples
142
- gen_kwargs={
143
- "filepath": "ohsu-trec/trec9-test/ohsumed.88-91",
144
- "files": dl_manager.iter_archive(archive),
145
- },
146
- ),
147
- ]
148
-
149
- def _generate_examples(self, filepath, files):
150
- """Yields examples."""
151
- # TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
152
- # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
153
- # The key is not important, it's more here for legacy reason (legacy from tfds)
154
-
155
- def ohsumed_dict():
156
- """Returns a dict."""
157
-
158
- data = {
159
- "seq_id": -1,
160
- "medline_ui": -1,
161
- "mesh_terms": "",
162
- "title": "",
163
- "publication_type": "",
164
- "abstract": "",
165
- "author": "",
166
- "source": "",
167
- }
168
-
169
- return data
170
-
171
- tag = ""
172
- column_map = {
173
- ".I": "seq_id",
174
- ".U": "medline_ui",
175
- ".M": "mesh_terms",
176
- ".T": "title",
177
- ".P": "publication_type",
178
- ".W": "abstract",
179
- ".A": "author",
180
- ".S": "source",
181
- }
182
-
183
- for path, f in files:
184
- if path == filepath:
185
- data = ohsumed_dict()
186
-
187
- for line in f.readlines():
188
- line = line.decode("utf-8").strip()
189
-
190
- if line.startswith(".I"):
191
- tag = ".I"
192
- if data["medline_ui"] != -1:
193
- id_ = data["seq_id"] + "_" + data["medline_ui"]
194
- yield id_, {
195
- "seq_id": data["seq_id"],
196
- "medline_ui": data["medline_ui"],
197
- "mesh_terms": str(data["mesh_terms"]),
198
- "title": str(data["title"]),
199
- "publication_type": str(data["publication_type"]),
200
- "abstract": str(data["abstract"]),
201
- "author": str(data["author"]),
202
- "source": str(data["source"]),
203
- }
204
- else:
205
- data = ohsumed_dict()
206
- line = line.replace(".I", "").strip()
207
- data["seq_id"] = line
208
- elif tag and not line.startswith("."):
209
- key = column_map[tag]
210
- data[key] = line
211
- elif ".U" in line:
212
- tag = ".U"
213
- elif ".M" in line:
214
- tag = ".M"
215
- elif ".T" in line:
216
- tag = ".T"
217
- elif ".P" in line:
218
- tag = ".P"
219
- elif ".W" in line:
220
- tag = ".W"
221
- elif ".A" in line:
222
- tag = ".A"
223
- elif ".S" in line:
224
- tag = ".S"
225
- break
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ohsumed/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b876e776224612b4d1b4e64c421cea747e0d8bb4999efa2c9b675276c66e1f0
3
+ size 181016705
ohsumed/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b066e4924e72253206c69c408e98f70bb7ce5d1ffc3e299d8b38a5ca520dc268
3
+ size 32179827