Dr. Jorge Abreu Vicente commited on
Commit
16e01d5
1 Parent(s): fba382b

Update sd-nlp-non-tokenized.py

Browse files
Files changed (1) hide show
  1. sd-nlp-non-tokenized.py +6 -7
sd-nlp-non-tokenized.py CHANGED
@@ -195,7 +195,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
195
  labels = data["label_ids"]["entity_types"]
196
  tag_mask = [0 if tag == "O" else 1 for tag in labels]
197
  yield id_, {
198
- "input_ids": data["input_ids"],
199
  "labels": labels,
200
  "tag_mask": tag_mask,
201
  }
@@ -204,26 +204,25 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
204
  geneprod = ["B-GENEPROD", "I-GENEPROD", "B-PROTEIN", "I-PROTEIN", "B-GENE", "I-GENE"]
205
  tag_mask = [1 if t in geneprod else 0 for t in labels]
206
  yield id_, {
207
- "input_ids": data["input_ids"],
208
  "labels": data["label_ids"]["geneprod_roles"],
209
  "tag_mask": tag_mask,
210
  }
211
  elif self.config.name == "SMALL_MOL_ROLES":
212
- labels = data["label_ids"]["entity_types"]
213
  small_mol = ["B-SMALL_MOLECULE", "I-SMALL_MOLECULE"]
214
  tag_mask = [1 if t in small_mol else 0 for t in labels]
215
  yield id_, {
216
- "input_ids": data["input_ids"],
217
  "labels": data["label_ids"]["small_mol_roles"],
218
  "tag_mask": tag_mask,
219
  }
220
  elif self.config.name == "BORING":
221
- yield id_, {"input_ids": data["input_ids"], "labels": data["label_ids"]["boring"]}
222
  elif self.config.name == "PANELIZATION":
223
  labels = data["label_ids"]["panel_start"]
224
  tag_mask = [1 if t == "B-PANEL_START" else 0 for t in labels]
225
  yield id_, {
226
- "input_ids": data["input_ids"],
227
  "labels": data["label_ids"]["panel_start"],
228
- "tag_mask": tag_mask,
229
  }
 
195
  labels = data["label_ids"]["entity_types"]
196
  tag_mask = [0 if tag == "O" else 1 for tag in labels]
197
  yield id_, {
198
+ "words": data["words"],
199
  "labels": labels,
200
  "tag_mask": tag_mask,
201
  }
 
204
  geneprod = ["B-GENEPROD", "I-GENEPROD", "B-PROTEIN", "I-PROTEIN", "B-GENE", "I-GENE"]
205
  tag_mask = [1 if t in geneprod else 0 for t in labels]
206
  yield id_, {
207
+ "words": data["words"],
208
  "labels": data["label_ids"]["geneprod_roles"],
209
  "tag_mask": tag_mask,
210
  }
211
  elif self.config.name == "SMALL_MOL_ROLES":
212
+ labels = data["words"]["entity_types"]
213
  small_mol = ["B-SMALL_MOLECULE", "I-SMALL_MOLECULE"]
214
  tag_mask = [1 if t in small_mol else 0 for t in labels]
215
  yield id_, {
216
+ "words": data["words"],
217
  "labels": data["label_ids"]["small_mol_roles"],
218
  "tag_mask": tag_mask,
219
  }
220
  elif self.config.name == "BORING":
221
+ yield id_, {"words": data["words"], "labels": data["label_ids"]["boring"]}
222
  elif self.config.name == "PANELIZATION":
223
  labels = data["label_ids"]["panel_start"]
224
  tag_mask = [1 if t == "B-PANEL_START" else 0 for t in labels]
225
  yield id_, {
226
+ "input_ids": data["words"],
227
  "labels": data["label_ids"]["panel_start"],
 
228
  }