drAbreu commited on
Commit
ea48e61
1 Parent(s): be4f146

Update sd-nlp-non-tokenized.py

Browse files

Added disease and filtered data

Files changed (1) hide show
  1. sd-nlp-non-tokenized.py +13 -3
sd-nlp-non-tokenized.py CHANGED
@@ -42,6 +42,8 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
42
  "I-ORGANISM",
43
  "B-EXP_ASSAY",
44
  "I-EXP_ASSAY",
 
 
45
  ]
46
  _SEMANTIC_GENEPROD_ROLES_LABEL_NAMES = ["O", "B-CONTROLLED_VAR", "I-CONTROLLED_VAR", "B-MEASURED_VAR", "I-MEASURED_VAR"]
47
  _SEMANTIC_SMALL_MOL_ROLES_LABEL_NAMES = ["O", "B-CONTROLLED_VAR", "I-CONTROLLED_VAR", "B-MEASURED_VAR", "I-MEASURED_VAR"]
@@ -68,8 +70,8 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
68
  VERSION = datasets.Version("1.0.0")
69
 
70
  _URLS = {
71
- "NER": f"{_BASE_URL}sd_panels.zip",
72
- "PANELIZATION": f"{_BASE_URL}sd_fig_general_tokenization.zip",
73
  }
74
  BUILDER_CONFIGS = [
75
  datasets.BuilderConfig(name="NER", version=VERSION, description="Dataset for entity recognition"),
@@ -95,6 +97,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
95
  names=self._NER_LABEL_NAMES)
96
  ),
97
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
 
98
  }
99
  )
100
  elif self.config.name == "GENEPROD_ROLES":
@@ -108,6 +111,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
108
  )
109
  ),
110
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
 
111
  }
112
  )
113
  elif self.config.name == "SMALL_MOL_ROLES":
@@ -121,6 +125,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
121
  )
122
  ),
123
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
 
124
  }
125
  )
126
  elif self.config.name == "BORING":
@@ -131,6 +136,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
131
  feature=datasets.ClassLabel(num_classes=len(self._BORING_LABEL_NAMES),
132
  names=self._BORING_LABEL_NAMES)
133
  ),
 
134
  }
135
  )
136
  elif self.config.name == "PANELIZATION":
@@ -142,6 +148,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
142
  names=self._PANEL_START_NAMES)
143
  ),
144
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
 
145
  }
146
  )
147
 
@@ -203,7 +210,8 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
203
  yield id_, {
204
  "words": data["words"],
205
  "labels": labels,
206
- "tag_mask": tag_mask
 
207
  }
208
  elif self.config.name == "GENEPROD_ROLES":
209
  labels = data["label_ids"]["geneprod_roles"]
@@ -213,6 +221,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
213
  "words": data["words"],
214
  "labels": labels,
215
  "tag_mask": tag_mask,
 
216
  }
217
  elif self.config.name == "SMALL_MOL_ROLES":
218
  labels = data["label_ids"]["small_mol_roles"]
@@ -222,6 +231,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
222
  "words": data["words"],
223
  "labels": labels,
224
  "tag_mask": tag_mask,
 
225
  }
226
  elif self.config.name == "BORING":
227
  yield id_, {"words": data["words"],
 
42
  "I-ORGANISM",
43
  "B-EXP_ASSAY",
44
  "I-EXP_ASSAY",
45
+ "B-DISEASE",
46
+ "I-DISEASE",
47
  ]
48
  _SEMANTIC_GENEPROD_ROLES_LABEL_NAMES = ["O", "B-CONTROLLED_VAR", "I-CONTROLLED_VAR", "B-MEASURED_VAR", "I-MEASURED_VAR"]
49
  _SEMANTIC_SMALL_MOL_ROLES_LABEL_NAMES = ["O", "B-CONTROLLED_VAR", "I-CONTROLLED_VAR", "B-MEASURED_VAR", "I-MEASURED_VAR"]
 
70
  VERSION = datasets.Version("1.0.0")
71
 
72
  _URLS = {
73
+ "NER": f"{_BASE_URL}sd_panels_filtered.zip",
74
+ "PANELIZATION": f"{_BASE_URL}sd_panelization_filtered.zip",
75
  }
76
  BUILDER_CONFIGS = [
77
  datasets.BuilderConfig(name="NER", version=VERSION, description="Dataset for entity recognition"),
 
97
  names=self._NER_LABEL_NAMES)
98
  ),
99
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
100
+ "panel_id": datasets.Sequence(feature=datasets.Value("string")),
101
  }
102
  )
103
  elif self.config.name == "GENEPROD_ROLES":
 
111
  )
112
  ),
113
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
114
+ "panel_id": datasets.Sequence(feature=datasets.Value("string")),
115
  }
116
  )
117
  elif self.config.name == "SMALL_MOL_ROLES":
 
125
  )
126
  ),
127
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
128
+ "panel_id": datasets.Sequence(feature=datasets.Value("string")),
129
  }
130
  )
131
  elif self.config.name == "BORING":
 
136
  feature=datasets.ClassLabel(num_classes=len(self._BORING_LABEL_NAMES),
137
  names=self._BORING_LABEL_NAMES)
138
  ),
139
+ "panel_id": datasets.Sequence(feature=datasets.Value("string")),
140
  }
141
  )
142
  elif self.config.name == "PANELIZATION":
 
148
  names=self._PANEL_START_NAMES)
149
  ),
150
  "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
151
+ "panel_id": datasets.Sequence(feature=datasets.Value("string")),
152
  }
153
  )
154
 
 
210
  yield id_, {
211
  "words": data["words"],
212
  "labels": labels,
213
+ "tag_mask": tag_mask,
214
+ "panel_id": data["panel_id"]
215
  }
216
  elif self.config.name == "GENEPROD_ROLES":
217
  labels = data["label_ids"]["geneprod_roles"]
 
221
  "words": data["words"],
222
  "labels": labels,
223
  "tag_mask": tag_mask,
224
+ "panel_id": data["panel_id"]
225
  }
226
  elif self.config.name == "SMALL_MOL_ROLES":
227
  labels = data["label_ids"]["small_mol_roles"]
 
231
  "words": data["words"],
232
  "labels": labels,
233
  "tag_mask": tag_mask,
234
+ "panel_id": data["panel_id"]
235
  }
236
  elif self.config.name == "BORING":
237
  yield id_, {"words": data["words"],