Datasets:
Tasks:
Text Classification
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
hate-speech-detection
License:
Convert dataset to Parquet
#2
by
albertvillanova
HF staff
- opened
- README.md +8 -3
- data/train-00000-of-00001.parquet +3 -0
- dataset_infos.json +0 -1
- hate_speech_offensive.py +0 -105
README.md
CHANGED
@@ -42,10 +42,15 @@ dataset_info:
|
|
42 |
dtype: string
|
43 |
splits:
|
44 |
- name: train
|
45 |
-
num_bytes:
|
46 |
num_examples: 24783
|
47 |
-
download_size:
|
48 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
49 |
train-eval-index:
|
50 |
- config: default
|
51 |
task: text-classification
|
|
|
42 |
dtype: string
|
43 |
splits:
|
44 |
- name: train
|
45 |
+
num_bytes: 3207814
|
46 |
num_examples: 24783
|
47 |
+
download_size: 1627672
|
48 |
+
dataset_size: 3207814
|
49 |
+
configs:
|
50 |
+
- config_name: default
|
51 |
+
data_files:
|
52 |
+
- split: train
|
53 |
+
path: data/train-*
|
54 |
train-eval-index:
|
55 |
- config: default
|
56 |
task: text-classification
|
data/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd9fa2324dd645e46615b52cff924058933eb2ceff6699c7b02fcbdd5167a7b3
|
3 |
+
size 1627672
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"default": {"description": "An annotated dataset for hate speech and offensive language detection on tweets.\n", "citation": "@inproceedings{hateoffensive,\ntitle = {Automated Hate Speech Detection and the Problem of Offensive Language},\nauthor = {Davidson, Thomas and Warmsley, Dana and Macy, Michael and Weber, Ingmar},\nbooktitle = {Proceedings of the 11th International AAAI Conference on Web and Social Media},\nseries = {ICWSM '17},\nyear = {2017},\nlocation = {Montreal, Canada},\npages = {512-515}\n}\n", "homepage": "https://github.com/t-davidson/hate-speech-and-offensive-language", "license": "MIT", "features": {"count": {"dtype": "int64", "id": null, "_type": "Value"}, "hate_speech_count": {"dtype": "int64", "id": null, "_type": "Value"}, "offensive_language_count": {"dtype": "int64", "id": null, "_type": "Value"}, "neither_count": {"dtype": "int64", "id": null, "_type": "Value"}, "class": {"num_classes": 3, "names": ["hate speech", "offensive language", "neither"], "names_file": null, "id": null, "_type": "ClassLabel"}, "tweet": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "tweet", "output": "class"}, "builder_name": "hate_speech_offensive", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3207826, "num_examples": 24783, "dataset_name": "hate_speech_offensive"}}, "download_checksums": {"https://raw.githubusercontent.com/t-davidson/hate-speech-and-offensive-language/master/data/labeled_data.csv": {"num_bytes": 2546446, "checksum": "fcb8bc7c68120ae4af04a5b9acd58585513ede11e1548ebf36a5c2040b6f6281"}}, "download_size": 2546446, "post_processing_size": null, "dataset_size": 3207826, "size_in_bytes": 5754272}}
|
|
|
|
hate_speech_offensive.py
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
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 |
-
"""An annotated dataset for hate speech and offensive language detection on tweets."""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
|
20 |
-
import datasets
|
21 |
-
|
22 |
-
|
23 |
-
_CITATION = """\
|
24 |
-
@inproceedings{hateoffensive,
|
25 |
-
title = {Automated Hate Speech Detection and the Problem of Offensive Language},
|
26 |
-
author = {Davidson, Thomas and Warmsley, Dana and Macy, Michael and Weber, Ingmar},
|
27 |
-
booktitle = {Proceedings of the 11th International AAAI Conference on Web and Social Media},
|
28 |
-
series = {ICWSM '17},
|
29 |
-
year = {2017},
|
30 |
-
location = {Montreal, Canada},
|
31 |
-
pages = {512-515}
|
32 |
-
}
|
33 |
-
"""
|
34 |
-
|
35 |
-
_DESCRIPTION = """\
|
36 |
-
An annotated dataset for hate speech and offensive language detection on tweets.
|
37 |
-
"""
|
38 |
-
|
39 |
-
_HOMEPAGE = "https://github.com/t-davidson/hate-speech-and-offensive-language"
|
40 |
-
|
41 |
-
_LICENSE = "MIT"
|
42 |
-
|
43 |
-
_URL = "https://raw.githubusercontent.com/t-davidson/hate-speech-and-offensive-language/master/data/labeled_data.csv"
|
44 |
-
|
45 |
-
_CLASS_MAP = {
|
46 |
-
"0": "hate speech",
|
47 |
-
"1": "offensive language",
|
48 |
-
"2": "neither",
|
49 |
-
}
|
50 |
-
|
51 |
-
|
52 |
-
class HateSpeechOffensive(datasets.GeneratorBasedBuilder):
|
53 |
-
"""An annotated dataset for hate speech and offensive language detection on tweets."""
|
54 |
-
|
55 |
-
VERSION = datasets.Version("1.0.0")
|
56 |
-
|
57 |
-
def _info(self):
|
58 |
-
return datasets.DatasetInfo(
|
59 |
-
description=_DESCRIPTION,
|
60 |
-
features=datasets.Features(
|
61 |
-
{
|
62 |
-
"count": datasets.Value("int64"),
|
63 |
-
"hate_speech_count": datasets.Value("int64"),
|
64 |
-
"offensive_language_count": datasets.Value("int64"),
|
65 |
-
"neither_count": datasets.Value("int64"),
|
66 |
-
"class": datasets.ClassLabel(names=["hate speech", "offensive language", "neither"]),
|
67 |
-
"tweet": datasets.Value("string"),
|
68 |
-
}
|
69 |
-
),
|
70 |
-
supervised_keys=("tweet", "class"),
|
71 |
-
homepage=_HOMEPAGE,
|
72 |
-
license=_LICENSE,
|
73 |
-
citation=_CITATION,
|
74 |
-
)
|
75 |
-
|
76 |
-
def _split_generators(self, dl_manager):
|
77 |
-
"""Returns SplitGenerators."""
|
78 |
-
|
79 |
-
data_file = dl_manager.download_and_extract(_URL)
|
80 |
-
return [
|
81 |
-
datasets.SplitGenerator(
|
82 |
-
name=datasets.Split.TRAIN,
|
83 |
-
gen_kwargs={
|
84 |
-
"filepath": data_file,
|
85 |
-
},
|
86 |
-
),
|
87 |
-
]
|
88 |
-
|
89 |
-
def _generate_examples(self, filepath):
|
90 |
-
"""Yields examples."""
|
91 |
-
|
92 |
-
with open(filepath, encoding="utf-8") as f:
|
93 |
-
reader = csv.reader(f)
|
94 |
-
for id_, row in enumerate(reader):
|
95 |
-
if id_ == 0:
|
96 |
-
continue
|
97 |
-
|
98 |
-
yield id_, {
|
99 |
-
"count": row[1],
|
100 |
-
"hate_speech_count": row[2],
|
101 |
-
"offensive_language_count": row[3],
|
102 |
-
"neither_count": row[4],
|
103 |
-
"class": _CLASS_MAP[row[5]],
|
104 |
-
"tweet": row[6],
|
105 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|