File size: 3,845 Bytes
0fbd0d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218d456
0fbd0d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""args.me Dataset"""


import json

import datasets

_CITATION = """\
@dataset{yamen_ajjour_2020_4139439,
  author       = {Yamen Ajjour and
                  Henning Wachsmuth and
                  Johannes Kiesel and
                  Martin Potthast and
                  Matthias Hagen and
                  Benno Stein},
  title        = {args.me corpus},
  month        = oct,
  year         = 2020,
  publisher    = {Zenodo},
  version      = {1.0-cleaned},
  doi          = {10.5281/zenodo.4139439},
  url          = {https://doi.org/10.5281/zenodo.4139439}
}
"""


_DESCRIPTION = """\
The args.me corpus (version 1.0, cleaned) comprises 382 545 arguments crawled from four debate portals in the middle of 2019. The debate portals are Debatewise, IDebate.org, Debatepedia, and Debate.org. The arguments are extracted using heuristics that are designed for each debate portal.
"""

_HOMEPAGE = "https://zenodo.org/record/4139439"

_LICENSE = "https://creativecommons.org/licenses/by/4.0/legalcode"


_REPO = "https://huggingface.co/datasets/cakiki/args_me/resolve/main"
_URLs = {
    'corpus': f"{_REPO}/args-me.jsonl",
    'topics': f"{_REPO}/topics.jsonl",
    'judgments': f"{_REPO}/judgments.jsonl"
}


class ArgsMe(datasets.GeneratorBasedBuilder):
    """382,545 arguments crawled from debate portals"""

    VERSION = datasets.Version("1.1.0")
    BUILDER_CONFIGS = [
        datasets.BuilderConfig(name="corpus", version=VERSION, description="The args.me dataset"),
        datasets.BuilderConfig(name="topics", version=VERSION, description="The args.me dataset"),
        datasets.BuilderConfig(name="judgments", version=VERSION, description="The args.me dataset"),
    ]

    DEFAULT_CONFIG_NAME = "corpus" 

    def _info(self):
        features = datasets.Features(
            {
                "argument": datasets.Value("string"),
                "conclusion": datasets.Value("string"),
                "stance": datasets.Value("string"),
                "id": datasets.Value("string")
            }
        )
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=features,
            supervised_keys=None,
            homepage=_HOMEPAGE,
            license=_LICENSE,
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        """Returns SplitGenerators."""
        URL = _URLs[self.config.name]
        data_file = dl_manager.download(URL)
        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "data_file": data_file,
                },
            ),
        ]

    def _generate_examples(self, data_file):
        """ Yields examples as (key, example) tuples. """


        with open(data_file, encoding="utf-8") as f:
            for row in f:
                data = json.loads(row)
                id_ = data['id']
                content = data["premises"][0]
                yield id_, {
                    "argument": content['text'],
                    "conclusion": data["conclusion"],
                    "stance": content['stance'],
                    "id": id_
                }