Datasets:
Tasks:
Token Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
10K - 100K
License:
Update fabner.py
Browse files
fabner.py
CHANGED
|
@@ -61,6 +61,26 @@ _URLS = {
|
|
| 61 |
"test": "https://figshare.com/ndownloader/files/28405851/S1-test.txt",
|
| 62 |
}
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
class FabNER(datasets.GeneratorBasedBuilder):
|
| 65 |
"""FabNER is a manufacturing text corpus of 350,000+ words for Named Entity Recognition."""
|
| 66 |
|
|
@@ -84,6 +104,8 @@ class FabNER(datasets.GeneratorBasedBuilder):
|
|
| 84 |
description="The FabNER dataset with BIO tagging format"),
|
| 85 |
datasets.BuilderConfig(name="fabner_simple", version=VERSION,
|
| 86 |
description="The FabNER dataset with no tagging format"),
|
|
|
|
|
|
|
| 87 |
]
|
| 88 |
DEFAULT_CONFIG_NAME = "fabner"
|
| 89 |
|
|
@@ -102,7 +124,9 @@ class FabNER(datasets.GeneratorBasedBuilder):
|
|
| 102 |
"MANS", # Manufacturing Standards
|
| 103 |
"BIOP", # BioMedical
|
| 104 |
]
|
| 105 |
-
if self.config.name == "
|
|
|
|
|
|
|
| 106 |
class_labels = ["O"]
|
| 107 |
for entity_type in entity_types:
|
| 108 |
class_labels.extend(
|
|
@@ -195,6 +219,8 @@ class FabNER(datasets.GeneratorBasedBuilder):
|
|
| 195 |
ner_tag = "O"
|
| 196 |
else:
|
| 197 |
ner_tag = ner_tag.replace("S-", "B-").replace("E-", "I-")
|
|
|
|
|
|
|
| 198 |
ner_tags.append(ner_tag)
|
| 199 |
# last example
|
| 200 |
if tokens:
|
|
|
|
| 61 |
"test": "https://figshare.com/ndownloader/files/28405851/S1-test.txt",
|
| 62 |
}
|
| 63 |
|
| 64 |
+
|
| 65 |
+
def map_fabner_labels(string_tag):
|
| 66 |
+
tag = string_tag[2:]
|
| 67 |
+
# MATERIAL (FABNER)
|
| 68 |
+
if tag == "MATE":
|
| 69 |
+
return "Material"
|
| 70 |
+
# MANUFACTURING PROCESS (FABNER)
|
| 71 |
+
elif tag == "MANP":
|
| 72 |
+
return "Method"
|
| 73 |
+
# MACHINE/EQUIPMENT, MECHANICAL PROPERTIES, CHARACTERIZATION, ENABLING TECHNOLOGY (FABNER)
|
| 74 |
+
elif tag in ["MACEQ", "PRO", "CHAR", "ENAT"]:
|
| 75 |
+
return "Technological System"
|
| 76 |
+
# APPLICATION (FABNER)
|
| 77 |
+
elif tag == "APPL":
|
| 78 |
+
return "Technical Field"
|
| 79 |
+
# FEATURES, PARAMETERS, CONCEPT/PRINCIPLES, MANUFACTURING STANDARDS, BIOMEDICAL, O (FABNER)
|
| 80 |
+
else:
|
| 81 |
+
return "O"
|
| 82 |
+
|
| 83 |
+
|
| 84 |
class FabNER(datasets.GeneratorBasedBuilder):
|
| 85 |
"""FabNER is a manufacturing text corpus of 350,000+ words for Named Entity Recognition."""
|
| 86 |
|
|
|
|
| 104 |
description="The FabNER dataset with BIO tagging format"),
|
| 105 |
datasets.BuilderConfig(name="fabner_simple", version=VERSION,
|
| 106 |
description="The FabNER dataset with no tagging format"),
|
| 107 |
+
datasets.BuilderConfig(name="text2tech", version=VERSION,
|
| 108 |
+
description="The FabNER dataset mapped to the Text2Tech tag set"),
|
| 109 |
]
|
| 110 |
DEFAULT_CONFIG_NAME = "fabner"
|
| 111 |
|
|
|
|
| 124 |
"MANS", # Manufacturing Standards
|
| 125 |
"BIOP", # BioMedical
|
| 126 |
]
|
| 127 |
+
if self.config.name == "text2tech":
|
| 128 |
+
class_labels = ["O", "Technological System", "Method", "Material", "Technical Field"]
|
| 129 |
+
elif self.config.name == "fabner":
|
| 130 |
class_labels = ["O"]
|
| 131 |
for entity_type in entity_types:
|
| 132 |
class_labels.extend(
|
|
|
|
| 219 |
ner_tag = "O"
|
| 220 |
else:
|
| 221 |
ner_tag = ner_tag.replace("S-", "B-").replace("E-", "I-")
|
| 222 |
+
elif self.config.name == "text2tech":
|
| 223 |
+
ner_tag = map_fabner_labels(ner_tag)
|
| 224 |
ner_tags.append(ner_tag)
|
| 225 |
# last example
|
| 226 |
if tokens:
|