Dr. Jorge Abreu Vicente commited on
Commit
0b6d969
1 Parent(s): 8397513

PubMed and constnts added

Browse files
Files changed (1) hide show
  1. BLURB.py +258 -1
BLURB.py CHANGED
@@ -13,6 +13,210 @@ _VERSION = "1.0.0"
13
  DATA_DIR = "blurb/"
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  logger = datasets.logging.get_logger(__name__)
17
 
18
  class BlurbConfig(datasets.BuilderConfig):
@@ -61,6 +265,25 @@ class BlurbConfig(datasets.BuilderConfig):
61
  "score": datasets.Value("float32"),
62
  }
63
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
 
66
 
@@ -106,6 +329,12 @@ class Blurb(datasets.GeneratorBasedBuilder):
106
  description=DESCRIPTIONS['BIOSSES'],
107
  citation=CITATIONS['BIOSSES'],
108
  homepage=HOMEPAGES['BIOSSES']),
 
 
 
 
 
 
109
 
110
  ]
111
 
@@ -127,6 +356,13 @@ class Blurb(datasets.GeneratorBasedBuilder):
127
  if self.config.task == 'sent-sim':
128
  downloaded_file = dl_manager.download_and_extract(self.config.data_url)
129
  return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file})]
 
 
 
 
 
 
 
130
 
131
 
132
  def _generate_examples(self, filepath):
@@ -137,6 +373,9 @@ class Blurb(datasets.GeneratorBasedBuilder):
137
  return self._ner_example_generator(filepath)
138
  if self.config.task == 'sent-sim':
139
  return self._sentsim_example_generator(filepath)
 
 
 
140
 
141
  def _ner_split_generator(self, downloaded_files):
142
  return [
@@ -187,4 +426,22 @@ class Blurb(datasets.GeneratorBasedBuilder):
187
  "sentence2": row["sentence2"],
188
  "score": row["score"],
189
  }
190
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  DATA_DIR = "blurb/"
14
 
15
 
16
+
17
+ CITATIONS = {
18
+ "blurb": """\
19
+ @article{2022,
20
+ title={Domain-Specific Language Model Pretraining for Biomedical Natural Language Processing},
21
+ volume={3},
22
+ ISSN={2637-8051},
23
+ url={http://dx.doi.org/10.1145/3458754},
24
+ DOI={10.1145/3458754},
25
+ number={1},
26
+ journal={ACM Transactions on Computing for Healthcare},
27
+ publisher={Association for Computing Machinery (ACM)},
28
+ author={Gu, Yu and Tinn, Robert and Cheng, Hao and Lucas, Michael and Usuyama, Naoto and Liu, Xiaodong and Naumann, Tristan and Gao, Jianfeng and Poon, Hoifung},
29
+ year={2022},
30
+ month={Jan},
31
+ pages={1–23}
32
+ }
33
+ """,
34
+ "BC5CDR-chem-IOB": """@article{article,
35
+ author = {Li, Jiao and Sun, Yueping and Johnson, Robin and Sciaky, Daniela and Wei, Chih-Hsuan and Leaman, Robert and Davis, Allan Peter and Mattingly, Carolyn and Wiegers, Thomas and lu, Zhiyong},
36
+ year = {2016},
37
+ month = {05},
38
+ pages = {baw068},
39
+ title = {BioCreative V CDR task corpus: a resource for chemical disease relation extraction},
40
+ volume = {2016},
41
+ journal = {Database},
42
+ doi = {10.1093/database/baw068}
43
+ }""",
44
+ "BC5CDR-disease-IOB":"""@article{article,
45
+ author = {Li, Jiao and Sun, Yueping and Johnson, Robin and Sciaky, Daniela and Wei, Chih-Hsuan and Leaman, Robert and Davis, Allan Peter and Mattingly, Carolyn and Wiegers, Thomas and lu, Zhiyong},
46
+ year = {2016},
47
+ month = {05},
48
+ pages = {baw068},
49
+ title = {BioCreative V CDR task corpus: a resource for chemical disease relation extraction},
50
+ volume = {2016},
51
+ journal = {Database},
52
+ doi = {10.1093/database/baw068}
53
+ }""",
54
+ "BC2GM-IOB":"""@article{article,
55
+ author = {Smith, Larry and Tanabe, Lorraine and Ando, Rie and Kuo, Cheng-Ju and Chung, I-Fang and Hsu, Chun-Nan and Lin, Yu-Shi and Klinger, Roman and Friedrich, Christoph and Ganchev, Kuzman and Torii, Manabu and Liu, Hongfang and Haddow, Barry and Struble, Craig and Povinelli, Richard and Vlachos, Andreas and Baumgartner Jr, William and Hunter, Lawrence and Carpenter, Bob and Wilbur, W.},
56
+ year = {2008},
57
+ month = {09},
58
+ pages = {S2},
59
+ title = {Overview of BioCreative II gene mention recognition},
60
+ volume = {9 Suppl 2},
61
+ journal = {Genome biology},
62
+ doi = {10.1186/gb-2008-9-s2-s2}
63
+ }""",
64
+ "NCBI-disease-IOB":"""@article{10.5555/2772763.2772800,
65
+ author = {Dogan, Rezarta Islamaj and Leaman, Robert and Lu, Zhiyong},
66
+ title = {NCBI Disease Corpus},
67
+ year = {2014},
68
+ issue_date = {February 2014},
69
+ publisher = {Elsevier Science},
70
+ address = {San Diego, CA, USA},
71
+ volume = {47},
72
+ number = {C},
73
+ issn = {1532-0464},
74
+ abstract = {Graphical abstractDisplay Omitted NCBI disease corpus is built as a gold-standard resource for disease recognition.793 PubMed abstracts are annotated with disease mentions and concepts (MeSH/OMIM).14 Annotators produced high consistency level and inter-annotator agreement.Normalization benchmark results demonstrate the utility of the corpus.The corpus is publicly available to the community. Information encoded in natural language in biomedical literature publications is only useful if efficient and reliable ways of accessing and analyzing that information are available. Natural language processing and text mining tools are therefore essential for extracting valuable information, however, the development of powerful, highly effective tools to automatically detect central biomedical concepts such as diseases is conditional on the availability of annotated corpora.This paper presents the disease name and concept annotations of the NCBI disease corpus, a collection of 793 PubMed abstracts fully annotated at the mention and concept level to serve as a research resource for the biomedical natural language processing community. Each PubMed abstract was manually annotated by two annotators with disease mentions and their corresponding concepts in Medical Subject Headings (MeSH ) or Online Mendelian Inheritance in Man (OMIM ). Manual curation was performed using PubTator, which allowed the use of pre-annotations as a pre-step to manual annotations. Fourteen annotators were randomly paired and differing annotations were discussed for reaching a consensus in two annotation phases. In this setting, a high inter-annotator agreement was observed. Finally, all results were checked against annotations of the rest of the corpus to assure corpus-wide consistency.The public release of the NCBI disease corpus contains 6892 disease mentions, which are mapped to 790 unique disease concepts. Of these, 88% link to a MeSH identifier, while the rest contain an OMIM identifier. We were able to link 91% of the mentions to a single disease concept, while the rest are described as a combination of concepts. In order to help researchers use the corpus to design and test disease identification methods, we have prepared the corpus as training, testing and development sets. To demonstrate its utility, we conducted a benchmarking experiment where we compared three different knowledge-based disease normalization methods with a best performance in F-measure of 63.7%. These results show that the NCBI disease corpus has the potential to significantly improve the state-of-the-art in disease name recognition and normalization research, by providing a high-quality gold standard thus enabling the development of machine-learning based approaches for such tasks.The NCBI disease corpus, guidelines and other associated resources are available at: http://www.ncbi.nlm.nih.gov/CBBresearch/Dogan/DISEASE/.},
75
+ journal = {J. of Biomedical Informatics},
76
+ month = {feb},
77
+ pages = {1–10},
78
+ numpages = {10}}""",
79
+ "JNLPBA":"""@inproceedings{collier-kim-2004-introduction,
80
+ title = "Introduction to the Bio-entity Recognition Task at {JNLPBA}",
81
+ author = "Collier, Nigel and
82
+ Kim, Jin-Dong",
83
+ booktitle = "Proceedings of the International Joint Workshop on Natural Language Processing in Biomedicine and its Applications ({NLPBA}/{B}io{NLP})",
84
+ month = aug # " 28th and 29th",
85
+ year = "2004",
86
+ address = "Geneva, Switzerland",
87
+ publisher = "COLING",
88
+ url = "https://aclanthology.org/W04-1213",
89
+ pages = "73--78",
90
+ }""",
91
+
92
+ "BIOSSES": """@article{souganciouglu2017biosses,
93
+ title={BIOSSES: a semantic sentence similarity estimation system for the biomedical domain},
94
+ author={Souganciouglu, Gizem and Ozturk, Hakime and Ozgur, Arzucan},
95
+ journal={Bioinformatics},
96
+ volume={33},
97
+ number={14},
98
+ pages={i49--i58},
99
+ year={2017},
100
+ publisher={Oxford University Press}
101
+ }""",
102
+ "PubMedQA": """\
103
+ @inproceedings{jin2019pubmedqa,
104
+ title={PubMedQA: A Dataset for Biomedical Research Question Answering},
105
+ author={Jin, Qiao and Dhingra, Bhuwan and Liu, Zhengping and Cohen, William and Lu, Xinghua},
106
+ booktitle={Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)},
107
+ pages={2567--2577},
108
+ year={2019}
109
+ }"""
110
+
111
+ }
112
+
113
+ DESCRIPTIONS = {
114
+ "blurb" : """BLURB (Biomedical Language Understanding and Reasoning Benchmark.)
115
+ is a comprehensive benchmark for biomedical NLP, with 13 biomedical NLP datasets in 6
116
+ tasks (NER, PICO, Relation Extraction, Sentence similarity, document classification, question answering).
117
+ Our aim is to facilitate investigations of biomedical natural language processing
118
+ with a specific focus on language model pretraining and to help accelerate progress in universal Biomedical
119
+ NLP applications. The table below compares the datasets comprising BLURB versus the various datasets used in
120
+ previous Biomedical and Clinical BERT language models.""",
121
+ "BC5CDR-chem-IOB":"""The corpus consists of three separate sets of
122
+ articles with diseases, chemicals and their relations annotated.
123
+ The training (500 articles) and development (500 articles) sets
124
+ were released to task participants in advance to support text-mining
125
+ method development. The test set (500 articles) was used for final
126
+ system performance evaluation.""",
127
+ "BC5CDR-disease-IOB":"""The corpus consists of three separate sets of
128
+ articles with diseases, chemicals and their relations annotated.
129
+ The training (500 articles) and development (500 articles) sets
130
+ were released to task participants in advance to support text-mining
131
+ method development. The test set (500 articles) was used for final
132
+ system performance evaluation.""",
133
+ "BC2GM-IOB":"""The BioCreative II Gene Mention task.
134
+ The training corpus for the current task consists mainly of
135
+ the training and testing corpora (text collections) from the
136
+ BCI task, and the testing corpus for the current task
137
+ consists of an additional 5,000 sentences that were held
138
+ 'in reserve' from the previous task.
139
+ In the current corpus, tokenization is not provided;
140
+ instead participants are asked to identify a gene mention
141
+ in a sentence by giving its start and end characters.
142
+ As before, the training set consists of a set of sentences,
143
+ and for each sentence a set of gene mentions
144
+ (GENE annotations).
145
+ """,
146
+ "NCBI-disease-IOB":"""The NCBI disease corpus is fully annotated at the mention
147
+ and concept level to serve as a research resource for the biomedical natural
148
+ language processing community.
149
+ Corpus Characteristics
150
+ ----------------------
151
+ * 793 PubMed abstracts
152
+ * 6,892 disease mentions
153
+ * 790 unique disease concepts
154
+ * Medical Subject Headings (MeSH®)
155
+ * Online Mendelian Inheritance in Man (OMIM®)
156
+ * 91% of the mentions map to a single disease concept
157
+ **divided into training, developing and testing sets.
158
+ Corpus Annotation
159
+ * Fourteen annotators
160
+ * Two-annotators per document (randomly paired)
161
+ * Three annotation phases
162
+ * Checked for corpus-wide consistency of annotations
163
+ """,
164
+ "JNLPBA":"""The BioNLP / JNLPBA Shared Task 2004 involves the identification
165
+ and classification of technical terms referring to concepts of interest to
166
+ biologists in the domain of molecular biology. The task was organized by GENIA
167
+ Project based on the annotations of the GENIA Term corpus (version 3.02).
168
+ Corpus format: The JNLPBA corpus is distributed in IOB format, with each line
169
+ containing a single token and its tag, separated by a tab character.
170
+ Sentences are separated by blank lines.""",
171
+
172
+ "BIOSSES": """BIOSSES is a benchmark dataset for biomedical sentence similarity estimation. The dataset comprises 100 sentence pairs, in which each sentence was selected from the [TAC (Text Analysis Conference) Biomedical Summarization Track Training Dataset](https://tac.nist.gov/2014/BiomedSumm/) containing articles from the biomedical domain. The sentence pairs in BIOSSES were selected from citing sentences, i.e. sentences that have a citation to a reference article.
173
+ The sentence pairs were evaluated by five different human experts that judged their similarity and gave scores ranging from 0 (no relation) to 4 (equivalent). In the original paper the mean of the scores assigned by the five human annotators was taken as the gold standard. The Pearson correlation between the gold standard scores and the scores estimated by the models was used as the evaluation metric. The strength of correlation can be assessed by the general guideline proposed by Evans (1996) as follows:
174
+ - very strong: 0.80–1.00
175
+ - strong: 0.60–0.79
176
+ - moderate: 0.40–0.59
177
+ - weak: 0.20–0.39
178
+ - very weak: 0.00–0.19
179
+ """,
180
+ "PubMedQA": """\
181
+ PubMedQA is a novel biomedical question answering (QA) dataset collected from PubMed abstracts.
182
+ The task of PubMedQA is to answer research questions with yes/no/maybe (e.g.: Do preoperative
183
+ statins reduce atrial fibrillation after coronary artery bypass grafting?) using the corresponding abstracts.
184
+ PubMedQA has 1k expert-annotated, 61.2k unlabeled and 211.3k artificially generated QA instances.
185
+ Each PubMedQA instance is composed of (1) a question which is either an existing research article
186
+ title or derived from one, (2) a context which is the corresponding abstract without its conclusion,
187
+ (3) a long answer, which is the conclusion of the abstract and, presumably, answers the research question,
188
+ and (4) a yes/no/maybe answer which summarizes the conclusion.
189
+ PubMedQA is the first QA dataset where reasoning over biomedical research texts, especially their
190
+ quantitative contents, is required to answer the questions.
191
+ """
192
+ }
193
+
194
+ HOMEPAGES = {
195
+ "blurb": "https://microsoft.github.io/BLURB/index.html",
196
+ "BC5CDR-chem-IOB":"https://biocreative.bioinformatics.udel.edu/resources/corpora/biocreative-v-cdr-corpus",
197
+ "BC5CDR-disease-IOB":"https://biocreative.bioinformatics.udel.edu/resources/corpora/biocreative-v-cdr-corpus",
198
+ "BC2GM-IOB": "https://biocreative.bioinformatics.udel.edu/tasks/biocreative-ii/task-1a-gene-mention-tagging/",
199
+ "NCBI-disease-IOB":"https://www.ncbi.nlm.nih.gov/CBBresearch/Dogan/DISEASE/",
200
+ "JNLPBA":"http://www.geniaproject.org/shared-tasks/bionlp-jnlpba-shared-task-2004",
201
+ "BIOSSES":"https://tabilab.cmpe.boun.edu.tr/BIOSSES/DataSet.html",
202
+ "PubMedQA": "https://pubmedqa.github.io/"
203
+
204
+ }
205
+
206
+
207
+ DATA_URL = {
208
+ "blurb": None,
209
+ "BC5CDR-chem-IOB": "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
210
+ "BC5CDR-disease-IOB": "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
211
+ "BC2GM-IOB": "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
212
+ "NCBI-disease-IOB": "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
213
+ "JNLPBA": "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
214
+ "BIOSSES": "https://raw.githubusercontent.com/Markus-Zlabinger/ssts/fce78a649ab90269950aaf44ce20a36e94409392/data/biosses/all.tsv",
215
+ "PubMedQA": "https://raw.githubusercontent.com/pubmedqa/pubmedqa/master/data/ori_pqal.json"
216
+ }
217
+
218
+
219
+
220
  logger = datasets.logging.get_logger(__name__)
221
 
222
  class BlurbConfig(datasets.BuilderConfig):
 
265
  "score": datasets.Value("float32"),
266
  }
267
  )
268
+ if (self.task == "qa") and (self.name == "PubMedQA"):
269
+ self.features=datasets.Features(
270
+ {
271
+ "pubid": datasets.Value("int32"),
272
+ "question": datasets.Value("string"),
273
+ "context": datasets.features.Sequence(
274
+ {
275
+ "contexts": datasets.Value("string"),
276
+ "labels": datasets.Value("string"),
277
+ "meshes": datasets.Value("string"),
278
+ "reasoning_required_pred": datasets.Value("string"),
279
+ "reasoning_free_pred": datasets.Value("string"),
280
+ }
281
+ ),
282
+ "long_answer": datasets.Value("string"),
283
+ "final_decision": datasets.Value("string"),
284
+ }
285
+ )
286
+ self.urls = {"ori_pqal": self.data_url}
287
 
288
 
289
 
 
329
  description=DESCRIPTIONS['BIOSSES'],
330
  citation=CITATIONS['BIOSSES'],
331
  homepage=HOMEPAGES['BIOSSES']),
332
+ BlurbConfig(name='PubMedQA', task='qa', label_classes=None,
333
+ data_url = DATA_URL['PubMedQA'],
334
+ description=DESCRIPTIONS['PubMedQA'],
335
+ citation=CITATIONS['PubMedQA'],
336
+ homepage=HOMEPAGES['PubMedQA']),
337
+
338
 
339
  ]
340
 
 
356
  if self.config.task == 'sent-sim':
357
  downloaded_file = dl_manager.download_and_extract(self.config.data_url)
358
  return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file})]
359
+ if (self.config.task == "qa") and (self.config.name == "PubMedQA"):
360
+ downloaded_file = dl_manager.download_and_extract(self.config.data_url)
361
+ return [
362
+ datasets.SplitGenerator(
363
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}
364
+ )
365
+ ]
366
 
367
 
368
  def _generate_examples(self, filepath):
 
373
  return self._ner_example_generator(filepath)
374
  if self.config.task == 'sent-sim':
375
  return self._sentsim_example_generator(filepath)
376
+ if self.config.name == 'PubMedQA':
377
+ print("Calling the example_generator")
378
+ return self._pubmedqa_example_generator(filepath)
379
 
380
  def _ner_split_generator(self, downloaded_files):
381
  return [
 
426
  "sentence2": row["sentence2"],
427
  "score": row["score"],
428
  }
429
+
430
+ def _pubmedqa_example_generator(self, filepath):
431
+ """Yields examples."""
432
+ with open(filepath, encoding="utf-8") as f:
433
+ data = json.load(f)
434
+ for id_, row in enumerate(data):
435
+ yield id_, {
436
+ "pubid": row,
437
+ "question": data[row]["QUESTION"],
438
+ "context": {
439
+ "contexts": data[row]["CONTEXTS"],
440
+ "labels": data[row]["LABELS"],
441
+ "meshes": data[row]["MESHES"],
442
+ "reasoning_required_pred": data[row]["reasoning_required_pred"],
443
+ "reasoning_free_pred": data[row]["reasoning_free_pred"],
444
+ },
445
+ "long_answer": data[row]["LONG_ANSWER"],
446
+ "final_decision": data[row]["final_decision"],
447
+ }