Datasets:
Commit
•
e700b36
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.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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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
Ade_corpos_v2_classificaion:
|
14 |
+
- 10K<n<100K
|
15 |
+
Ade_corpos_v2_drug_ade_relation:
|
16 |
+
- 1K<n<10K
|
17 |
+
Ade_corpos_v2_drug_dosage_relation:
|
18 |
+
- n<1K
|
19 |
+
source_datasets:
|
20 |
+
- original
|
21 |
+
task_categories:
|
22 |
+
Ade_corpos_v2_classificaion:
|
23 |
+
- text-classification
|
24 |
+
Ade_corpos_v2_drug_ade_relation:
|
25 |
+
- structure-prediction
|
26 |
+
Ade_corpos_v2_drug_dosage_relation:
|
27 |
+
- structure-prediction
|
28 |
+
task_ids:
|
29 |
+
Ade_corpos_v2_classificaion:
|
30 |
+
- fact-checking
|
31 |
+
Ade_corpos_v2_drug_ade_relation:
|
32 |
+
- coreference-resolution
|
33 |
+
Ade_corpos_v2_drug_dosage_relation:
|
34 |
+
- coreference-resolution
|
35 |
+
---
|
36 |
+
|
37 |
+
# Dataset Card for [Needs More Information]
|
38 |
+
|
39 |
+
## Table of Contents
|
40 |
+
- [Dataset Card for [Needs More Information]](#dataset-card-for-needs-more-information)
|
41 |
+
- [Table of Contents](#table-of-contents)
|
42 |
+
- [Dataset Description](#dataset-description)
|
43 |
+
- [Dataset Summary](#dataset-summary)
|
44 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
45 |
+
- [Languages](#languages)
|
46 |
+
- [Dataset Structure](#dataset-structure)
|
47 |
+
- [Data Instances](#data-instances)
|
48 |
+
- [Data Fields](#data-fields)
|
49 |
+
- [Data Splits](#data-splits)
|
50 |
+
- [Dataset Creation](#dataset-creation)
|
51 |
+
- [Curation Rationale](#curation-rationale)
|
52 |
+
- [Source Data](#source-data)
|
53 |
+
- [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
|
54 |
+
- [Who are the source language producers?](#who-are-the-source-language-producers)
|
55 |
+
- [Annotations](#annotations)
|
56 |
+
- [Annotation process](#annotation-process)
|
57 |
+
- [Who are the annotators?](#who-are-the-annotators)
|
58 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
59 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
60 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
61 |
+
- [Discussion of Biases](#discussion-of-biases)
|
62 |
+
- [Other Known Limitations](#other-known-limitations)
|
63 |
+
- [Additional Information](#additional-information)
|
64 |
+
- [Dataset Curators](#dataset-curators)
|
65 |
+
- [Licensing Information](#licensing-information)
|
66 |
+
- [Citation Information](#citation-information)
|
67 |
+
|
68 |
+
## Dataset Description
|
69 |
+
|
70 |
+
- **Homepage:** https://www.sciencedirect.com/science/article/pii/S1532046412000615
|
71 |
+
- **Repository:** [Needs More Information]
|
72 |
+
- **Paper:** https://www.sciencedirect.com/science/article/pii/S1532046412000615
|
73 |
+
- **Leaderboard:** [Needs More Information]
|
74 |
+
- **Point of Contact:** [Needs More Information]
|
75 |
+
|
76 |
+
### Dataset Summary
|
77 |
+
|
78 |
+
ADE-Corpus-V2 Dataset: Adverse Drug Reaction Data.
|
79 |
+
This is a dataset for Classification if a sentence is ADE-related (True) or not (False) and Relation Extraction between Adverse Drug Event and Drug.
|
80 |
+
DRUG-AE.rel provides relations between drugs and adverse effects.
|
81 |
+
DRUG-DOSE.rel provides relations between drugs and dosages.
|
82 |
+
ADE-NEG.txt provides all sentences in the ADE corpus that DO NOT contain any drug-related adverse effects.
|
83 |
+
|
84 |
+
### Supported Tasks and Leaderboards
|
85 |
+
|
86 |
+
Sentiment classification, Relation Extraction
|
87 |
+
|
88 |
+
### Languages
|
89 |
+
|
90 |
+
English
|
91 |
+
|
92 |
+
## Dataset Structure
|
93 |
+
|
94 |
+
### Data Instances
|
95 |
+
|
96 |
+
#### Config - `Ade_corpos_v2_classificaion`
|
97 |
+
```
|
98 |
+
{
|
99 |
+
'label': 1,
|
100 |
+
'text': 'Intravenous azithromycin-induced ototoxicity.'
|
101 |
+
}
|
102 |
+
|
103 |
+
```
|
104 |
+
|
105 |
+
#### Config - `Ade_corpos_v2_drug_ade_relation`
|
106 |
+
|
107 |
+
```
|
108 |
+
{
|
109 |
+
'drug': 'azithromycin',
|
110 |
+
'effect': 'ototoxicity',
|
111 |
+
'indexes': {
|
112 |
+
'drug': {
|
113 |
+
'end_char': [24],
|
114 |
+
'start_char': [12]
|
115 |
+
},
|
116 |
+
'effect': {
|
117 |
+
'end_char': [44],
|
118 |
+
'start_char': [33]
|
119 |
+
}
|
120 |
+
},
|
121 |
+
'text': 'Intravenous azithromycin-induced ototoxicity.'
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
+
```
|
126 |
+
|
127 |
+
#### Config - `Ade_corpos_v2_drug_dosage_relation`
|
128 |
+
|
129 |
+
```
|
130 |
+
{
|
131 |
+
'dosage': '4 times per day',
|
132 |
+
'drug': 'insulin',
|
133 |
+
'indexes': {
|
134 |
+
'dosage': {
|
135 |
+
'end_char': [56],
|
136 |
+
'start_char': [41]
|
137 |
+
},
|
138 |
+
'drug': {
|
139 |
+
'end_char': [40],
|
140 |
+
'start_char': [33]}
|
141 |
+
},
|
142 |
+
'text': 'She continued to receive regular insulin 4 times per day over the following 3 years with only occasional hives.'
|
143 |
+
}
|
144 |
+
|
145 |
+
```
|
146 |
+
|
147 |
+
|
148 |
+
### Data Fields
|
149 |
+
|
150 |
+
#### Config - `Ade_corpos_v2_drug_ade_relation`
|
151 |
+
|
152 |
+
- `text` - Input text.
|
153 |
+
- `label` - Whether the adverse drug effect(ADE) related (1) or not (0).
|
154 |
+
-
|
155 |
+
#### Config - `Ade_corpos_v2_drug_ade_relation`
|
156 |
+
|
157 |
+
- `text` - Input text.
|
158 |
+
- `drug` - Name of drug.
|
159 |
+
- `effect` - Effect caused by the drug.
|
160 |
+
- `indexes.drug.start_char` - Start index of `drug` string in text.
|
161 |
+
- `indexes.drug.end_char` - End index of `drug` string in text.
|
162 |
+
- `indexes.effect.start_char` - Start index of `effect` string in text.
|
163 |
+
- `indexes.effect.end_char` - End index of `effect` string in text.
|
164 |
+
|
165 |
+
#### Config - `Ade_corpos_v2_drug_dosage_relation`
|
166 |
+
|
167 |
+
- `text` - Input text.
|
168 |
+
- `drug` - Name of drug.
|
169 |
+
- `dosage` - Dosage of the drug.
|
170 |
+
- `indexes.drug.start_char` - Start index of `drug` string in text.
|
171 |
+
- `indexes.drug.end_char` - End index of `drug` string in text.
|
172 |
+
- `indexes.dosage.start_char` - Start index of `dosage` string in text.
|
173 |
+
- `indexes.dosage.end_char` - End index of `dosage` string in text.
|
174 |
+
|
175 |
+
|
176 |
+
### Data Splits
|
177 |
+
|
178 |
+
| Train |
|
179 |
+
| ------ |
|
180 |
+
| 23516 |
|
181 |
+
|
182 |
+
## Dataset Creation
|
183 |
+
|
184 |
+
### Curation Rationale
|
185 |
+
|
186 |
+
[Needs More Information]
|
187 |
+
|
188 |
+
### Source Data
|
189 |
+
|
190 |
+
#### Initial Data Collection and Normalization
|
191 |
+
|
192 |
+
[Needs More Information]
|
193 |
+
|
194 |
+
#### Who are the source language producers?
|
195 |
+
|
196 |
+
[Needs More Information]
|
197 |
+
|
198 |
+
### Annotations
|
199 |
+
|
200 |
+
#### Annotation process
|
201 |
+
|
202 |
+
[Needs More Information]
|
203 |
+
|
204 |
+
#### Who are the annotators?
|
205 |
+
|
206 |
+
[Needs More Information]
|
207 |
+
|
208 |
+
### Personal and Sensitive Information
|
209 |
+
|
210 |
+
[Needs More Information]
|
211 |
+
|
212 |
+
## Considerations for Using the Data
|
213 |
+
|
214 |
+
### Social Impact of Dataset
|
215 |
+
|
216 |
+
[Needs More Information]
|
217 |
+
|
218 |
+
### Discussion of Biases
|
219 |
+
|
220 |
+
[Needs More Information]
|
221 |
+
|
222 |
+
### Other Known Limitations
|
223 |
+
|
224 |
+
[Needs More Information]
|
225 |
+
|
226 |
+
## Additional Information
|
227 |
+
|
228 |
+
### Dataset Curators
|
229 |
+
|
230 |
+
[Needs More Information]
|
231 |
+
|
232 |
+
### Licensing Information
|
233 |
+
|
234 |
+
[Needs More Information]
|
235 |
+
|
236 |
+
### Citation Information
|
237 |
+
|
238 |
+
```
|
239 |
+
@article{GURULINGAPPA2012885,
|
240 |
+
title = "Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reports",
|
241 |
+
journal = "Journal of Biomedical Informatics",
|
242 |
+
volume = "45",
|
243 |
+
number = "5",
|
244 |
+
pages = "885 - 892",
|
245 |
+
year = "2012",
|
246 |
+
note = "Text Mining and Natural Language Processing in Pharmacogenomics",
|
247 |
+
issn = "1532-0464",
|
248 |
+
doi = "https://doi.org/10.1016/j.jbi.2012.04.008",
|
249 |
+
url = "http://www.sciencedirect.com/science/article/pii/S1532046412000615",
|
250 |
+
author = "Harsha Gurulingappa and Abdul Mateen Rajput and Angus Roberts and Juliane Fluck and Martin Hofmann-Apitius and Luca Toldo",
|
251 |
+
keywords = "Adverse drug effect, Benchmark corpus, Annotation, Harmonization, Sentence classification",
|
252 |
+
abstract = "A significant amount of information about drug-related safety issues such as adverse effects are published in medical case reports that can only be explored by human readers due to their unstructured nature. The work presented here aims at generating a systematically annotated corpus that can support the development and validation of methods for the automatic extraction of drug-related adverse effects from medical case reports. The documents are systematically double annotated in various rounds to ensure consistent annotations. The annotated documents are finally harmonized to generate representative consensus annotations. In order to demonstrate an example use case scenario, the corpus was employed to train and validate models for the classification of informative against the non-informative sentences. A Maximum Entropy classifier trained with simple features and evaluated by 10-fold cross-validation resulted in the F1 score of 0.70 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
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 |
+
# Lint as: python3
|
17 |
+
|
18 |
+
""" Adverse Drug Reaction Data: ADE-Corpus-V2 """
|
19 |
+
|
20 |
+
from __future__ import absolute_import, division, print_function
|
21 |
+
|
22 |
+
import re
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
_CITATION = """\
|
28 |
+
@article{GURULINGAPPA2012885,
|
29 |
+
title = "Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reports",
|
30 |
+
journal = "Journal of Biomedical Informatics",
|
31 |
+
volume = "45",
|
32 |
+
number = "5",
|
33 |
+
pages = "885 - 892",
|
34 |
+
year = "2012",
|
35 |
+
note = "Text Mining and Natural Language Processing in Pharmacogenomics",
|
36 |
+
issn = "1532-0464",
|
37 |
+
doi = "https://doi.org/10.1016/j.jbi.2012.04.008",
|
38 |
+
url = "http://www.sciencedirect.com/science/article/pii/S1532046412000615",
|
39 |
+
author = "Harsha Gurulingappa and Abdul Mateen Rajput and Angus Roberts and Juliane Fluck and Martin Hofmann-Apitius and Luca Toldo",
|
40 |
+
keywords = "Adverse drug effect, Benchmark corpus, Annotation, Harmonization, Sentence classification",
|
41 |
+
abstract = "A significant amount of information about drug-related safety issues such as adverse effects are published in medical case reports that can only be explored by human readers due to their unstructured nature. The work presented here aims at generating a systematically annotated corpus that can support the development and validation of methods for the automatic extraction of drug-related adverse effects from medical case reports. The documents are systematically double annotated in various rounds to ensure consistent annotations. The annotated documents are finally harmonized to generate representative consensus annotations. In order to demonstrate an example use case scenario, the corpus was employed to train and validate models for the classification of informative against the non-informative sentences. A Maximum Entropy classifier trained with simple features and evaluated by 10-fold cross-validation resulted in the F1 score of 0.70 indicating a potential useful application of the corpus."
|
42 |
+
}
|
43 |
+
"""
|
44 |
+
|
45 |
+
_DESCRIPTION = """\
|
46 |
+
ADE-Corpus-V2 Dataset: Adverse Drug Reaction Data.
|
47 |
+
This is a dataset for Classification if a sentence is ADE-related (True) or not (False) and Relation Extraction between Adverse Drug Event and Drug.
|
48 |
+
DRUG-AE.rel provides relations between drugs and adverse effects.
|
49 |
+
DRUG-DOSE.rel provides relations between drugs and dosages.
|
50 |
+
ADE-NEG.txt provides all sentences in the ADE corpus that DO NOT contain any drug-related adverse effects.
|
51 |
+
"""
|
52 |
+
|
53 |
+
_DOWNLOAD_URL = "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/{}-{}.{}"
|
54 |
+
|
55 |
+
# Different usage configs/
|
56 |
+
configs = {
|
57 |
+
"classification": "Ade_corpos_v2_classificaion",
|
58 |
+
"RE_ade": "Ade_corpos_v2_drug_ade_relation",
|
59 |
+
"RE_dosage": "Ade_corpos_v2_drug_dosage_relation",
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
class ADE_Corpus_V2Config(datasets.BuilderConfig):
|
64 |
+
"""BuilderConfig for ADE_Corpus_V2."""
|
65 |
+
|
66 |
+
def __init__(self, **kwargs):
|
67 |
+
"""BuilderConfig for ADE_Corpus_V2.
|
68 |
+
Args:
|
69 |
+
**kwargs: keyword arguments forwarded to super.
|
70 |
+
"""
|
71 |
+
super(ADE_Corpus_V2Config, self).__init__(**kwargs)
|
72 |
+
|
73 |
+
|
74 |
+
class ADECorpusV2(datasets.GeneratorBasedBuilder):
|
75 |
+
"""ADE_Corpus_V2 Dataset: Adverse Drug Reaction Data for Classification and Relation Extraction tasks ."""
|
76 |
+
|
77 |
+
BUILDER_CONFIGS = [
|
78 |
+
ADE_Corpus_V2Config(
|
79 |
+
name="Ade_corpos_v2_classificaion",
|
80 |
+
version=datasets.Version("1.0.0"),
|
81 |
+
description="ADE_Corpus_V2 Dataset for Classification if a sentence is ADE-related or not.",
|
82 |
+
),
|
83 |
+
ADE_Corpus_V2Config(
|
84 |
+
name="Ade_corpos_v2_drug_ade_relation",
|
85 |
+
version=datasets.Version("1.0.0"),
|
86 |
+
description="ADE_Corpus_V2 Dataset for Relation Extraction between Adverse Drug Event and Drug.",
|
87 |
+
),
|
88 |
+
ADE_Corpus_V2Config(
|
89 |
+
name="Ade_corpos_v2_drug_dosage_relation",
|
90 |
+
version=datasets.Version("1.0.0"),
|
91 |
+
description="ADE_Corpus_V2 Dataset for Relation Extraction between Drug dosage and Drug.",
|
92 |
+
),
|
93 |
+
]
|
94 |
+
|
95 |
+
def _info(self):
|
96 |
+
|
97 |
+
if self.config.name == configs["classification"]:
|
98 |
+
features = datasets.Features(
|
99 |
+
{
|
100 |
+
"text": datasets.Value("string"),
|
101 |
+
"label": datasets.features.ClassLabel(names=["Not-Related", "Related"]),
|
102 |
+
}
|
103 |
+
)
|
104 |
+
|
105 |
+
if self.config.name == configs["RE_ade"]:
|
106 |
+
features = datasets.Features(
|
107 |
+
{
|
108 |
+
"text": datasets.Value("string"),
|
109 |
+
"drug": datasets.Value("string"),
|
110 |
+
"effect": datasets.Value("string"),
|
111 |
+
"indexes": {
|
112 |
+
"drug": datasets.Sequence(
|
113 |
+
{
|
114 |
+
"start_char": datasets.Value("int32"),
|
115 |
+
"end_char": datasets.Value("int32"),
|
116 |
+
}
|
117 |
+
),
|
118 |
+
"effect": datasets.Sequence(
|
119 |
+
{
|
120 |
+
"start_char": datasets.Value("int32"),
|
121 |
+
"end_char": datasets.Value("int32"),
|
122 |
+
}
|
123 |
+
),
|
124 |
+
},
|
125 |
+
}
|
126 |
+
)
|
127 |
+
|
128 |
+
if self.config.name == configs["RE_dosage"]:
|
129 |
+
features = datasets.Features(
|
130 |
+
{
|
131 |
+
"text": datasets.Value("string"),
|
132 |
+
"drug": datasets.Value("string"),
|
133 |
+
"dosage": datasets.Value("string"),
|
134 |
+
"indexes": {
|
135 |
+
"drug": datasets.Sequence(
|
136 |
+
{
|
137 |
+
"start_char": datasets.Value("int32"),
|
138 |
+
"end_char": datasets.Value("int32"),
|
139 |
+
}
|
140 |
+
),
|
141 |
+
"dosage": datasets.Sequence(
|
142 |
+
{
|
143 |
+
"start_char": datasets.Value("int32"),
|
144 |
+
"end_char": datasets.Value("int32"),
|
145 |
+
}
|
146 |
+
),
|
147 |
+
},
|
148 |
+
}
|
149 |
+
)
|
150 |
+
|
151 |
+
return datasets.DatasetInfo(
|
152 |
+
description=_DESCRIPTION,
|
153 |
+
features=features,
|
154 |
+
supervised_keys=None,
|
155 |
+
homepage="https://www.sciencedirect.com/science/article/pii/S1532046412000615",
|
156 |
+
citation=_CITATION,
|
157 |
+
)
|
158 |
+
|
159 |
+
def _split_generators(self, dl_manager):
|
160 |
+
"""Returns SplitGenerators."""
|
161 |
+
|
162 |
+
DAE_path = dl_manager.download_and_extract(_DOWNLOAD_URL.format("DRUG", "AE", "rel"))
|
163 |
+
DD_path = dl_manager.download_and_extract(_DOWNLOAD_URL.format("DRUG", "DOSE", "rel"))
|
164 |
+
DAE_NEG_path = dl_manager.download_and_extract(_DOWNLOAD_URL.format("ADE", "NEG", "txt"))
|
165 |
+
|
166 |
+
return [
|
167 |
+
datasets.SplitGenerator(
|
168 |
+
name=datasets.Split.TRAIN,
|
169 |
+
gen_kwargs={"DRUG_AE_file": DAE_path, "DRUG_DOSAGE_file": DD_path, "NEG_DRUG_AE_file": DAE_NEG_path},
|
170 |
+
),
|
171 |
+
]
|
172 |
+
|
173 |
+
def _generate_examples(self, DRUG_AE_file, DRUG_DOSAGE_file, NEG_DRUG_AE_file):
|
174 |
+
"""Generate ADE_Corpus_V2 examples."""
|
175 |
+
|
176 |
+
# For Classification task with ade dataset.
|
177 |
+
if self.config.name == configs["classification"]:
|
178 |
+
texts, labels = [], []
|
179 |
+
with open(DRUG_AE_file, encoding="utf-8") as f:
|
180 |
+
for line in f:
|
181 |
+
pubmed_id, text = line.strip().split("|")[:2]
|
182 |
+
texts.append(text)
|
183 |
+
labels.append("Related")
|
184 |
+
|
185 |
+
with open(NEG_DRUG_AE_file, encoding="utf-8") as f:
|
186 |
+
for line in f:
|
187 |
+
pubmed_id, neg = line.strip().split(" ")[:2]
|
188 |
+
text = " ".join(line.strip().split(" ")[2:])
|
189 |
+
texts.append(text)
|
190 |
+
labels.append("Not-Related")
|
191 |
+
|
192 |
+
for i in range(len(labels)):
|
193 |
+
text, label = texts[i], labels[i]
|
194 |
+
yield i, {"text": text, "label": label}
|
195 |
+
|
196 |
+
# For Relation Extraction between drug and its effect.
|
197 |
+
elif self.config.name == configs["RE_ade"]:
|
198 |
+
|
199 |
+
texts, drugs, effects, drug_indexes, effect_indexes = [], [], [], [], []
|
200 |
+
with open(DRUG_AE_file, encoding="utf-8") as f:
|
201 |
+
for line in f:
|
202 |
+
value = line.strip().split("|")
|
203 |
+
text = value[1]
|
204 |
+
effect = value[2]
|
205 |
+
drug = value[5]
|
206 |
+
|
207 |
+
# add index of drug and effect from text
|
208 |
+
effect_matches, drug_matches = [], []
|
209 |
+
for match in re.finditer(effect, text):
|
210 |
+
effect_matches.append({"start_char": match.start(), "end_char": match.end()})
|
211 |
+
effect_indexes.append(effect_matches)
|
212 |
+
|
213 |
+
for match in re.finditer(drug, text):
|
214 |
+
drug_matches.append({"start_char": match.start(), "end_char": match.end()})
|
215 |
+
drug_indexes.append(drug_matches)
|
216 |
+
|
217 |
+
texts.append(text)
|
218 |
+
drugs.append(drug)
|
219 |
+
effects.append(effect)
|
220 |
+
|
221 |
+
for idx, (text, drug, effect, drug_index, effect_index) in enumerate(
|
222 |
+
zip(texts, drugs, effects, drug_indexes, effect_indexes)
|
223 |
+
):
|
224 |
+
|
225 |
+
output = {
|
226 |
+
"text": text,
|
227 |
+
"drug": drug,
|
228 |
+
"effect": effect,
|
229 |
+
"indexes": {"drug": drug_index, "effect": effect_index},
|
230 |
+
}
|
231 |
+
|
232 |
+
yield idx, output
|
233 |
+
|
234 |
+
# For Relation Extraction between drug and its dosage.
|
235 |
+
elif self.config.name == configs["RE_dosage"]:
|
236 |
+
|
237 |
+
texts, drugs, dosages, drug_indexes, dosage_indexes = [], [], [], [], []
|
238 |
+
with open(DRUG_DOSAGE_file, encoding="utf-8") as f:
|
239 |
+
for line in f:
|
240 |
+
value = line.strip().split("|")
|
241 |
+
text = value[1]
|
242 |
+
dosage = value[2]
|
243 |
+
drug = value[5]
|
244 |
+
|
245 |
+
# add index of drug and effect from text
|
246 |
+
dosage_matches, drug_matches = [], []
|
247 |
+
for match in re.finditer(dosage, text):
|
248 |
+
dosage_matches.append({"start_char": match.start(), "end_char": match.end()})
|
249 |
+
dosage_indexes.append(dosage_matches)
|
250 |
+
|
251 |
+
for match in re.finditer(drug, text):
|
252 |
+
drug_matches.append({"start_char": match.start(), "end_char": match.end()})
|
253 |
+
drug_indexes.append(drug_matches)
|
254 |
+
|
255 |
+
texts.append(text)
|
256 |
+
drugs.append(drug)
|
257 |
+
dosages.append(dosage)
|
258 |
+
|
259 |
+
for idx, (text, drug, dosage, drug_index, dosage_index) in enumerate(
|
260 |
+
zip(texts, drugs, dosages, drug_indexes, dosage_indexes)
|
261 |
+
):
|
262 |
+
output = {
|
263 |
+
"text": text,
|
264 |
+
"drug": drug,
|
265 |
+
"dosage": dosage,
|
266 |
+
"indexes": {"drug": drug_index, "dosage": dosage_index},
|
267 |
+
}
|
268 |
+
yield idx, output
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"Ade_corpos_v2_classificaion": {"description": " ADE-Corpus-V2 Dataset: Adverse Drug Reaction Data.\n This is a dataset for Classification if a sentence is ADE-related (True) or not (False) and Relation Extraction between Adverse Drug Event and Drug.\n DRUG-AE.rel provides relations between drugs and adverse effects.\n DRUG-DOSE.rel provides relations between drugs and dosages.\n ADE-NEG.txt provides all sentences in the ADE corpus that DO NOT contain any drug-related adverse effects.\n", "citation": "@article{GURULINGAPPA2012885,\ntitle = \"Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reports\",\njournal = \"Journal of Biomedical Informatics\",\nvolume = \"45\",\nnumber = \"5\",\npages = \"885 - 892\",\nyear = \"2012\",\nnote = \"Text Mining and Natural Language Processing in Pharmacogenomics\",\nissn = \"1532-0464\",\ndoi = \"https://doi.org/10.1016/j.jbi.2012.04.008\",\nurl = \"http://www.sciencedirect.com/science/article/pii/S1532046412000615\",\nauthor = \"Harsha Gurulingappa and Abdul Mateen Rajput and Angus Roberts and Juliane Fluck and Martin Hofmann-Apitius and Luca Toldo\",\nkeywords = \"Adverse drug effect, Benchmark corpus, Annotation, Harmonization, Sentence classification\",\nabstract = \"A significant amount of information about drug-related safety issues such as adverse effects are published in medical case reports that can only be explored by human readers due to their unstructured nature. The work presented here aims at generating a systematically annotated corpus that can support the development and validation of methods for the automatic extraction of drug-related adverse effects from medical case reports. The documents are systematically double annotated in various rounds to ensure consistent annotations. The annotated documents are finally harmonized to generate representative consensus annotations. In order to demonstrate an example use case scenario, the corpus was employed to train and validate models for the classification of informative against the non-informative sentences. A Maximum Entropy classifier trained with simple features and evaluated by 10-fold cross-validation resulted in the F1 score of 0.70 indicating a potential useful application of the corpus.\"\n}\n", "homepage": "https://www.sciencedirect.com/science/article/pii/S1532046412000615", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["Not-Related", "Related"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "ade_corpus_v2", "config_name": "Ade_corpos_v2_classificaion", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3403711, "num_examples": 23516, "dataset_name": "ade_corpus_v2"}}, "download_checksums": {"https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/DRUG-AE.rel": {"num_bytes": 1423024, "checksum": "542cdc483ccc94927762eaf2c9a8ecac49a6c10037dda2895be6a6e20160f75a"}, "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/DRUG-DOSE.rel": {"num_bytes": 59669, "checksum": "78b46dfcdc1325d7f81e5e01f5a424e380e4b38fafca02f6e8f67064ca73f2db"}, "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/ADE-NEG.txt": {"num_bytes": 2308469, "checksum": "8f506c159042ce354fbf26981dc39971dde8f09b1158d94106eab1e516e53fcf"}}, "download_size": 3791162, "post_processing_size": null, "dataset_size": 3403711, "size_in_bytes": 7194873}, "Ade_corpos_v2_drug_ade_relation": {"description": " ADE-Corpus-V2 Dataset: Adverse Drug Reaction Data.\n This is a dataset for Classification if a sentence is ADE-related (True) or not (False) and Relation Extraction between Adverse Drug Event and Drug.\n DRUG-AE.rel provides relations between drugs and adverse effects.\n DRUG-DOSE.rel provides relations between drugs and dosages.\n ADE-NEG.txt provides all sentences in the ADE corpus that DO NOT contain any drug-related adverse effects.\n", "citation": "@article{GURULINGAPPA2012885,\ntitle = \"Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reports\",\njournal = \"Journal of Biomedical Informatics\",\nvolume = \"45\",\nnumber = \"5\",\npages = \"885 - 892\",\nyear = \"2012\",\nnote = \"Text Mining and Natural Language Processing in Pharmacogenomics\",\nissn = \"1532-0464\",\ndoi = \"https://doi.org/10.1016/j.jbi.2012.04.008\",\nurl = \"http://www.sciencedirect.com/science/article/pii/S1532046412000615\",\nauthor = \"Harsha Gurulingappa and Abdul Mateen Rajput and Angus Roberts and Juliane Fluck and Martin Hofmann-Apitius and Luca Toldo\",\nkeywords = \"Adverse drug effect, Benchmark corpus, Annotation, Harmonization, Sentence classification\",\nabstract = \"A significant amount of information about drug-related safety issues such as adverse effects are published in medical case reports that can only be explored by human readers due to their unstructured nature. The work presented here aims at generating a systematically annotated corpus that can support the development and validation of methods for the automatic extraction of drug-related adverse effects from medical case reports. The documents are systematically double annotated in various rounds to ensure consistent annotations. The annotated documents are finally harmonized to generate representative consensus annotations. In order to demonstrate an example use case scenario, the corpus was employed to train and validate models for the classification of informative against the non-informative sentences. A Maximum Entropy classifier trained with simple features and evaluated by 10-fold cross-validation resulted in the F1 score of 0.70 indicating a potential useful application of the corpus.\"\n}\n", "homepage": "https://www.sciencedirect.com/science/article/pii/S1532046412000615", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "drug": {"dtype": "string", "id": null, "_type": "Value"}, "effect": {"dtype": "string", "id": null, "_type": "Value"}, "indexes": {"drug": {"feature": {"start_char": {"dtype": "int32", "id": null, "_type": "Value"}, "end_char": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "effect": {"feature": {"start_char": {"dtype": "int32", "id": null, "_type": "Value"}, "end_char": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}}, "post_processed": null, "supervised_keys": null, "builder_name": "ade_corpus_v2", "config_name": "Ade_corpos_v2_drug_ade_relation", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1546021, "num_examples": 6821, "dataset_name": "ade_corpus_v2"}}, "download_checksums": {"https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/DRUG-AE.rel": {"num_bytes": 1423024, "checksum": "542cdc483ccc94927762eaf2c9a8ecac49a6c10037dda2895be6a6e20160f75a"}, "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/DRUG-DOSE.rel": {"num_bytes": 59669, "checksum": "78b46dfcdc1325d7f81e5e01f5a424e380e4b38fafca02f6e8f67064ca73f2db"}, "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/ADE-NEG.txt": {"num_bytes": 2308469, "checksum": "8f506c159042ce354fbf26981dc39971dde8f09b1158d94106eab1e516e53fcf"}}, "download_size": 3791162, "post_processing_size": null, "dataset_size": 1546021, "size_in_bytes": 5337183}, "Ade_corpos_v2_drug_dosage_relation": {"description": " ADE-Corpus-V2 Dataset: Adverse Drug Reaction Data.\n This is a dataset for Classification if a sentence is ADE-related (True) or not (False) and Relation Extraction between Adverse Drug Event and Drug.\n DRUG-AE.rel provides relations between drugs and adverse effects.\n DRUG-DOSE.rel provides relations between drugs and dosages.\n ADE-NEG.txt provides all sentences in the ADE corpus that DO NOT contain any drug-related adverse effects.\n", "citation": "@article{GURULINGAPPA2012885,\ntitle = \"Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reports\",\njournal = \"Journal of Biomedical Informatics\",\nvolume = \"45\",\nnumber = \"5\",\npages = \"885 - 892\",\nyear = \"2012\",\nnote = \"Text Mining and Natural Language Processing in Pharmacogenomics\",\nissn = \"1532-0464\",\ndoi = \"https://doi.org/10.1016/j.jbi.2012.04.008\",\nurl = \"http://www.sciencedirect.com/science/article/pii/S1532046412000615\",\nauthor = \"Harsha Gurulingappa and Abdul Mateen Rajput and Angus Roberts and Juliane Fluck and Martin Hofmann-Apitius and Luca Toldo\",\nkeywords = \"Adverse drug effect, Benchmark corpus, Annotation, Harmonization, Sentence classification\",\nabstract = \"A significant amount of information about drug-related safety issues such as adverse effects are published in medical case reports that can only be explored by human readers due to their unstructured nature. The work presented here aims at generating a systematically annotated corpus that can support the development and validation of methods for the automatic extraction of drug-related adverse effects from medical case reports. The documents are systematically double annotated in various rounds to ensure consistent annotations. The annotated documents are finally harmonized to generate representative consensus annotations. In order to demonstrate an example use case scenario, the corpus was employed to train and validate models for the classification of informative against the non-informative sentences. A Maximum Entropy classifier trained with simple features and evaluated by 10-fold cross-validation resulted in the F1 score of 0.70 indicating a potential useful application of the corpus.\"\n}\n", "homepage": "https://www.sciencedirect.com/science/article/pii/S1532046412000615", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "drug": {"dtype": "string", "id": null, "_type": "Value"}, "dosage": {"dtype": "string", "id": null, "_type": "Value"}, "indexes": {"drug": {"feature": {"start_char": {"dtype": "int32", "id": null, "_type": "Value"}, "end_char": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "dosage": {"feature": {"start_char": {"dtype": "int32", "id": null, "_type": "Value"}, "end_char": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}}, "post_processed": null, "supervised_keys": null, "builder_name": "ade_corpus_v2", "config_name": "Ade_corpos_v2_drug_dosage_relation", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 64725, "num_examples": 279, "dataset_name": "ade_corpus_v2"}}, "download_checksums": {"https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/DRUG-AE.rel": {"num_bytes": 1423024, "checksum": "542cdc483ccc94927762eaf2c9a8ecac49a6c10037dda2895be6a6e20160f75a"}, "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/DRUG-DOSE.rel": {"num_bytes": 59669, "checksum": "78b46dfcdc1325d7f81e5e01f5a424e380e4b38fafca02f6e8f67064ca73f2db"}, "https://raw.githubusercontent.com/trunghlt/AdverseDrugReaction/master/ADE-Corpus-V2/ADE-NEG.txt": {"num_bytes": 2308469, "checksum": "8f506c159042ce354fbf26981dc39971dde8f09b1158d94106eab1e516e53fcf"}}, "download_size": 3791162, "post_processing_size": null, "dataset_size": 64725, "size_in_bytes": 3855887}}
|
dummy/Ade_corpos_v2_classificaion/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36c086aede182ee2bdef54b207142b8d8c8eb0b774c4e6f5019a7b27ee1f8d88
|
3 |
+
size 1895
|
dummy/Ade_corpos_v2_drug_ade_relation/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b466530fc6122183765f162dae41d5672c811b3079c02862c665ca2209bda703
|
3 |
+
size 1895
|
dummy/Ade_corpos_v2_drug_dosage_relation/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d6613df8eca9c7c0de5e5347e645120d1ce4f072ee2dd992eadabc20ff9dbe47
|
3 |
+
size 1895
|