Datasets:
Commit
·
08b7941
1
Parent(s):
deb2599
Update parquet files
Browse files- .gitattributes +0 -27
- README.md +0 -19
- airline-sentiment/crowdflower-train.parquet +3 -0
- corporate-messaging/crowdflower-train.parquet +3 -0
- crowdflower.py +0 -210
- economic-news/crowdflower-train.parquet +3 -0
- political-media-audience/crowdflower-train.parquet +3 -0
- political-media-bias/crowdflower-train.parquet +3 -0
- political-media-message/crowdflower-train.parquet +3 -0
- sentiment_nuclear_power/crowdflower-train.parquet +3 -0
- text_emotion/crowdflower-train.parquet +3 -0
- tweet_global_warming/crowdflower-train.parquet +3 -0
.gitattributes
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
-
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
---
|
2 |
-
annotations_creators:
|
3 |
-
- crowdsourced
|
4 |
-
language:
|
5 |
-
- en
|
6 |
-
language_creators:
|
7 |
-
- crowdsourced
|
8 |
-
license: []
|
9 |
-
multilinguality:
|
10 |
-
- monolingual
|
11 |
-
pretty_name: ethics
|
12 |
-
size_categories:
|
13 |
-
- unknown
|
14 |
-
source_datasets: []
|
15 |
-
tags: []
|
16 |
-
task_categories:
|
17 |
-
- text-classification
|
18 |
-
task_ids: []
|
19 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
airline-sentiment/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8ac4de0751b922c69a930974a85a386479a988304e22749131f2bcdb621a47cf
|
3 |
+
size 1063840
|
corporate-messaging/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:397efe8756cdc747250f033488330cfff5439b9112373cbffbe6a3aa735a0745
|
3 |
+
size 244809
|
crowdflower.py
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
|
16 |
-
# Lint as: python3
|
17 |
-
"""Crowdflower datasets"""
|
18 |
-
|
19 |
-
from __future__ import absolute_import, division, print_function
|
20 |
-
|
21 |
-
import csv
|
22 |
-
import os
|
23 |
-
import textwrap
|
24 |
-
|
25 |
-
import six
|
26 |
-
|
27 |
-
import datasets
|
28 |
-
|
29 |
-
|
30 |
-
_crowdflower_CITATION = r"""
|
31 |
-
@inproceedings{van2012designing,
|
32 |
-
title={Designing a scalable crowdsourcing platform},
|
33 |
-
author={Van Pelt, Chris and Sorokin, Alex},
|
34 |
-
booktitle={Proceedings of the 2012 ACM SIGMOD International Conference on Management of Data},
|
35 |
-
pages={765--766},
|
36 |
-
year={2012}
|
37 |
-
}
|
38 |
-
"""
|
39 |
-
|
40 |
-
_crowdflower_DESCRIPTION = """
|
41 |
-
Collection of crowdflower classification datasets
|
42 |
-
"""
|
43 |
-
|
44 |
-
DATA_URL = "https://www.dropbox.com/s/ldrcdsv8d9qiwg0/crowdflower.zip?dl=1"
|
45 |
-
|
46 |
-
TASK_TO_LABELS = {'airline-sentiment': ['neutral', 'positive', 'negative'],
|
47 |
-
'corporate-messaging': ['Information', 'Action', 'Exclude', 'Dialogue'],
|
48 |
-
'economic-news': ['not sure', 'yes', 'no'],
|
49 |
-
'political-media-audience': ['constituency', 'national'],
|
50 |
-
'political-media-bias': ['partisan', 'neutral'],
|
51 |
-
'political-media-message': ['information',
|
52 |
-
'support',
|
53 |
-
'policy',
|
54 |
-
'constituency',
|
55 |
-
'personal',
|
56 |
-
'other',
|
57 |
-
'media',
|
58 |
-
'mobilization',
|
59 |
-
'attack'],
|
60 |
-
'sentiment_nuclear_power': ['Neutral / author is just sharing information',
|
61 |
-
'Negative',
|
62 |
-
'Tweet NOT related to nuclear energy',
|
63 |
-
'Positive'],
|
64 |
-
'text_emotion': ['sadness',
|
65 |
-
'empty',
|
66 |
-
'relief',
|
67 |
-
'hate',
|
68 |
-
'worry',
|
69 |
-
'enthusiasm',
|
70 |
-
'happiness',
|
71 |
-
'neutral',
|
72 |
-
'love',
|
73 |
-
'fun',
|
74 |
-
'anger',
|
75 |
-
'surprise',
|
76 |
-
'boredom'],
|
77 |
-
'tweet_global_warming': ['Yes', 'No']}
|
78 |
-
|
79 |
-
def get_labels(task):
|
80 |
-
return TASK_TO_LABELS[task]
|
81 |
-
|
82 |
-
class crowdflowerConfig(datasets.BuilderConfig):
|
83 |
-
"""BuilderConfig for crowdflower."""
|
84 |
-
|
85 |
-
def __init__(
|
86 |
-
self,
|
87 |
-
text_features,
|
88 |
-
label_classes=None,
|
89 |
-
process_label=lambda x: x,
|
90 |
-
**kwargs,
|
91 |
-
):
|
92 |
-
"""BuilderConfig for crowdflower.
|
93 |
-
Args:
|
94 |
-
text_features: `dict[string, string]`, map from the name of the feature
|
95 |
-
dict for each text field to the name of the column in the tsv file
|
96 |
-
label_column: `string`, name of the column in the tsv file corresponding
|
97 |
-
to the label
|
98 |
-
data_url: `string`, url to download the zip file from
|
99 |
-
data_dir: `string`, the path to the folder containing the tsv files in the
|
100 |
-
downloaded zip
|
101 |
-
citation: `string`, citation for the data set
|
102 |
-
url: `string`, url for information about the data set
|
103 |
-
label_classes: `list[string]`, the list of classes if the label is
|
104 |
-
categorical. If not provided, then the label will be of type
|
105 |
-
`datasets.Value('float32')`.
|
106 |
-
process_label: `Function[string, any]`, function taking in the raw value
|
107 |
-
of the label and processing it to the form required by the label feature
|
108 |
-
**kwargs: keyword arguments forwarded to super.
|
109 |
-
"""
|
110 |
-
|
111 |
-
super(crowdflowerConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
112 |
-
|
113 |
-
self.text_features = text_features
|
114 |
-
self.label_column = "label"
|
115 |
-
self.label_classes = get_labels(self.name)
|
116 |
-
self.data_url = DATA_URL
|
117 |
-
self.data_dir = os.path.join("crowdflower", self.name)
|
118 |
-
self.citation = textwrap.dedent(_crowdflower_CITATION)
|
119 |
-
def process_label(x):
|
120 |
-
x=str(x)
|
121 |
-
if x=="Y":
|
122 |
-
return "Yes"
|
123 |
-
if x=="N":
|
124 |
-
return "No"
|
125 |
-
return x
|
126 |
-
self.process_label = process_label
|
127 |
-
self.description = ""
|
128 |
-
self.url = ""
|
129 |
-
|
130 |
-
|
131 |
-
class crowdflower(datasets.GeneratorBasedBuilder):
|
132 |
-
|
133 |
-
"""The General Language Understanding Evaluation (crowdflower) benchmark."""
|
134 |
-
|
135 |
-
BUILDER_CONFIG_CLASS = crowdflowerConfig
|
136 |
-
|
137 |
-
BUILDER_CONFIGS = [
|
138 |
-
crowdflowerConfig(name="sentiment_nuclear_power",
|
139 |
-
text_features={"text": "text"},),
|
140 |
-
crowdflowerConfig(name="tweet_global_warming",
|
141 |
-
text_features={"text": "text"},),
|
142 |
-
crowdflowerConfig(name="airline-sentiment",
|
143 |
-
text_features={"text": "text"},),
|
144 |
-
crowdflowerConfig(name="corporate-messaging",
|
145 |
-
text_features={"text": "text"},),
|
146 |
-
crowdflowerConfig(name="economic-news",
|
147 |
-
text_features={"text": "text"},),
|
148 |
-
crowdflowerConfig(name="political-media-audience",
|
149 |
-
text_features={"text": "text"},),
|
150 |
-
crowdflowerConfig(name="political-media-bias",
|
151 |
-
text_features={"text": "text"},),
|
152 |
-
crowdflowerConfig(name="political-media-message",
|
153 |
-
text_features={"text": "text"},),
|
154 |
-
crowdflowerConfig(name="text_emotion",
|
155 |
-
text_features={"text": "text"},),
|
156 |
-
]
|
157 |
-
|
158 |
-
def _info(self):
|
159 |
-
features = {text_feature: datasets.Value("string") for text_feature in six.iterkeys(self.config.text_features)}
|
160 |
-
if self.config.label_classes:
|
161 |
-
features["label"] = datasets.features.ClassLabel(names=self.config.label_classes)
|
162 |
-
else:
|
163 |
-
features["label"] = datasets.Value("float32")
|
164 |
-
features["idx"] = datasets.Value("int32")
|
165 |
-
return datasets.DatasetInfo(
|
166 |
-
description=_crowdflower_DESCRIPTION,
|
167 |
-
features=datasets.Features(features),
|
168 |
-
homepage=self.config.url,
|
169 |
-
citation=self.config.citation + "\n" + _crowdflower_CITATION,
|
170 |
-
)
|
171 |
-
|
172 |
-
def _split_generators(self, dl_manager):
|
173 |
-
dl_dir = dl_manager.download_and_extract(self.config.data_url)
|
174 |
-
data_dir = os.path.join(dl_dir, self.config.data_dir)
|
175 |
-
|
176 |
-
return [
|
177 |
-
datasets.SplitGenerator(
|
178 |
-
name=datasets.Split.TRAIN,
|
179 |
-
gen_kwargs={
|
180 |
-
"data_file": os.path.join(data_dir or "", "train.tsv"),
|
181 |
-
"split": "train",
|
182 |
-
},
|
183 |
-
),
|
184 |
-
]
|
185 |
-
|
186 |
-
def _generate_examples(self, data_file, split):
|
187 |
-
|
188 |
-
process_label = self.config.process_label
|
189 |
-
label_classes = self.config.label_classes
|
190 |
-
|
191 |
-
with open(data_file, encoding="latin-1") as f:
|
192 |
-
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
193 |
-
|
194 |
-
for n, row in enumerate(reader):
|
195 |
-
|
196 |
-
example = {feat: row[col] for feat, col in six.iteritems(self.config.text_features)}
|
197 |
-
example["idx"] = n
|
198 |
-
#print(row)
|
199 |
-
|
200 |
-
if self.config.label_column in row:
|
201 |
-
label = row[self.config.label_column]
|
202 |
-
label = process_label(label)
|
203 |
-
if label_classes and label not in label_classes:
|
204 |
-
continue
|
205 |
-
example["label"] = label
|
206 |
-
else:
|
207 |
-
example["label"] = process_label(-1)
|
208 |
-
if not example["label"] or not example["text"]:
|
209 |
-
continue
|
210 |
-
yield example["idx"], example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
economic-news/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e9923e3d7d3acd8b06425232a7b3feddd68c89746330ff863b7a249195f69476
|
3 |
+
size 6702557
|
political-media-audience/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bb768c3512188bce56161d3a96a5b3c9ea31e1e7a807d868364f5a43f5bcacb3
|
3 |
+
size 721872
|
political-media-bias/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:38f3b7802c6c1789b08e19921834c098d635c1fac35f9bfcb6238e54f1ddf077
|
3 |
+
size 721839
|
political-media-message/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:077dec4dc538681143ba3879394696f27b8076d22ac0fb46a45a777c29015563
|
3 |
+
size 723969
|
sentiment_nuclear_power/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2f21f04d6c01f85830d4a3e43e0745350a1145f5bd51eae4f2c12b315c546518
|
3 |
+
size 16533
|
text_emotion/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f9f645f19f80d0a2544e97a2b6ae70777f66b6e5b5463f060ebc9559fddfe828
|
3 |
+
size 2623315
|
tweet_global_warming/crowdflower-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e3a126c59f1942a391813e411d1ed42542a0f84ef5ddd51d2052578df68b1c2
|
3 |
+
size 296520
|