|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""TexPrax: Data collected during the project https://texprax.de/ """ |
|
|
|
|
|
import csv |
|
import os |
|
import ast |
|
|
|
|
|
import datasets |
|
|
|
|
|
_CITATION = """\ |
|
@inproceedings{reimers2019classification, |
|
title={Classification and Clustering of Arguments with Contextualized Word Embeddings}, |
|
author={Reimers, Nils and Schiller, Benjamin and Beck, Tilman and Daxenberger, Johannes and Stab, Christian and Gurevych, Iryna}, |
|
booktitle={Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics}, |
|
pages={567--578}, |
|
year={2019} |
|
} |
|
""" |
|
|
|
|
|
_DESCRIPTION = """\ |
|
The UKP ASPECT Corpus includes 3,595 sentence pairs over 28 controversial topics. The sentences were crawled from a large web crawl and identified as arguments for a given topic using the ArgumenText system. The sampling and matching of the sentence pairs is described in the paper. Then, the argument similarity annotation was done via crowdsourcing. Each crowd worker could choose from four annotation options (the exact guidelines are provided in the Appendix of the paper). |
|
""" |
|
|
|
|
|
_HOMEPAGE = "https://tudatalib.ulb.tu-darmstadt.de/handle/tudatalib/1998" |
|
|
|
|
|
_LICENSE = "Creative Commons Attribution-NonCommercial 3.0" |
|
|
|
|
|
|
|
_URL = "https://tudatalib.ulb.tu-darmstadt.de/bitstream/handle/tudatalib/1998/UKP_ASPECT.zip?sequence=1&isAllowed=y" |
|
|
|
class UKPAspectConfig(datasets.BuilderConfig): |
|
"""BuilderConfig for UKP ASPECT.""" |
|
def __init__(self, features, data_url, citation, url, label_classes=("False", "True"), **kwargs): |
|
super(UKPAspectConfig, self).__init__(**kwargs) |
|
|
|
|
|
class UKPAspectDataset(datasets.GeneratorBasedBuilder): |
|
"""3,595 sentence pairs over 28 controversial topics. The sentences were crawled from a large web crawl and identified as arguments for a given topic using the ArgumenText system. The sampling and matching of the sentence pairs is described in the paper. Then, the argument similarity annotation was done via crowdsourcing. Each crowd worker could choose from four annotation options (the exact guidelines are provided in the Appendix of the paper).""" |
|
|
|
VERSION = datasets.Version("1.1.0") |
|
|
|
BUILDER_CONFIGS = [ |
|
datasets.BuilderConfig(name="standard", version=VERSION, description="Sentence pairs annotated with argument similarity") |
|
] |
|
|
|
DEFAULT_CONFIG_NAME = "standard" |
|
|
|
def _info(self): |
|
if self.config.name == "standard": |
|
features = datasets.Features( |
|
{ |
|
|
|
"topic": datasets.Value("string"), |
|
"sentence_1": datasets.Value("string"), |
|
"sentence_2": datasets.Value("string"), |
|
"label": datasets.features.ClassLabel( |
|
names=[ |
|
"NS", |
|
"SS", |
|
"DTORCD", |
|
"HS", |
|
]), |
|
|
|
} |
|
) |
|
else: |
|
raise ValueError(f'The only available config is "standard", but "{self.config.name}" was given') |
|
return datasets.DatasetInfo( |
|
|
|
description=_DESCRIPTION, |
|
|
|
features=features, |
|
|
|
|
|
|
|
|
|
homepage=_HOMEPAGE, |
|
|
|
license=_LICENSE, |
|
|
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
|
|
|
|
if self.config.name == "standard": |
|
urls = _URL |
|
data_dir = dl_manager.download_and_extract(urls) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
|
|
gen_kwargs={ |
|
"filepath": os.path.join(data_dir, "UKP_ASPECT.tsv"), |
|
"split": "train", |
|
}, |
|
) |
|
] |
|
else: |
|
raise ValueError(f'The only available config is "standard", but "{self.config.name}" was given') |
|
|
|
|
|
|
|
def _generate_examples(self, filepath, split): |
|
|
|
|
|
with open(filepath, encoding="utf-8") as f: |
|
creader = csv.reader(f, delimiter='\t', quotechar='"') |
|
next(creader) |
|
for key, row in enumerate(creader): |
|
|
|
if self.config.name == "standard": |
|
topic, sentence_1, sentence_2, label = row |
|
|
|
|
|
yield key, { |
|
"topic": topic, |
|
"sentence_1": sentence_1, |
|
"sentence_2": sentence_2, |
|
"label": label, |
|
} |
|
else: |
|
raise ValueError(f'The only available config is "standard", but "{self.config.name}" was given') |
|
|
|
|
|
|
|
|