Datasets:
Dr. Jorge Abreu Vicente
commited on
Commit
·
d84e92a
1
Parent(s):
c6e88cf
Update sd-nlp-non-tokenized.py
Browse files- sd-nlp-non-tokenized.py +18 -18
sd-nlp-non-tokenized.py
CHANGED
|
@@ -28,31 +28,31 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
|
|
| 28 |
|
| 29 |
_NER_LABEL_NAMES = [
|
| 30 |
"O",
|
| 31 |
-
"I-SMALL_MOLECULE",
|
| 32 |
"B-SMALL_MOLECULE",
|
| 33 |
-
"I-
|
| 34 |
"B-GENEPROD",
|
| 35 |
-
"I-
|
| 36 |
"B-SUBCELLULAR",
|
| 37 |
-
"I-
|
| 38 |
"B-CELL",
|
| 39 |
-
"I-
|
| 40 |
"B-TISSUE",
|
| 41 |
-
"I-
|
| 42 |
"B-ORGANISM",
|
| 43 |
-
"I-
|
| 44 |
"B-EXP_ASSAY",
|
|
|
|
| 45 |
]
|
| 46 |
-
_SEMANTIC_GENEPROD_ROLES_LABEL_NAMES = ["O", "
|
| 47 |
-
_SEMANTIC_SMALL_MOL_ROLES_LABEL_NAMES = ["O", "
|
| 48 |
-
_BORING_LABEL_NAMES = ["O", "
|
| 49 |
_PANEL_START_NAMES = ["O", "B-PANEL_START"]
|
| 50 |
|
| 51 |
_CITATION = """\
|
| 52 |
@Unpublished{
|
| 53 |
huggingface: dataset,
|
| 54 |
title = {SourceData NLP},
|
| 55 |
-
authors={Thomas Lemberger, EMBO},
|
| 56 |
year={2021}
|
| 57 |
}
|
| 58 |
"""
|
|
@@ -65,20 +65,20 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
|
|
| 65 |
|
| 66 |
_LICENSE = "CC-BY 4.0"
|
| 67 |
|
| 68 |
-
VERSION = datasets.Version("0.0
|
| 69 |
|
| 70 |
_URLS = {
|
| 71 |
"NER": f"{_BASE_URL}sd_panels_general_tokenization.zip",
|
| 72 |
"PANELIZATION": f"{_BASE_URL}sd_fig_general_tokenization.zip",
|
| 73 |
}
|
| 74 |
BUILDER_CONFIGS = [
|
| 75 |
-
datasets.BuilderConfig(name="NER", version=
|
| 76 |
-
datasets.BuilderConfig(name="GENEPROD_ROLES", version=
|
| 77 |
-
datasets.BuilderConfig(name="SMALL_MOL_ROLES", version=
|
| 78 |
-
datasets.BuilderConfig(name="BORING", version=
|
| 79 |
datasets.BuilderConfig(
|
| 80 |
name="PANELIZATION",
|
| 81 |
-
version=
|
| 82 |
description="Dataset for figure legend segmentation into panel-specific legends.",
|
| 83 |
),
|
| 84 |
]
|
|
@@ -192,7 +192,6 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
|
|
| 192 |
"""Yields examples. This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
|
| 193 |
It is in charge of opening the given file and yielding (key, example) tuples from the dataset
|
| 194 |
The key is not important, it's more here for legacy reason (legacy from tfds)"""
|
| 195 |
-
print(" This line is taking place")
|
| 196 |
|
| 197 |
with open(filepath, encoding="utf-8") as f:
|
| 198 |
# logger.info("⏳ Generating examples from = %s", filepath)
|
|
@@ -235,3 +234,4 @@ class SourceDataNLP(datasets.GeneratorBasedBuilder):
|
|
| 235 |
"labels": data["label_ids"]["panel_start"],
|
| 236 |
"tag_mask": tag_mask,
|
| 237 |
}
|
|
|
|
|
|
| 28 |
|
| 29 |
_NER_LABEL_NAMES = [
|
| 30 |
"O",
|
|
|
|
| 31 |
"B-SMALL_MOLECULE",
|
| 32 |
+
"I-SMALL_MOLECULE",
|
| 33 |
"B-GENEPROD",
|
| 34 |
+
"I-GENEPROD",
|
| 35 |
"B-SUBCELLULAR",
|
| 36 |
+
"I-SUBCELLULAR",
|
| 37 |
"B-CELL",
|
| 38 |
+
"I-CELL",
|
| 39 |
"B-TISSUE",
|
| 40 |
+
"I-TISSUE",
|
| 41 |
"B-ORGANISM",
|
| 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"]
|
| 48 |
+
_BORING_LABEL_NAMES = ["O", "B-BORING", "I-BORING"]
|
| 49 |
_PANEL_START_NAMES = ["O", "B-PANEL_START"]
|
| 50 |
|
| 51 |
_CITATION = """\
|
| 52 |
@Unpublished{
|
| 53 |
huggingface: dataset,
|
| 54 |
title = {SourceData NLP},
|
| 55 |
+
authors={Thomas Lemberger & Jorge Abreu-Vicente, EMBO},
|
| 56 |
year={2021}
|
| 57 |
}
|
| 58 |
"""
|
|
|
|
| 65 |
|
| 66 |
_LICENSE = "CC-BY 4.0"
|
| 67 |
|
| 68 |
+
VERSION = datasets.Version("1.0.0")
|
| 69 |
|
| 70 |
_URLS = {
|
| 71 |
"NER": f"{_BASE_URL}sd_panels_general_tokenization.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"),
|
| 76 |
+
datasets.BuilderConfig(name="GENEPROD_ROLES", version=VERSION, description="Dataset for semantic roles."),
|
| 77 |
+
datasets.BuilderConfig(name="SMALL_MOL_ROLES", version=VERSION, description="Dataset for semantic roles."),
|
| 78 |
+
datasets.BuilderConfig(name="BORING", version=VERSION, description="Dataset for semantic roles."),
|
| 79 |
datasets.BuilderConfig(
|
| 80 |
name="PANELIZATION",
|
| 81 |
+
version=VERSION,
|
| 82 |
description="Dataset for figure legend segmentation into panel-specific legends.",
|
| 83 |
),
|
| 84 |
]
|
|
|
|
| 192 |
"""Yields examples. This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
|
| 193 |
It is in charge of opening the given file and yielding (key, example) tuples from the dataset
|
| 194 |
The key is not important, it's more here for legacy reason (legacy from tfds)"""
|
|
|
|
| 195 |
|
| 196 |
with open(filepath, encoding="utf-8") as f:
|
| 197 |
# logger.info("⏳ Generating examples from = %s", filepath)
|
|
|
|
| 234 |
"labels": data["label_ids"]["panel_start"],
|
| 235 |
"tag_mask": tag_mask,
|
| 236 |
}
|
| 237 |
+
|