Dr. Jorge Abreu Vicente commited on
Commit
b97c07d
1 Parent(s): 72bc61d

All NER sets working

Browse files
Files changed (1) hide show
  1. BLURB.py +33 -87
BLURB.py CHANGED
@@ -7,63 +7,12 @@ import datasets
7
  import shutil
8
  from constants import CITATIONS, DESCRIPTIONS, HOMEPAGES, DATA_URL
9
 
10
- _CITATION = """\
11
- @article{2022,
12
- title={Domain-Specific Language Model Pretraining for Biomedical Natural Language Processing},
13
- volume={3},
14
- ISSN={2637-8051},
15
- url={http://dx.doi.org/10.1145/3458754},
16
- DOI={10.1145/3458754},
17
- number={1},
18
- journal={ACM Transactions on Computing for Healthcare},
19
- publisher={Association for Computing Machinery (ACM)},
20
- 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},
21
- year={2022},
22
- month={Jan},
23
- pages={1–23}
24
- }
25
- """
26
-
27
- _DESCRIPTION = """BLURB (Biomedical Language Understanding and Reasoning Benchmark.)
28
- is a comprehensive benchmark for biomedical NLP, with 13 biomedical NLP datasets in 6
29
- tasks (NER, PICO, Relation Extraction, Sentence similarity, document classification, question answering).
30
- Our aim is to facilitate investigations of biomedical natural language processing
31
- with a specific focus on language model pretraining and to help accelerate progress in universal Biomedical
32
- NLP applications. The table below compares the datasets comprising BLURB versus the various datasets used in
33
- previous Biomedical and Clinical BERT language models."""
34
-
35
- _HOMEPAGE = "https://microsoft.github.io/BLURB/index.html"
36
-
37
  _LICENSE = "TBD"
38
-
39
-
40
  _VERSION = "1.0.0"
41
-
42
  DATA_DIR = "blurb/"
43
 
44
- logger = datasets.logging.get_logger(__name__)
45
 
46
- CITATION_BC5_CHEM = """@article{article,
47
- 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},
48
- year = {2016},
49
- month = {05},
50
- pages = {baw068},
51
- title = {BioCreative V CDR task corpus: a resource for chemical disease relation extraction},
52
- volume = {2016},
53
- journal = {Database},
54
- doi = {10.1093/database/baw068}
55
- }
56
- """
57
- CITATION_BC2_GENE = """@article{article,
58
- 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.},
59
- year = {2008},
60
- month = {09},
61
- pages = {S2},
62
- title = {Overview of BioCreative II gene mention recognition},
63
- volume = {9 Suppl 2},
64
- journal = {Genome biology},
65
- doi = {10.1186/gb-2008-9-s2-s2}
66
- }"""
67
 
68
  class BlurbConfig(datasets.BuilderConfig):
69
  """BuilderConfig for BLURB."""
@@ -110,45 +59,38 @@ class Blurb(datasets.GeneratorBasedBuilder):
110
 
111
  BUILDER_CONFIGS = [
112
  BlurbConfig(name='BC5CDR-chem-IOB', task='ner', label_classes=['O', 'B-Chemical', 'I-Chemical'],
113
- data_url = "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
114
- description="""The corpus consists of three separate sets of
115
- articles with diseases, chemicals and their relations annotated.
116
- The training (500 articles) and development (500 articles) sets
117
- were released to task participants in advance to support text-mining
118
- method development. The test set (500 articles) was used for final
119
- system performance evaluation.""",
120
- citation=CITATION_BC5_CHEM,
121
- homepage="https://biocreative.bioinformatics.udel.edu/resources/corpora/biocreative-v-cdr-corpus"),
122
 
123
  BlurbConfig(name='BC5CDR-disease-IOB', task='ner', label_classes=['O', 'B-Disease', 'I-Disease'],
124
- data_url = "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
125
- description="""The corpus consists of three separate sets of
126
- articles with diseases, chemicals and their relations annotated.
127
- The training (500 articles) and development (500 articles) sets
128
- were released to task participants in advance to support text-mining
129
- method development. The test set (500 articles) was used for final
130
- system performance evaluation.""",
131
- citation=CITATION_BC5_CHEM,
132
- homepage="https://biocreative.bioinformatics.udel.edu/resources/corpora/biocreative-v-cdr-corpus"),
133
 
134
  BlurbConfig(name='BC2GM-IOB', task='ner', label_classes=['O', 'B-GENE', 'I-GENE'],
135
- data_url = "https://github.com/cambridgeltl/MTL-Bioinformatics-2016/raw/master/data/",
136
- description="""The BioCreative II Gene Mention task.
137
- The training corpus for the current task consists mainly of
138
- the training and testing corpora (text collections) from the
139
- BCI task, and the testing corpus for the current task
140
- consists of an additional 5,000 sentences that were held
141
- 'in reserve' from the previous task.
142
- In the current corpus, tokenization is not provided;
143
- instead participants are asked to identify a gene mention
144
- in a sentence by giving its start and end characters.
145
- As before, the training set consists of a set of sentences,
146
- and for each sentence a set of gene mentions
147
- (GENE annotations).
148
- """,
149
- citation=CITATION_BC2_GENE,
150
- homepage="https://biocreative.bioinformatics.udel.edu/tasks/biocreative-ii/task-1a-gene-mention-tagging/"),
151
-
 
 
 
152
  ]
153
 
154
 
@@ -163,6 +105,10 @@ class Blurb(datasets.GeneratorBasedBuilder):
163
 
164
  def _split_generators(self, dl_manager):
165
  """Returns SplitGenerators."""
 
 
 
 
166
 
167
  if self.config.task == 'ner':
168
  downloaded_files = dl_manager.download_and_extract(self.config.urls)
 
7
  import shutil
8
  from constants import CITATIONS, DESCRIPTIONS, HOMEPAGES, DATA_URL
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  _LICENSE = "TBD"
 
 
11
  _VERSION = "1.0.0"
 
12
  DATA_DIR = "blurb/"
13
 
 
14
 
15
+ logger = datasets.logging.get_logger(__name__)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  class BlurbConfig(datasets.BuilderConfig):
18
  """BuilderConfig for BLURB."""
 
59
 
60
  BUILDER_CONFIGS = [
61
  BlurbConfig(name='BC5CDR-chem-IOB', task='ner', label_classes=['O', 'B-Chemical', 'I-Chemical'],
62
+ data_url = DATA_URL['BC5CDR-chem-IOB'],
63
+ description=DESCRIPTIONS['BC5CDR-chem-IOB'],
64
+ citation=CITATIONS['BC5CDR-chem-IOB'],
65
+ homepage=HOMEPAGES['BC5CDR-chem-IOB']),
 
 
 
 
 
66
 
67
  BlurbConfig(name='BC5CDR-disease-IOB', task='ner', label_classes=['O', 'B-Disease', 'I-Disease'],
68
+ data_url = DATA_URL['BC5CDR-disease-IOB'],
69
+ description=DESCRIPTIONS['BC5CDR-disease-IOB'],
70
+ citation=CITATIONS['BC5CDR-disease-IOB'],
71
+ homepage=HOMEPAGES['BC5CDR-disease-IOB']),
 
 
 
 
 
72
 
73
  BlurbConfig(name='BC2GM-IOB', task='ner', label_classes=['O', 'B-GENE', 'I-GENE'],
74
+ data_url = DATA_URL['BC2GM-IOB'],
75
+ description=DESCRIPTIONS['BC2GM-IOB'],
76
+ citation=CITATIONS['BC2GM-IOB'],
77
+ homepage=HOMEPAGES['BC2GM-IOB']),
78
+
79
+ BlurbConfig(name='NCBI-disease-IOB', task='ner', label_classes=['O', 'B-Disease', 'I-Disease'],
80
+ data_url = DATA_URL['NCBI-disease-IOB'],
81
+ description=DESCRIPTIONS['NCBI-disease-IOB'],
82
+ citation=CITATIONS['NCBI-disease-IOB'],
83
+ homepage=HOMEPAGES['NCBI-disease-IOB']),
84
+
85
+ BlurbConfig(name='JNLPBA', task='ner', label_classes=['O', 'B-protein', 'I-protein',
86
+ 'B-cell_type', 'I-cell_type',
87
+ 'B-cell_line', 'I-cell_line',
88
+ 'B-DNA','I-DNA', 'B-RNA', 'I-RNA'],
89
+ data_url = DATA_URL['JNLPBA'],
90
+ description=DESCRIPTIONS['JNLPBA'],
91
+ citation=CITATIONS['JNLPBA'],
92
+ homepage=HOMEPAGES['JNLPBA']),
93
+
94
  ]
95
 
96
 
 
105
 
106
  def _split_generators(self, dl_manager):
107
  """Returns SplitGenerators."""
108
+ print(self.config.base_url)
109
+ print(self.config.data_url)
110
+ for i in self.config.urls:
111
+ print(self.config.urls[i])
112
 
113
  if self.config.task == 'ner':
114
  downloaded_files = dl_manager.download_and_extract(self.config.urls)