Commit
•
94a2779
0
Parent(s):
Update files from the datasets library (from 1.3.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.3.0
- .gitattributes +27 -0
- README.md +231 -0
- cord19.py +211 -0
- dataset_infos.json +1 -0
- dummy/embeddings/0.0.0/dummy_data.zip +3 -0
- dummy/fulltext/0.0.0/dummy_data.zip +3 -0
- dummy/metadata/0.0.0/dummy_data.zip +3 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- no-annotation
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- cc-by-nc-sa-2-0
|
10 |
+
- cc-by-nc-2-0
|
11 |
+
- cc-by-nd-2-0
|
12 |
+
- cc-by-sa-2-0
|
13 |
+
- cc-by-nc-nd-2-0
|
14 |
+
- cc-by-nc-1-0
|
15 |
+
- other-cc0
|
16 |
+
- other-hybrid-oa
|
17 |
+
- other-els-covid
|
18 |
+
- other-no-cc
|
19 |
+
- other-gold-oa
|
20 |
+
- other-green-oa
|
21 |
+
- other-bronze-oa
|
22 |
+
- other-biorxiv
|
23 |
+
- other-arxiv
|
24 |
+
- other-medrxiv
|
25 |
+
- other-unk
|
26 |
+
multilinguality:
|
27 |
+
- monolingual
|
28 |
+
size_categories:
|
29 |
+
- 100K<n<1M
|
30 |
+
source_datasets:
|
31 |
+
- original
|
32 |
+
task_categories:
|
33 |
+
- other
|
34 |
+
task_ids:
|
35 |
+
- other-other-knowledge-extraction
|
36 |
+
---
|
37 |
+
|
38 |
+
# Dataset Card Creation Guide
|
39 |
+
|
40 |
+
## Table of Contents
|
41 |
+
- [Dataset Description](#dataset-description)
|
42 |
+
- [Dataset Summary](#dataset-summary)
|
43 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
44 |
+
- [Languages](#languages)
|
45 |
+
- [Dataset Structure](#dataset-structure)
|
46 |
+
- [Data Instances](#data-instances)
|
47 |
+
- [Data Fields](#data-instances)
|
48 |
+
- [Data Splits](#data-instances)
|
49 |
+
- [Dataset Creation](#dataset-creation)
|
50 |
+
- [Curation Rationale](#curation-rationale)
|
51 |
+
- [Source Data](#source-data)
|
52 |
+
- [Annotations](#annotations)
|
53 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
54 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
55 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
56 |
+
- [Discussion of Biases](#discussion-of-biases)
|
57 |
+
- [Other Known Limitations](#other-known-limitations)
|
58 |
+
- [Additional Information](#additional-information)
|
59 |
+
- [Dataset Curators](#dataset-curators)
|
60 |
+
- [Licensing Information](#licensing-information)
|
61 |
+
- [Citation Information](#citation-information)
|
62 |
+
- [Contributions](#contributions)
|
63 |
+
|
64 |
+
## Dataset Description
|
65 |
+
|
66 |
+
- **Homepage:** [https://www.semanticscholar.org/cord19](https://www.semanticscholar.org/cord19)
|
67 |
+
- **Repository:** [https://github.com/allenai/cord19](https://github.com/allenai/cord19)
|
68 |
+
- **Paper:** [CORD-19: The COVID-19 Open Research Dataset](https://www.aclweb.org/anthology/2020.nlpcovid19-acl.1/)
|
69 |
+
- **Leaderboard:** [Kaggle challenge](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge)
|
70 |
+
|
71 |
+
|
72 |
+
### Dataset Summary
|
73 |
+
|
74 |
+
CORD-19 is a corpus of academic papers about COVID-19 and related coronavirus research. It's curated and maintained by the Semantic Scholar team at the Allen Institute for AI to support text mining and NLP research.
|
75 |
+
|
76 |
+
### Supported Tasks and Leaderboards
|
77 |
+
|
78 |
+
See tasks defined in the related [Kaggle challenge](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge/tasks)
|
79 |
+
|
80 |
+
### Languages
|
81 |
+
|
82 |
+
The dataset is in english (en).
|
83 |
+
|
84 |
+
## Dataset Structure
|
85 |
+
|
86 |
+
### Data Instances
|
87 |
+
|
88 |
+
The following code block present an overview of a sample in json-like syntax (abbreviated since some fields are very long):
|
89 |
+
```
|
90 |
+
{
|
91 |
+
"abstract": "OBJECTIVE: This retrospective chart review describes the epidemiology and clinical features of 40 patients with culture-proven Mycoplasma pneumoniae infections at King Abdulaziz University Hospital, Jeddah, Saudi Arabia. METHODS: Patients with positive M. pneumoniae cultures from respiratory specimens from January 1997 through December 1998 were identified through the Microbiology records. Charts of patients were reviewed. RESULTS: 40 patients were identified [...]",
|
92 |
+
"authors": "Madani, Tariq A; Al-Ghamdi, Aisha A",
|
93 |
+
"cord_uid": "ug7v899j",
|
94 |
+
"doc_embeddings": [
|
95 |
+
-2.939983606338501,
|
96 |
+
-6.312200546264648,
|
97 |
+
-1.0459030866622925,
|
98 |
+
[...] 766 values in total [...]
|
99 |
+
-4.107113361358643,
|
100 |
+
-3.8174145221710205,
|
101 |
+
1.8976187705993652,
|
102 |
+
5.811529159545898,
|
103 |
+
-2.9323840141296387
|
104 |
+
],
|
105 |
+
"doi": "10.1186/1471-2334-1-6",
|
106 |
+
"journal": "BMC Infect Dis",
|
107 |
+
"publish_time": "2001-07-04",
|
108 |
+
"sha": "d1aafb70c066a2068b02786f8929fd9c900897fb",
|
109 |
+
"source_x": "PMC",
|
110 |
+
"title": "Clinical features of culture-proven Mycoplasma pneumoniae infections at King Abdulaziz University Hospital, Jeddah, Saudi Arabia",
|
111 |
+
"url": "https: //www.ncbi.nlm.nih.gov/pmc/articles/PMC35282/"
|
112 |
+
}
|
113 |
+
```
|
114 |
+
|
115 |
+
### Data Fields
|
116 |
+
|
117 |
+
Currently only the following fields are integrated: `cord_uid`, `sha`,`source_x`, `title`, `doi`, `abstract`, `publish_time`, `authors`, `journal`. With `fulltext` configuration, the sections transcribed in `pdf_json_files` are converted in `fulltext` feature.
|
118 |
+
|
119 |
+
- `cord_uid`: A `str`-valued field that assigns a unique identifier to each CORD-19 paper. This is not necessariy unique per row, which is explained in the FAQs.
|
120 |
+
- `sha`: A `List[str]`-valued field that is the SHA1 of all PDFs associated with the CORD-19 paper. Most papers will have either zero or one value here (since we either have a PDF or we don't), but some papers will have multiple. For example, the main paper might have supplemental information saved in a separate PDF. Or we might have two separate PDF copies of the same paper. If multiple PDFs exist, their SHA1 will be semicolon-separated (e.g. `'4eb6e165ee705e2ae2a24ed2d4e67da42831ff4a; d4f0247db5e916c20eae3f6d772e8572eb828236'`)
|
121 |
+
- `source_x`: A `List[str]`-valued field that is the names of sources from which we received this paper. Also semicolon-separated. For example, `'ArXiv; Elsevier; PMC; WHO'`. There should always be at least one source listed.
|
122 |
+
- `title`: A `str`-valued field for the paper title
|
123 |
+
- `doi`: A `str`-valued field for the paper DOI
|
124 |
+
- `pmcid`: A `str`-valued field for the paper's ID on PubMed Central. Should begin with `PMC` followed by an integer.
|
125 |
+
- `pubmed_id`: An `int`-valued field for the paper's ID on PubMed.
|
126 |
+
- `license`: A `str`-valued field with the most permissive license we've found associated with this paper. Possible values include: `'cc0', 'hybrid-oa', 'els-covid', 'no-cc', 'cc-by-nc-sa', 'cc-by', 'gold-oa', 'biorxiv', 'green-oa', 'bronze-oa', 'cc-by-nc', 'medrxiv', 'cc-by-nd', 'arxiv', 'unk', 'cc-by-sa', 'cc-by-nc-nd'`
|
127 |
+
- `abstract`: A `str`-valued field for the paper's abstract
|
128 |
+
- `publish_time`: A `str`-valued field for the published date of the paper. This is in `yyyy-mm-dd` format. Not always accurate as some publishers will denote unknown dates with future dates like `yyyy-12-31`
|
129 |
+
- `authors`: A `List[str]`-valued field for the authors of the paper. Each author name is in `Last, First Middle` format and semicolon-separated.
|
130 |
+
- `journal`: A `str`-valued field for the paper journal. Strings are not normalized (e.g. `BMJ` and `British Medical Journal` can both exist). Empty string if unknown.
|
131 |
+
- `mag_id`: Deprecated, but originally an `int`-valued field for the paper as represented in the Microsoft Academic Graph.
|
132 |
+
- `who_covidence_id`: A `str`-valued field for the ID assigned by the WHO for this paper. Format looks like `#72306`.
|
133 |
+
- `arxiv_id`: A `str`-valued field for the arXiv ID of this paper.
|
134 |
+
- `pdf_json_files`: A `List[str]`-valued field containing paths from the root of the current data dump version to the parses of the paper PDFs into JSON format. Multiple paths are semicolon-separated. Example: `document_parses/pdf_json/4eb6e165ee705e2ae2a24ed2d4e67da42831ff4a.json; document_parses/pdf_json/d4f0247db5e916c20eae3f6d772e8572eb828236.json`
|
135 |
+
- `pmc_json_files`: A `List[str]`-valued field. Same as above, but corresponding to the full text XML files downloaded from PMC, parsed into the same JSON format as above.
|
136 |
+
- `url`: A `List[str]`-valued field containing all URLs associated with this paper. Semicolon-separated.
|
137 |
+
- `s2_id`: A `str`-valued field containing the Semantic Scholar ID for this paper. Can be used with the Semantic Scholar API (e.g. `s2_id=9445722` corresponds to `http://api.semanticscholar.org/corpusid:9445722`)
|
138 |
+
|
139 |
+
Extra fields based on selected configuration during loading:
|
140 |
+
|
141 |
+
- `fulltext`: A `str`-valued field containing the concatenation of all text sections from json (itself extracted from pdf)
|
142 |
+
- `doc_embeddings`: A `sequence` of float-valued elements containing document embeddings as a vector of floats (parsed from string of values separated by ','). Details on the system used to extract the embeddings are available in: [SPECTER: Document-level Representation Learning using Citation-informed Transformers](https://arxiv.org/abs/2004.07180). TL;DR: it's relying on a BERT model pre-trained on document-level relatedness using the citation graph. The system can be queried through REST (see [public API documentation](https://github.com/allenai/paper-embedding-public-apis)).
|
143 |
+
|
144 |
+
### Data Splits
|
145 |
+
|
146 |
+
No annotation provided in this dataset so all instances are provided in training split.
|
147 |
+
|
148 |
+
The sizes of each configurations are:
|
149 |
+
|
150 |
+
| | Tain |
|
151 |
+
| ----- | ------ |
|
152 |
+
| metadata | 368618 |
|
153 |
+
| fulltext | 368618 |
|
154 |
+
| embeddings | 368618 |
|
155 |
+
|
156 |
+
|
157 |
+
## Dataset Creation
|
158 |
+
|
159 |
+
### Curation Rationale
|
160 |
+
|
161 |
+
See [official readme](https://github.com/allenai/cord19/blob/master/README.md)
|
162 |
+
|
163 |
+
### Source Data
|
164 |
+
|
165 |
+
See [official readme](https://github.com/allenai/cord19/blob/master/README.md)
|
166 |
+
|
167 |
+
#### Initial Data Collection and Normalization
|
168 |
+
|
169 |
+
See [official readme](https://github.com/allenai/cord19/blob/master/README.md)
|
170 |
+
|
171 |
+
#### Who are the source language producers?
|
172 |
+
|
173 |
+
See [official readme](https://github.com/allenai/cord19/blob/master/README.md)
|
174 |
+
|
175 |
+
### Annotations
|
176 |
+
|
177 |
+
No annotations
|
178 |
+
|
179 |
+
#### Annotation process
|
180 |
+
|
181 |
+
N/A
|
182 |
+
|
183 |
+
#### Who are the annotators?
|
184 |
+
|
185 |
+
N/A
|
186 |
+
|
187 |
+
### Personal and Sensitive Information
|
188 |
+
|
189 |
+
[More Information Needed]
|
190 |
+
|
191 |
+
## Considerations for Using the Data
|
192 |
+
|
193 |
+
### Social Impact of Dataset
|
194 |
+
|
195 |
+
[More Information Needed]
|
196 |
+
|
197 |
+
### Discussion of Biases
|
198 |
+
|
199 |
+
[More Information Needed]
|
200 |
+
|
201 |
+
### Other Known Limitations
|
202 |
+
|
203 |
+
[More Information Needed]
|
204 |
+
|
205 |
+
## Additional Information
|
206 |
+
|
207 |
+
### Dataset Curators
|
208 |
+
|
209 |
+
[More Information Needed]
|
210 |
+
|
211 |
+
### Licensing Information
|
212 |
+
|
213 |
+
[More Information Needed]
|
214 |
+
|
215 |
+
### Citation Information
|
216 |
+
|
217 |
+
```
|
218 |
+
@article{Wang2020CORD19TC,
|
219 |
+
title={CORD-19: The Covid-19 Open Research Dataset},
|
220 |
+
author={Lucy Lu Wang and Kyle Lo and Yoganand Chandrasekhar and Russell Reas and Jiangjiang Yang and Darrin Eide and
|
221 |
+
K. Funk and Rodney Michael Kinney and Ziyang Liu and W. Merrill and P. Mooney and D. Murdick and Devvret Rishi and
|
222 |
+
Jerry Sheehan and Zhihong Shen and B. Stilson and A. Wade and K. Wang and Christopher Wilhelm and Boya Xie and
|
223 |
+
D. Raymond and Daniel S. Weld and Oren Etzioni and Sebastian Kohlmeier},
|
224 |
+
journal={ArXiv},
|
225 |
+
year={2020}
|
226 |
+
}
|
227 |
+
```
|
228 |
+
|
229 |
+
### Contributions
|
230 |
+
|
231 |
+
Thanks to [@ggdupont](https://github.com/ggdupont) for adding this dataset.
|
cord19.py
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""
|
16 |
+
CORD-19 dataset implementation initiated by @ggdupont
|
17 |
+
"""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import csv
|
22 |
+
import json
|
23 |
+
import os
|
24 |
+
|
25 |
+
import datasets
|
26 |
+
|
27 |
+
|
28 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
29 |
+
_CITATION = """\
|
30 |
+
@article{Wang2020CORD19TC,
|
31 |
+
title={CORD-19: The Covid-19 Open Research Dataset},
|
32 |
+
author={Lucy Lu Wang and Kyle Lo and Yoganand Chandrasekhar and Russell Reas and Jiangjiang Yang and Darrin Eide and
|
33 |
+
K. Funk and Rodney Michael Kinney and Ziyang Liu and W. Merrill and P. Mooney and D. Murdick and Devvret Rishi and
|
34 |
+
Jerry Sheehan and Zhihong Shen and B. Stilson and A. Wade and K. Wang and Christopher Wilhelm and Boya Xie and
|
35 |
+
D. Raymond and Daniel S. Weld and Oren Etzioni and Sebastian Kohlmeier},
|
36 |
+
journal={ArXiv},
|
37 |
+
year={2020}
|
38 |
+
}
|
39 |
+
"""
|
40 |
+
|
41 |
+
# You can copy an official description
|
42 |
+
_DESCRIPTION = """\
|
43 |
+
The Covid-19 Open Research Dataset (CORD-19) is a growing resource of scientific papers on Covid-19 and related
|
44 |
+
historical coronavirus research. CORD-19 is designed to facilitate the development of text mining and information
|
45 |
+
retrieval systems over its rich collection of metadata and structured full text papers. Since its release, CORD-19
|
46 |
+
has been downloaded over 75K times and has served as the basis of many Covid-19 text mining and discovery systems.
|
47 |
+
|
48 |
+
The dataset itself isn't defining a specific task, but there is a Kaggle challenge that define 17 open research
|
49 |
+
questions to be solved with the dataset: https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge/tasks
|
50 |
+
"""
|
51 |
+
|
52 |
+
# The HuggingFace dataset library don't host the datasets but only point to the original files
|
53 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
54 |
+
CORD19_DATASET_DATE = "2020-11-29"
|
55 |
+
_URL = (
|
56 |
+
"https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases/cord-19_"
|
57 |
+
+ CORD19_DATASET_DATE
|
58 |
+
+ ".tar.gz"
|
59 |
+
)
|
60 |
+
|
61 |
+
|
62 |
+
class Cord19(datasets.GeneratorBasedBuilder):
|
63 |
+
"""The Covid-19 Open Research Dataset (CORD-19) is a growing resource of scientific papers on Covid-19."""
|
64 |
+
|
65 |
+
VERSION = datasets.Version("0.0.1")
|
66 |
+
|
67 |
+
BUILDER_CONFIGS = [
|
68 |
+
datasets.BuilderConfig(
|
69 |
+
name="metadata",
|
70 |
+
description="The set of documents but loading some metadata like title and " "abstract for each article.",
|
71 |
+
),
|
72 |
+
datasets.BuilderConfig(
|
73 |
+
name="fulltext",
|
74 |
+
description="The set of documents loading some metadata like title and "
|
75 |
+
"abstract and full text for each article.",
|
76 |
+
),
|
77 |
+
datasets.BuilderConfig(
|
78 |
+
name="embeddings",
|
79 |
+
description="The set of documents loading some metadata like title and "
|
80 |
+
"abstract and document embeddings for each article.",
|
81 |
+
),
|
82 |
+
]
|
83 |
+
|
84 |
+
def _info(self):
|
85 |
+
# default metadata only
|
86 |
+
features_dict = {
|
87 |
+
"cord_uid": datasets.Value("string"),
|
88 |
+
"sha": datasets.Value("string"),
|
89 |
+
"source_x": datasets.Value("string"),
|
90 |
+
"title": datasets.Value("string"),
|
91 |
+
"doi": datasets.Value("string"),
|
92 |
+
"abstract": datasets.Value("string"),
|
93 |
+
"publish_time": datasets.Value("string"),
|
94 |
+
"authors": datasets.Value("string"),
|
95 |
+
"journal": datasets.Value("string"),
|
96 |
+
"url": datasets.Value("string"),
|
97 |
+
}
|
98 |
+
|
99 |
+
if "fulltext" in self.config.name:
|
100 |
+
# adding full_text
|
101 |
+
features_dict["fulltext"] = datasets.Value("string")
|
102 |
+
|
103 |
+
if "embeddings" in self.config.name:
|
104 |
+
# adding embeddings
|
105 |
+
features_dict["doc_embeddings"] = datasets.Sequence(datasets.Value("float64"))
|
106 |
+
|
107 |
+
return datasets.DatasetInfo(
|
108 |
+
# This is the description that will appear on the datasets page.
|
109 |
+
description=_DESCRIPTION,
|
110 |
+
# This defines the different columns of the dataset and their types
|
111 |
+
features=datasets.Features(features_dict),
|
112 |
+
supervised_keys=None,
|
113 |
+
homepage="https://www.semanticscholar.org/cord19/download",
|
114 |
+
citation=_CITATION,
|
115 |
+
)
|
116 |
+
|
117 |
+
def _split_generators(self, dl_manager):
|
118 |
+
"""Returns SplitGenerators."""
|
119 |
+
my_urls = _URL
|
120 |
+
data_dir = dl_manager.download_and_extract(my_urls)
|
121 |
+
|
122 |
+
files = dict()
|
123 |
+
files["metadata"] = os.path.join(data_dir, CORD19_DATASET_DATE, "metadata.csv")
|
124 |
+
|
125 |
+
if "fulltext" in self.config.name:
|
126 |
+
fulltext_dir_path = dl_manager.extract(
|
127 |
+
os.path.join(data_dir, CORD19_DATASET_DATE, "document_parses.tar.gz")
|
128 |
+
)
|
129 |
+
files["fulltext"] = fulltext_dir_path
|
130 |
+
|
131 |
+
if "embeddings" in self.config.name:
|
132 |
+
embeddings_dir_path = dl_manager.extract(
|
133 |
+
os.path.join(data_dir, CORD19_DATASET_DATE, "cord_19_embeddings.tar.gz")
|
134 |
+
)
|
135 |
+
files["embeddings"] = os.path.join(
|
136 |
+
embeddings_dir_path, "cord_19_embeddings_" + CORD19_DATASET_DATE + ".csv"
|
137 |
+
)
|
138 |
+
|
139 |
+
return [
|
140 |
+
datasets.SplitGenerator(
|
141 |
+
name=datasets.Split.TRAIN,
|
142 |
+
# These kwargs will be passed to _generate_examples
|
143 |
+
gen_kwargs={
|
144 |
+
"filepath": files,
|
145 |
+
"split": "train",
|
146 |
+
},
|
147 |
+
),
|
148 |
+
]
|
149 |
+
|
150 |
+
def _generate_examples(self, filepath, split):
|
151 |
+
""" Yields examples. """
|
152 |
+
|
153 |
+
metadata_filepath = filepath["metadata"]
|
154 |
+
|
155 |
+
if "fulltext" in self.config.name:
|
156 |
+
fulltext_dir_path = filepath["fulltext"]
|
157 |
+
|
158 |
+
fh = None
|
159 |
+
if "embeddings" in self.config.name:
|
160 |
+
embeddings_filepath = filepath["embeddings"]
|
161 |
+
fh = open(embeddings_filepath, mode="r", encoding="utf-8")
|
162 |
+
|
163 |
+
with open(metadata_filepath, mode="r", encoding="utf-8") as f:
|
164 |
+
reader = csv.reader(f, delimiter=",")
|
165 |
+
# skip headers
|
166 |
+
next(reader, None)
|
167 |
+
|
168 |
+
for i, line in enumerate(reader):
|
169 |
+
doc_fields = {
|
170 |
+
"cord_uid": line[0],
|
171 |
+
"sha": line[1],
|
172 |
+
"source_x": line[2],
|
173 |
+
"title": line[3],
|
174 |
+
"doi": line[4],
|
175 |
+
"abstract": line[8],
|
176 |
+
"publish_time": line[9],
|
177 |
+
"authors": line[10],
|
178 |
+
"journal": line[11],
|
179 |
+
"url": line[17],
|
180 |
+
}
|
181 |
+
|
182 |
+
if "fulltext" in self.config.name:
|
183 |
+
doc_fields["fulltext"] = ""
|
184 |
+
json_filepath = line[15]
|
185 |
+
# some entry do not have pdf transcript
|
186 |
+
if len(json_filepath) > 0:
|
187 |
+
# possibly multiple json (matching multiple pdf) then take the first one arbitrarily
|
188 |
+
if ";" in json_filepath:
|
189 |
+
json_filepath = json_filepath.split(";")[0]
|
190 |
+
|
191 |
+
# load json file
|
192 |
+
with open(
|
193 |
+
os.path.join(fulltext_dir_path, json_filepath), mode="r", encoding="utf-8"
|
194 |
+
) as json_file:
|
195 |
+
data = json.load(json_file)
|
196 |
+
doc_fields["fulltext"] = "\n".join(text_block["text"] for text_block in data["body_text"])
|
197 |
+
|
198 |
+
if "embeddings" in self.config.name:
|
199 |
+
# synchronized reading of embeddings csv
|
200 |
+
data = fh.readline().split(",")
|
201 |
+
doc_id = data[0]
|
202 |
+
|
203 |
+
doc_fields["doc_embeddings"] = []
|
204 |
+
|
205 |
+
if doc_id == doc_fields["cord_uid"]:
|
206 |
+
doc_fields["doc_embeddings"] = [float(v) for v in data[1:-1]]
|
207 |
+
|
208 |
+
yield i, doc_fields
|
209 |
+
|
210 |
+
if "embeddings" in self.config.name and fh is not None:
|
211 |
+
fh.close()
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"metadata": {"description": "The Covid-19 Open Research Dataset (CORD-19) is a growing resource of scientific papers on Covid-19 and related\nhistorical coronavirus research. CORD-19 is designed to facilitate the development of text mining and information\nretrieval systems over its rich collection of metadata and structured full text papers. Since its release, CORD-19\nhas been downloaded over 75K times and has served as the basis of many Covid-19 text mining and discovery systems.\n\nThe dataset itself isn't defining a specific task, but there is a Kaggle challenge that define 17 open research\nquestions to be solved with the dataset: https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge/tasks\n", "citation": "@article{Wang2020CORD19TC,\n title={CORD-19: The Covid-19 Open Research Dataset},\n author={Lucy Lu Wang and Kyle Lo and Yoganand Chandrasekhar and Russell Reas and Jiangjiang Yang and Darrin Eide and\n K. Funk and Rodney Michael Kinney and Ziyang Liu and W. Merrill and P. Mooney and D. Murdick and Devvret Rishi and\n Jerry Sheehan and Zhihong Shen and B. Stilson and A. Wade and K. Wang and Christopher Wilhelm and Boya Xie and\n D. Raymond and Daniel S. Weld and Oren Etzioni and Sebastian Kohlmeier},\n journal={ArXiv},\n year={2020}\n}\n", "homepage": "https://www.semanticscholar.org/cord19/download", "license": "", "features": {"cord_uid": {"dtype": "string", "id": null, "_type": "Value"}, "sha": {"dtype": "string", "id": null, "_type": "Value"}, "source_x": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "doi": {"dtype": "string", "id": null, "_type": "Value"}, "abstract": {"dtype": "string", "id": null, "_type": "Value"}, "publish_time": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"dtype": "string", "id": null, "_type": "Value"}, "journal": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cord19", "config_name": "metadata", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 496247275, "num_examples": 368618, "dataset_name": "cord19"}}, "download_checksums": {"https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases/cord-19_2020-11-29.tar.gz": {"num_bytes": 6142360818, "checksum": "56df7c715beaf8b84435f91b27fd7c8d9d1f50c6d04804bcf490e541d19d1783"}}, "download_size": 6142360818, "post_processing_size": null, "dataset_size": 496247275, "size_in_bytes": 6638608093}, "fulltext": {"description": "The Covid-19 Open Research Dataset (CORD-19) is a growing resource of scientific papers on Covid-19 and related\nhistorical coronavirus research. CORD-19 is designed to facilitate the development of text mining and information\nretrieval systems over its rich collection of metadata and structured full text papers. Since its release, CORD-19\nhas been downloaded over 75K times and has served as the basis of many Covid-19 text mining and discovery systems.\n\nThe dataset itself isn't defining a specific task, but there is a Kaggle challenge that define 17 open research\nquestions to be solved with the dataset: https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge/tasks\n", "citation": "@article{Wang2020CORD19TC,\n title={CORD-19: The Covid-19 Open Research Dataset},\n author={Lucy Lu Wang and Kyle Lo and Yoganand Chandrasekhar and Russell Reas and Jiangjiang Yang and Darrin Eide and\n K. Funk and Rodney Michael Kinney and Ziyang Liu and W. Merrill and P. Mooney and D. Murdick and Devvret Rishi and\n Jerry Sheehan and Zhihong Shen and B. Stilson and A. Wade and K. Wang and Christopher Wilhelm and Boya Xie and\n D. Raymond and Daniel S. Weld and Oren Etzioni and Sebastian Kohlmeier},\n journal={ArXiv},\n year={2020}\n}\n", "homepage": "https://www.semanticscholar.org/cord19/download", "license": "", "features": {"cord_uid": {"dtype": "string", "id": null, "_type": "Value"}, "sha": {"dtype": "string", "id": null, "_type": "Value"}, "source_x": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "doi": {"dtype": "string", "id": null, "_type": "Value"}, "abstract": {"dtype": "string", "id": null, "_type": "Value"}, "publish_time": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"dtype": "string", "id": null, "_type": "Value"}, "journal": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "fulltext": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cord19", "config_name": "fulltext", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3718245736, "num_examples": 368618, "dataset_name": "cord19"}}, "download_checksums": {"https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases/cord-19_2020-11-29.tar.gz": {"num_bytes": 6142360818, "checksum": "56df7c715beaf8b84435f91b27fd7c8d9d1f50c6d04804bcf490e541d19d1783"}}, "download_size": 6142360818, "post_processing_size": null, "dataset_size": 3718245736, "size_in_bytes": 9860606554}, "embeddings": {"description": "The Covid-19 Open Research Dataset (CORD-19) is a growing resource of scientific papers on Covid-19 and related\nhistorical coronavirus research. CORD-19 is designed to facilitate the development of text mining and information\nretrieval systems over its rich collection of metadata and structured full text papers. Since its release, CORD-19\nhas been downloaded over 75K times and has served as the basis of many Covid-19 text mining and discovery systems.\n\nThe dataset itself isn't defining a specific task, but there is a Kaggle challenge that define 17 open research\nquestions to be solved with the dataset: https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge/tasks\n", "citation": "@article{Wang2020CORD19TC,\n title={CORD-19: The Covid-19 Open Research Dataset},\n author={Lucy Lu Wang and Kyle Lo and Yoganand Chandrasekhar and Russell Reas and Jiangjiang Yang and Darrin Eide and\n K. Funk and Rodney Michael Kinney and Ziyang Liu and W. Merrill and P. Mooney and D. Murdick and Devvret Rishi and\n Jerry Sheehan and Zhihong Shen and B. Stilson and A. Wade and K. Wang and Christopher Wilhelm and Boya Xie and\n D. Raymond and Daniel S. Weld and Oren Etzioni and Sebastian Kohlmeier},\n journal={ArXiv},\n year={2020}\n}\n", "homepage": "https://www.semanticscholar.org/cord19/download", "license": "", "features": {"cord_uid": {"dtype": "string", "id": null, "_type": "Value"}, "sha": {"dtype": "string", "id": null, "_type": "Value"}, "source_x": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "doi": {"dtype": "string", "id": null, "_type": "Value"}, "abstract": {"dtype": "string", "id": null, "_type": "Value"}, "publish_time": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"dtype": "string", "id": null, "_type": "Value"}, "journal": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "doc_embeddings": {"feature": {"dtype": "float64", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cord19", "config_name": "embeddings", "version": "0.0.0", "splits": {"train": {"name": "train", "num_bytes": 2759561943, "num_examples": 368618, "dataset_name": "cord19"}}, "download_checksums": {"https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases/cord-19_2020-11-29.tar.gz": {"num_bytes": 6142360818, "checksum": "56df7c715beaf8b84435f91b27fd7c8d9d1f50c6d04804bcf490e541d19d1783"}}, "download_size": 6142360818, "post_processing_size": null, "dataset_size": 2759561943, "size_in_bytes": 8901922761}}
|
dummy/embeddings/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:504f112724947ded500b805b5a6f6cf51f032dbd82bf1d297707ea1c456f4f05
|
3 |
+
size 28939
|
dummy/fulltext/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a0aafc4301fc5a0ba540e627f91c5fdf44ef49261bd3c4ef077d342284e25ceb
|
3 |
+
size 19254
|
dummy/metadata/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:365a0ee7eef539a2f0048f9d8a14eaca87662528ae690fdced7428aa039a05ad
|
3 |
+
size 3578
|