Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
entity-linking-classification
Languages:
English
Size:
< 1K
License:
Update SemEval2018_Task7.py
Browse files- SemEval2018_Task7.py +2 -27
SemEval2018_Task7.py
CHANGED
|
@@ -1,7 +1,3 @@
|
|
| 1 |
-
# I am trying to understand to the following code. Do not use this for any purpose as I do not support this.
|
| 2 |
-
# Use the original source from https://huggingface.co/datasets/DFKI-SLT/SemEval2018_Task7/blob/main/SemEval2018_Task7.py
|
| 3 |
-
|
| 4 |
-
|
| 5 |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 6 |
#
|
| 7 |
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -24,7 +20,6 @@ import datasets
|
|
| 24 |
import xml.dom.minidom
|
| 25 |
import xml.etree.ElementTree as ET
|
| 26 |
|
| 27 |
-
# Find for instance the citation on arxiv or on the dataset repo/website
|
| 28 |
_CITATION = """\
|
| 29 |
@inproceedings{gabor-etal-2018-semeval,
|
| 30 |
title = "{S}em{E}val-2018 Task 7: Semantic Relation Extraction and Classification in Scientific Papers",
|
|
@@ -52,7 +47,6 @@ _CITATION = """\
|
|
| 52 |
}
|
| 53 |
"""
|
| 54 |
|
| 55 |
-
# You can copy an official description
|
| 56 |
_DESCRIPTION = """\
|
| 57 |
This paper describes the first task on semantic relation extraction and classification in scientific paper
|
| 58 |
abstracts at SemEval 2018. The challenge focuses on domain-specific semantic relations and includes three
|
|
@@ -63,10 +57,8 @@ limited to scientific or bio-medical information extraction. The task attracted
|
|
| 63 |
with 158 submissions across different scenarios.
|
| 64 |
"""
|
| 65 |
|
| 66 |
-
# Add a link to an official homepage for the dataset here
|
| 67 |
_HOMEPAGE = "https://github.com/gkata/SemEval2018Task7/tree/testing"
|
| 68 |
|
| 69 |
-
# Add the licence for the dataset here if you can find it
|
| 70 |
_LICENSE = ""
|
| 71 |
|
| 72 |
# Add link to the official dataset URLs here
|
|
@@ -193,18 +185,10 @@ class Semeval2018Task7(datasets.GeneratorBasedBuilder):
|
|
| 193 |
)
|
| 194 |
|
| 195 |
return datasets.DatasetInfo(
|
| 196 |
-
# This is the description that will appear on the datasets page.
|
| 197 |
description=_DESCRIPTION,
|
| 198 |
-
|
| 199 |
-
features=features, # Here we define them above because they are different between the two configurations
|
| 200 |
-
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 201 |
-
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 202 |
-
# supervised_keys=("sentence", "label"),
|
| 203 |
-
# Homepage of the dataset for documentation
|
| 204 |
homepage=_HOMEPAGE,
|
| 205 |
-
# License for the dataset if available
|
| 206 |
license=_LICENSE,
|
| 207 |
-
# Citation for the dataset
|
| 208 |
citation=_CITATION,
|
| 209 |
)
|
| 210 |
|
|
@@ -267,15 +251,7 @@ class Semeval2018Task7(datasets.GeneratorBasedBuilder):
|
|
| 267 |
if arg_id not in text_id_to_relations_map:
|
| 268 |
text_id_to_relations_map[arg_id] = [relation]
|
| 269 |
else:
|
| 270 |
-
text_id_to_relations_map[arg_id].append(relation)
|
| 271 |
-
#print("result", text_id_to_relations_map)
|
| 272 |
-
|
| 273 |
-
#for arg_id, values in text_id_to_relations_map.items():
|
| 274 |
-
#print(f"ID: {arg_id}")
|
| 275 |
-
# for value in values:
|
| 276 |
-
# (value)
|
| 277 |
-
|
| 278 |
-
|
| 279 |
|
| 280 |
doc2 = ET.parse(text_filepath)
|
| 281 |
root = doc2.getroot()
|
|
@@ -284,7 +260,6 @@ class Semeval2018Task7(datasets.GeneratorBasedBuilder):
|
|
| 284 |
if child.find("title")==None:
|
| 285 |
continue
|
| 286 |
text_id = child.attrib
|
| 287 |
-
#print("text_id", text_id)
|
| 288 |
|
| 289 |
if child.find("abstract")==None:
|
| 290 |
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
#
|
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
| 20 |
import xml.dom.minidom
|
| 21 |
import xml.etree.ElementTree as ET
|
| 22 |
|
|
|
|
| 23 |
_CITATION = """\
|
| 24 |
@inproceedings{gabor-etal-2018-semeval,
|
| 25 |
title = "{S}em{E}val-2018 Task 7: Semantic Relation Extraction and Classification in Scientific Papers",
|
|
|
|
| 47 |
}
|
| 48 |
"""
|
| 49 |
|
|
|
|
| 50 |
_DESCRIPTION = """\
|
| 51 |
This paper describes the first task on semantic relation extraction and classification in scientific paper
|
| 52 |
abstracts at SemEval 2018. The challenge focuses on domain-specific semantic relations and includes three
|
|
|
|
| 57 |
with 158 submissions across different scenarios.
|
| 58 |
"""
|
| 59 |
|
|
|
|
| 60 |
_HOMEPAGE = "https://github.com/gkata/SemEval2018Task7/tree/testing"
|
| 61 |
|
|
|
|
| 62 |
_LICENSE = ""
|
| 63 |
|
| 64 |
# Add link to the official dataset URLs here
|
|
|
|
| 185 |
)
|
| 186 |
|
| 187 |
return datasets.DatasetInfo(
|
|
|
|
| 188 |
description=_DESCRIPTION,
|
| 189 |
+
features=features,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
homepage=_HOMEPAGE,
|
|
|
|
| 191 |
license=_LICENSE,
|
|
|
|
| 192 |
citation=_CITATION,
|
| 193 |
)
|
| 194 |
|
|
|
|
| 251 |
if arg_id not in text_id_to_relations_map:
|
| 252 |
text_id_to_relations_map[arg_id] = [relation]
|
| 253 |
else:
|
| 254 |
+
text_id_to_relations_map[arg_id].append(relation)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
doc2 = ET.parse(text_filepath)
|
| 257 |
root = doc2.getroot()
|
|
|
|
| 260 |
if child.find("title")==None:
|
| 261 |
continue
|
| 262 |
text_id = child.attrib
|
|
|
|
| 263 |
|
| 264 |
if child.find("abstract")==None:
|
| 265 |
continue
|