albertvillanova HF staff commited on
Commit
799b3ff
1 Parent(s): f3cd1b0

Delete loading script

Browse files
Files changed (1) hide show
  1. hate_speech_offensive.py +0 -105
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
- }