Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
1K<n<10K
Language Creators:
expert-generated
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
License:
system HF staff commited on
Commit
d299198
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release 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=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,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - expert-generated
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - text-retrieval
18
+ task_ids:
19
+ - fact-checking-retrieval
20
+ ---
21
+ # Dataset Card Creation Guide
22
+
23
+ ## Table of Contents
24
+ - [Dataset Description](#dataset-description)
25
+ - [Dataset Summary](#dataset-summary)
26
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
27
+ - [Languages](#languages)
28
+ - [Dataset Structure](#dataset-structure)
29
+ - [Data Instances](#data-instances)
30
+ - [Data Fields](#data-instances)
31
+ - [Data Splits](#data-instances)
32
+ - [Dataset Creation](#dataset-creation)
33
+ - [Curation Rationale](#curation-rationale)
34
+ - [Source Data](#source-data)
35
+ - [Annotations](#annotations)
36
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
37
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
38
+ - [Social Impact of Dataset](#social-impact-of-dataset)
39
+ - [Discussion of Biases](#discussion-of-biases)
40
+ - [Other Known Limitations](#other-known-limitations)
41
+ - [Additional Information](#additional-information)
42
+ - [Dataset Curators](#dataset-curators)
43
+ - [Licensing Information](#licensing-information)
44
+ - [Citation Information](#citation-information)
45
+
46
+ ## Dataset Description
47
+
48
+ - **Homepage:** []()
49
+ - **Repository:** [link]()
50
+ - **Paper:** []()
51
+ - **Leaderboard:** []()
52
+ - **Point of Contact:** []()
53
+
54
+ ### Dataset Summary
55
+
56
+ Data and code from our "Inferring Which Medical Treatments Work from Reports of Clinical Trials", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.
57
+
58
+ The dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.
59
+
60
+ The dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.
61
+
62
+ ### Supported Tasks and Leaderboards
63
+
64
+ [More Information Needed]
65
+
66
+ ### Languages
67
+
68
+ [More Information Needed]
69
+
70
+ ## Dataset Structure
71
+
72
+ [More Information Needed]
73
+
74
+ ### Data Instances
75
+
76
+ [More Information Needed]
77
+
78
+ ### Data Fields
79
+
80
+ [More Information Needed]
81
+
82
+ ### Data Splits
83
+
84
+ [More Information Needed]
85
+
86
+ ## Dataset Creation
87
+
88
+
89
+ ### Curation Rationale
90
+
91
+ [More Information Needed]
92
+
93
+ ### Source Data
94
+
95
+ [More Information Needed]
96
+
97
+ #### Initial Data Collection and Normalization
98
+
99
+ [More Information Needed]
100
+
101
+ #### Who are the source language producers?
102
+
103
+ [More Information Needed]
104
+
105
+ ### Annotations
106
+
107
+ [More Information Needed]
108
+
109
+ #### Annotation process
110
+
111
+ [More Information Needed]
112
+
113
+ #### Who are the annotators?
114
+
115
+ [More Information Needed]
116
+
117
+ ### Personal and Sensitive Information
118
+
119
+ [More Information Needed]
120
+
121
+ ## Considerations for Using the Data
122
+
123
+ ### Social Impact of Dataset
124
+
125
+ [More Information Needed]
126
+
127
+ ### Discussion of Biases
128
+
129
+ [More Information Needed]
130
+
131
+ ### Other Known Limitations
132
+
133
+ [More Information Needed]
134
+
135
+ ## Additional Information
136
+
137
+ ### Dataset Curators
138
+
139
+ [More Information Needed]
140
+
141
+ ### Licensing Information
142
+
143
+ [More Information Needed]
144
+
145
+ ### Citation Information
146
+
147
+ ```
148
+ @inproceedings{lehman-etal-2019-inferring,
149
+ title = "Inferring Which Medical Treatments Work from Reports of Clinical Trials",
150
+ author = "Lehman, Eric and
151
+ DeYoung, Jay and
152
+ Barzilay, Regina and
153
+ Wallace, Byron C.",
154
+ booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)",
155
+ month = jun,
156
+ year = "2019",
157
+ address = "Minneapolis, Minnesota",
158
+ publisher = "Association for Computational Linguistics",
159
+ url = "https://www.aclweb.org/anthology/N19-1371",
160
+ pages = "3705--3717",
161
+ }
162
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"2.0": {"description": "Data and code from our \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.\n\nThe dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.\n\nThe dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.\n", "citation": "@inproceedings{lehman-etal-2019-inferring,\n title = \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\",\n author = \"Lehman, Eric and\n DeYoung, Jay and\n Barzilay, Regina and\n Wallace, Byron C.\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/N19-1371\",\n pages = \"3705--3717\",\n}\n", "homepage": "https://github.com/jayded/evidence-inference", "license": "", "features": {"Text": {"dtype": "string", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Prompts": {"feature": {"PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Outcome": {"dtype": "string", "id": null, "_type": "Value"}, "Intervention": {"dtype": "string", "id": null, "_type": "Value"}, "Comparator": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"feature": {"UserID": {"dtype": "int32", "id": null, "_type": "Value"}, "PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Valid Label": {"dtype": "bool", "id": null, "_type": "Value"}, "Valid Reasoning": {"dtype": "bool", "id": null, "_type": "Value"}, "Label": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"dtype": "string", "id": null, "_type": "Value"}, "Label Code": {"dtype": "int32", "id": null, "_type": "Value"}, "In Abstract": {"dtype": "bool", "id": null, "_type": "Value"}, "Evidence Start": {"dtype": "int32", "id": null, "_type": "Value"}, "Evidence End": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "evidence_infer_treatment", "config_name": "2.0", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 76408584, "num_examples": 2674, "dataset_name": "evidence_infer_treatment"}, "test": {"name": "test", "num_bytes": 9408156, "num_examples": 334, "dataset_name": "evidence_infer_treatment"}, "validation": {"name": "validation", "num_bytes": 10085622, "num_examples": 340, "dataset_name": "evidence_infer_treatment"}}, "download_checksums": {"http://evidence-inference.ebm-nlp.com/v2.0.tar.gz": {"num_bytes": 36528800, "checksum": "6abe0d4ec0d331834981c0171c3c79d47515761867f82f1dc6066e43863a1586"}}, "download_size": 36528800, "post_processing_size": null, "dataset_size": 95902362, "size_in_bytes": 132431162}, "1.1": {"description": "Data and code from our \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.\n\nThe dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.\n\nThe dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.\n", "citation": "@inproceedings{lehman-etal-2019-inferring,\n title = \"Inferring Which Medical Treatments Work from Reports of Clinical Trials\",\n author = \"Lehman, Eric and\n DeYoung, Jay and\n Barzilay, Regina and\n Wallace, Byron C.\",\n booktitle = \"Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)\",\n month = jun,\n year = \"2019\",\n address = \"Minneapolis, Minnesota\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/N19-1371\",\n pages = \"3705--3717\",\n}\n", "homepage": "https://github.com/jayded/evidence-inference", "license": "", "features": {"Text": {"dtype": "string", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Prompts": {"feature": {"PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Outcome": {"dtype": "string", "id": null, "_type": "Value"}, "Intervention": {"dtype": "string", "id": null, "_type": "Value"}, "Comparator": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"feature": {"UserID": {"dtype": "int32", "id": null, "_type": "Value"}, "PromptID": {"dtype": "int32", "id": null, "_type": "Value"}, "PMCID": {"dtype": "int32", "id": null, "_type": "Value"}, "Valid Label": {"dtype": "bool", "id": null, "_type": "Value"}, "Valid Reasoning": {"dtype": "bool", "id": null, "_type": "Value"}, "Label": {"dtype": "string", "id": null, "_type": "Value"}, "Annotations": {"dtype": "string", "id": null, "_type": "Value"}, "Label Code": {"dtype": "int32", "id": null, "_type": "Value"}, "In Abstract": {"dtype": "bool", "id": null, "_type": "Value"}, "Evidence Start": {"dtype": "int32", "id": null, "_type": "Value"}, "Evidence End": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "evidence_infer_treatment", "config_name": "1.1", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 55361753, "num_examples": 1931, "dataset_name": "evidence_infer_treatment"}, "test": {"name": "test", "num_bytes": 6875650, "num_examples": 240, "dataset_name": "evidence_infer_treatment"}, "validation": {"name": "validation", "num_bytes": 7358118, "num_examples": 248, "dataset_name": "evidence_infer_treatment"}}, "download_checksums": {"https://github.com/jayded/evidence-inference/archive/v1.1.zip": {"num_bytes": 114452688, "checksum": "945a81cf40665cd797504728858da54dbb39e16a7785bda833f8d475a407a952"}}, "download_size": 114452688, "post_processing_size": null, "dataset_size": 69595521, "size_in_bytes": 184048209}}
dummy/1.1/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4d692b70198f66fdf9bd497357ac43a76e3bd2748d426ec1613ddcab246fc69
3
+ size 33694
dummy/2.0/2.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d95fc788dbe07daca46ab5eb304897dd8789bd39b843a235e4d8a1814961263c
3
+ size 32255
evidence_infer_treatment.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Inferring Which Medical Treatments Work from Reports of Clinical Trials"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import csv
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{lehman-etal-2019-inferring,
27
+ title = "Inferring Which Medical Treatments Work from Reports of Clinical Trials",
28
+ author = "Lehman, Eric and
29
+ DeYoung, Jay and
30
+ Barzilay, Regina and
31
+ Wallace, Byron C.",
32
+ booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)",
33
+ month = jun,
34
+ year = "2019",
35
+ address = "Minneapolis, Minnesota",
36
+ publisher = "Association for Computational Linguistics",
37
+ url = "https://www.aclweb.org/anthology/N19-1371",
38
+ pages = "3705--3717",
39
+ }
40
+ """
41
+
42
+ _DESCRIPTION = """\
43
+ Data and code from our "Inferring Which Medical Treatments Work from Reports of Clinical Trials", NAACL 2019. This work concerns inferring the results reported in clinical trials from text.
44
+
45
+ The dataset consists of biomedical articles describing randomized control trials (RCTs) that compare multiple treatments. Each of these articles will have multiple questions, or 'prompts' associated with them. These prompts will ask about the relationship between an intervention and comparator with respect to an outcome, as reported in the trial. For example, a prompt may ask about the reported effects of aspirin as compared to placebo on the duration of headaches. For the sake of this task, we assume that a particular article will report that the intervention of interest either significantly increased, significantly decreased or had significant effect on the outcome, relative to the comparator.
46
+
47
+ The dataset could be used for automatic data extraction of the results of a given RCT. This would enable readers to discover the effectiveness of different treatments without needing to read the paper.
48
+ """
49
+
50
+
51
+ class EvidenceInferenceConfig(datasets.BuilderConfig):
52
+ """ BuilderConfig for NewDataset"""
53
+
54
+ def __init__(self, zip_file, **kwargs):
55
+ """
56
+
57
+ Args:
58
+ zip_file: The location of zip file containing original data
59
+ **kwargs: keyword arguments forwarded to super.
60
+ """
61
+ self.zip_file = zip_file
62
+ super().__init__(**kwargs)
63
+
64
+
65
+ class EvidenceInferTreatment(datasets.GeneratorBasedBuilder):
66
+ f"""{_DESCRIPTION}"""
67
+
68
+ # This is an example of a dataset with multiple configurations.
69
+ # If you don't want/need to define several sub-sets in your dataset,
70
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
71
+ BUILDER_CONFIG_CLASS = EvidenceInferenceConfig
72
+ BUILDER_CONFIGS = [
73
+ EvidenceInferenceConfig(
74
+ name="2.0",
75
+ description="EvidenceInference V2",
76
+ version=datasets.Version("2.0.0"),
77
+ zip_file="http://evidence-inference.ebm-nlp.com/v2.0.tar.gz",
78
+ ),
79
+ EvidenceInferenceConfig(
80
+ name="1.1",
81
+ description="EvidenceInference V1.1",
82
+ version=datasets.Version("1.1.0"),
83
+ zip_file="https://github.com/jayded/evidence-inference/archive/v1.1.zip",
84
+ ),
85
+ ]
86
+
87
+ def _info(self):
88
+ features = datasets.Features(
89
+ {
90
+ "Text": datasets.Value("string"),
91
+ "PMCID": datasets.Value("int32"),
92
+ "Prompts": datasets.Sequence(
93
+ datasets.Features(
94
+ {
95
+ "PromptID": datasets.Value("int32"),
96
+ "PMCID": datasets.Value("int32"),
97
+ "Outcome": datasets.Value("string"),
98
+ "Intervention": datasets.Value("string"),
99
+ "Comparator": datasets.Value("string"),
100
+ "Annotations": datasets.Sequence(
101
+ datasets.Features(
102
+ {
103
+ "UserID": datasets.Value("int32"),
104
+ "PromptID": datasets.Value("int32"),
105
+ "PMCID": datasets.Value("int32"),
106
+ "Valid Label": datasets.Value("bool"),
107
+ "Valid Reasoning": datasets.Value("bool"),
108
+ "Label": datasets.Value("string"),
109
+ "Annotations": datasets.Value("string"),
110
+ "Label Code": datasets.Value("int32"),
111
+ "In Abstract": datasets.Value("bool"),
112
+ "Evidence Start": datasets.Value("int32"),
113
+ "Evidence End": datasets.Value("int32"),
114
+ }
115
+ )
116
+ ),
117
+ }
118
+ )
119
+ ),
120
+ }
121
+ )
122
+
123
+ return datasets.DatasetInfo(
124
+ # This is the description that will appear on the datasets page.
125
+ description=_DESCRIPTION,
126
+ # datasets.features.FeatureConnectors
127
+ features=features,
128
+ # If there's a common (input, target) tuple from the features,
129
+ # specify them here. They'll be used if as_supervised=True in
130
+ # builder.as_dataset.
131
+ supervised_keys=None,
132
+ # Homepage of the dataset for documentation
133
+ homepage="https://github.com/jayded/evidence-inference",
134
+ citation=_CITATION,
135
+ )
136
+
137
+ def _split_generators(self, dl_manager):
138
+ dl_dir = dl_manager.download_and_extract(self.config.zip_file)
139
+ if self.config.name == "1.1":
140
+ dl_dir = os.path.join(dl_dir, "evidence-inference-1.1", "annotations")
141
+
142
+ SPLITS = {}
143
+ for split in ["train", "test", "validation"]:
144
+ filename = os.path.join(dl_dir, "splits", f"{split}_article_ids.txt")
145
+ with open(filename, "r", encoding="utf-8") as f:
146
+ for line in f:
147
+ id_ = int(line.strip())
148
+ SPLITS[id_] = split
149
+
150
+ ALL_PROMPTS = {}
151
+ prompts_filename = os.path.join(dl_dir, "prompts_merged.csv")
152
+ with open(prompts_filename, "r", encoding="utf-8") as f:
153
+ data = csv.DictReader(f)
154
+ for item in data:
155
+ prompt_id = int(item["PromptID"])
156
+ ALL_PROMPTS[prompt_id] = {"Prompt": item, "Annotations": []}
157
+
158
+ annotations_filename = os.path.join(dl_dir, "annotations_merged.csv")
159
+ with open(annotations_filename, "r", encoding="utf-8") as f:
160
+ data = csv.DictReader(f)
161
+ for item in data:
162
+ prompt_id = int(item["PromptID"])
163
+
164
+ if "Annotations" not in ALL_PROMPTS[prompt_id]:
165
+ ALL_PROMPTS[prompt_id]["Annotations"] = []
166
+
167
+ ALL_PROMPTS[prompt_id]["Annotations"].append(item)
168
+
169
+ # Simplify everything
170
+ directory = os.path.join(dl_dir, "txt_files")
171
+ ALL_IDS = {"train": [], "test": [], "validation": []}
172
+ for prompt_id, item in ALL_PROMPTS.items():
173
+ pmcid = int(item["Prompt"]["PMCID"])
174
+ if pmcid not in SPLITS:
175
+ if os.path.isfile(os.path.join(directory, f"PMC{pmcid}.txt")):
176
+ split = "train"
177
+ else:
178
+ continue
179
+ else:
180
+ split = SPLITS[pmcid]
181
+
182
+ values = ALL_IDS[split]
183
+
184
+ filtered = [v for v in values if v["PMCID"] == pmcid]
185
+ if len(filtered) == 1:
186
+ value = filtered[0]
187
+ else:
188
+ value = {"PMCID": pmcid, "Prompts": []}
189
+ values.append(value)
190
+
191
+ new_item = item["Prompt"]
192
+ new_item["Annotations"] = item["Annotations"]
193
+ value["Prompts"].append(new_item)
194
+
195
+ return [
196
+ datasets.SplitGenerator(
197
+ name=datasets.Split.TRAIN,
198
+ # These kwargs will be passed to _generate_examples
199
+ gen_kwargs={
200
+ "directory": os.path.join(dl_dir, "txt_files"),
201
+ "items": ALL_IDS["train"],
202
+ },
203
+ ),
204
+ datasets.SplitGenerator(
205
+ name=datasets.Split.TEST,
206
+ # These kwargs will be passed to _generate_examples
207
+ gen_kwargs={
208
+ "directory": directory,
209
+ "items": ALL_IDS["test"],
210
+ },
211
+ ),
212
+ datasets.SplitGenerator(
213
+ name=datasets.Split.VALIDATION,
214
+ # These kwargs will be passed to _generate_examples
215
+ gen_kwargs={
216
+ "directory": os.path.join(dl_dir, "txt_files"),
217
+ "items": ALL_IDS["validation"],
218
+ },
219
+ ),
220
+ ]
221
+
222
+ def _generate_examples(self, directory, items):
223
+ """ Yields examples. """
224
+ for id_, item in enumerate(items):
225
+ pmcid = item["PMCID"]
226
+ filename = os.path.join(directory, f"PMC{pmcid}.txt")
227
+ with open(filename, "r", encoding="utf-8") as f:
228
+ text = f.read()
229
+
230
+ yield id_, {"Text": text, **item}