drAbreu commited on
Commit
d474f21
1 Parent(s): 79106e5

Update sd-nlp-non-tokenized.py

Browse files
Files changed (1) hide show
  1. sd-nlp-non-tokenized.py +5 -3
sd-nlp-non-tokenized.py CHANGED
@@ -49,7 +49,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
49
  _SEMANTIC_SMALL_MOL_ROLES_LABEL_NAMES = ["O", "B-CONTROLLED_VAR", "I-CONTROLLED_VAR", "B-MEASURED_VAR", "I-MEASURED_VAR"]
50
  _BORING_LABEL_NAMES = ["O", "B-BORING", "I-BORING"]
51
  _PANEL_START_NAMES = ["O", "B-PANEL_START", "I-PANEL_START"]
52
- _ROLES_NAMES = ["O", "CONTROLLED_VAR", "MEASURED_VAR"]
53
 
54
  _CITATION = """\
55
  @Unpublished{
@@ -157,6 +157,7 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
157
  feature=datasets.ClassLabel(num_classes=len(self._ROLES_NAMES),
158
  names=self._ROLES_NAMES)
159
  ),
 
160
  }
161
  )
162
 
@@ -243,8 +244,9 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
243
  yield id_, {"words": data["words"],
244
  "labels": data["label_ids"]["boring"]}
245
  elif self.config.name == "ROLES":
246
- yield id_, {"words": data["text_generic_roles"],
247
- "labels": data["labels_generic_roles"]}
 
248
  elif self.config.name == "PANELIZATION":
249
  labels = data["label_ids"]["panel_start"]
250
  tag_mask = [1 if t == "B-PANEL_START" else 0 for t in labels]
 
49
  _SEMANTIC_SMALL_MOL_ROLES_LABEL_NAMES = ["O", "B-CONTROLLED_VAR", "I-CONTROLLED_VAR", "B-MEASURED_VAR", "I-MEASURED_VAR"]
50
  _BORING_LABEL_NAMES = ["O", "B-BORING", "I-BORING"]
51
  _PANEL_START_NAMES = ["O", "B-PANEL_START", "I-PANEL_START"]
52
+ _ROLES_NAMES = ["O", "B-CONTROLLED_VAR", "B-MEASURED_VAR"]
53
 
54
  _CITATION = """\
55
  @Unpublished{
 
157
  feature=datasets.ClassLabel(num_classes=len(self._ROLES_NAMES),
158
  names=self._ROLES_NAMES)
159
  ),
160
+ "tag_mask": datasets.Sequence(feature=datasets.Value("int8")),
161
  }
162
  )
163
 
 
244
  yield id_, {"words": data["words"],
245
  "labels": data["label_ids"]["boring"]}
246
  elif self.config.name == "ROLES":
247
+ yield id_, {"words": data["generic_roles"]["words"],
248
+ "labels": data["generic_roles"]["roles"],
249
+ "tag_mask": data["generic_roles"]["tag_mask"]}
250
  elif self.config.name == "PANELIZATION":
251
  labels = data["label_ids"]["panel_start"]
252
  tag_mask = [1 if t == "B-PANEL_START" else 0 for t in labels]