Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Languages:
Polish
Size:
10K - 100K
License:
Commit
•
7725d1e
1
Parent(s):
a8dfb46
Delete loading script
Browse files
cdt.py
DELETED
@@ -1,93 +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 |
-
"""Cyberbullying detection task"""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
import os
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
from datasets.tasks import TextClassification
|
23 |
-
|
24 |
-
|
25 |
-
_CITATION = """\
|
26 |
-
@article{ptaszynski2019results,
|
27 |
-
title={Results of the PolEval 2019 Shared Task 6: First Dataset and Open Shared Task for Automatic Cyberbullying Detection in Polish Twitter},
|
28 |
-
author={Ptaszynski, Michal and Pieciukiewicz, Agata and Dybala, Pawel},
|
29 |
-
journal={Proceedings of the PolEval 2019 Workshop},
|
30 |
-
publisher={Institute of Computer Science, Polish Academy of Sciences},
|
31 |
-
pages={89},
|
32 |
-
year={2019}
|
33 |
-
}
|
34 |
-
"""
|
35 |
-
|
36 |
-
_DESCRIPTION = """\
|
37 |
-
The Cyberbullying Detection task was part of 2019 edition of PolEval competition. The goal is to predict if a given Twitter message contains a cyberbullying (harmful) content.
|
38 |
-
"""
|
39 |
-
|
40 |
-
_HOMEPAGE = "https://github.com/ptaszynski/cyberbullying-Polish"
|
41 |
-
|
42 |
-
_LICENSE = "BSD 3-Clause"
|
43 |
-
|
44 |
-
_URLs = "https://klejbenchmark.com/static/data/klej_cbd.zip"
|
45 |
-
|
46 |
-
|
47 |
-
class Cdt(datasets.GeneratorBasedBuilder):
|
48 |
-
"""CyberbullyingDetectionTask"""
|
49 |
-
|
50 |
-
VERSION = datasets.Version("1.1.0")
|
51 |
-
|
52 |
-
def _info(self):
|
53 |
-
return datasets.DatasetInfo(
|
54 |
-
description=_DESCRIPTION,
|
55 |
-
features=datasets.Features(
|
56 |
-
{
|
57 |
-
"sentence": datasets.Value("string"),
|
58 |
-
"target": datasets.ClassLabel(names=["0", "1"]),
|
59 |
-
}
|
60 |
-
),
|
61 |
-
supervised_keys=None,
|
62 |
-
homepage=_HOMEPAGE,
|
63 |
-
license=_LICENSE,
|
64 |
-
citation=_CITATION,
|
65 |
-
task_templates=[TextClassification(text_column="sentence", label_column="target")],
|
66 |
-
)
|
67 |
-
|
68 |
-
def _split_generators(self, dl_manager):
|
69 |
-
"""Returns SplitGenerators."""
|
70 |
-
data_dir = dl_manager.download_and_extract(_URLs)
|
71 |
-
return [
|
72 |
-
datasets.SplitGenerator(
|
73 |
-
name=datasets.Split.TRAIN,
|
74 |
-
gen_kwargs={
|
75 |
-
"filepath": os.path.join(data_dir, "train.tsv"),
|
76 |
-
"split": "train",
|
77 |
-
},
|
78 |
-
),
|
79 |
-
datasets.SplitGenerator(
|
80 |
-
name=datasets.Split.TEST,
|
81 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "test_features.tsv"), "split": "test"},
|
82 |
-
),
|
83 |
-
]
|
84 |
-
|
85 |
-
def _generate_examples(self, filepath, split):
|
86 |
-
"""Yields examples."""
|
87 |
-
with open(filepath, encoding="utf-8") as f:
|
88 |
-
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
89 |
-
for id_, row in enumerate(reader):
|
90 |
-
yield id_, {
|
91 |
-
"sentence": row["sentence"],
|
92 |
-
"target": -1 if split == "test" else row["target"],
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|