|
"""The SciDTB-Argmin dataset for Argumentation Mining on English scientific abstracts.""" |
|
import glob |
|
import json |
|
from os.path import abspath, isdir |
|
from pathlib import Path |
|
|
|
import datasets |
|
|
|
_CITATION = """\ |
|
@inproceedings{accuosto-saggion-2019-transferring, |
|
title = "Transferring Knowledge from Discourse to Arguments: A Case Study with Scientific Abstracts", |
|
author = "Accuosto, Pablo and |
|
Saggion, Horacio", |
|
booktitle = "Proceedings of the 6th Workshop on Argument Mining", |
|
month = aug, |
|
year = "2019", |
|
address = "Florence, Italy", |
|
publisher = "Association for Computational Linguistics", |
|
url = "https://aclanthology.org/W19-4505", |
|
doi = "10.18653/v1/W19-4505", |
|
pages = "41--51", |
|
abstract = "In this work we propose to leverage resources available with discourse-level annotations to facilitate the identification of argumentative components and relations in scientific texts, which has been recognized as a particularly challenging task. In particular, we implement and evaluate a transfer learning approach in which contextualized representations learned from discourse parsing tasks are used as input of argument mining models. As a pilot application, we explore the feasibility of using automatically identified argumentative components and relations to predict the acceptance of papers in computer science venues. In order to conduct our experiments, we propose an annotation scheme for argumentative units and relations and use it to enrich an existing corpus with an argumentation layer.", |
|
} |
|
|
|
""" |
|
|
|
_DESCRIPTION = ( |
|
"The SciDTB-Argmin dataset for Argumentation Mining on English scientific abstracts." |
|
) |
|
|
|
_HOMEPAGE = "" |
|
|
|
_LICENSE = "" |
|
|
|
|
|
|
|
|
|
_URL = "http://scientmin.taln.upf.edu/argmin/scidtb_argmin_annotations.tgz" |
|
|
|
_VERSION = datasets.Version("1.0.0") |
|
|
|
_SPAN_CLASS_LABELS = [ |
|
"proposal", |
|
"assertion", |
|
"result", |
|
"observation", |
|
"means", |
|
"description", |
|
"none", |
|
] |
|
_RELATION_CLASS_LABELS = ["support", "additional", "detail", "sequence", "none"] |
|
|
|
|
|
class SciDTBArgmin(datasets.GeneratorBasedBuilder): |
|
"""SciDTB-Argmin is an argumentation mining dataset.""" |
|
|
|
BUILDER_CONFIGS = [datasets.BuilderConfig(name="default")] |
|
|
|
DEFAULT_CONFIG_NAME = "default" |
|
|
|
def _info(self): |
|
features = datasets.Features( |
|
{ |
|
"id": datasets.Value("string"), |
|
"data": datasets.Sequence( |
|
{ |
|
"token": datasets.Value("string"), |
|
"unit-bio": datasets.ClassLabel(names=["B", "I", "O"]), |
|
"unit-label": datasets.ClassLabel(names=_SPAN_CLASS_LABELS), |
|
"role": datasets.ClassLabel(names=_RELATION_CLASS_LABELS), |
|
"parent-offset": datasets.Value("int32"), |
|
|
|
} |
|
), |
|
} |
|
) |
|
|
|
return datasets.DatasetInfo( |
|
|
|
description=_DESCRIPTION, |
|
|
|
features=features, |
|
|
|
|
|
|
|
supervised_keys=None, |
|
|
|
homepage=_HOMEPAGE, |
|
|
|
license=_LICENSE, |
|
|
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
"""Returns SplitGenerators.""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
if dl_manager.manual_dir is not None: |
|
base_path = abspath(dl_manager.manual_dir) |
|
if not isdir(base_path): |
|
base_path = dl_manager.extract(base_path) |
|
else: |
|
base_path = dl_manager.download_and_extract(_URL) |
|
|
|
return [ |
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"path": base_path}), |
|
] |
|
|
|
def _generate_examples(self, path): |
|
"""Yields examples.""" |
|
|
|
|
|
|
|
|
|
_id = 0 |
|
conll_file_names = sorted(glob.glob(f"{path}/*.conll")) |
|
for conll_file_name in conll_file_names: |
|
data = [] |
|
with open(conll_file_name, encoding="utf-8") as f: |
|
for line in f: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
token, annotation = line.strip().split("\t") |
|
unit_bio, unit_label, role, parent_offset_str = annotation.split( |
|
"-", maxsplit=3 |
|
) |
|
parent_offset = int(parent_offset_str) |
|
data.append( |
|
{ |
|
"token": token, |
|
"unit-bio": unit_bio, |
|
"unit-label": unit_label, |
|
"role": role, |
|
"parent-offset": parent_offset, |
|
} |
|
) |
|
yield _id, { |
|
"id": Path(conll_file_name).stem, |
|
"data": data, |
|
} |
|
_id += 1 |
|
|