Delete loading script
Browse files- GermEval18.py +0 -103
GermEval18.py
DELETED
@@ -1,103 +0,0 @@
|
|
1 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
"""Loader script for the GermEval 18 dataset"""
|
15 |
-
|
16 |
-
|
17 |
-
import csv
|
18 |
-
import json
|
19 |
-
import os
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
|
23 |
-
|
24 |
-
_CITATION = """\
|
25 |
-
@data{data/0B5VML_2019,
|
26 |
-
author = {Wiegand, Michael},
|
27 |
-
publisher = {heiDATA},
|
28 |
-
title = {{GermEval-2018 Corpus (DE)}},
|
29 |
-
year = {2019},
|
30 |
-
version = {V1},
|
31 |
-
doi = {10.11588/data/0B5VML},
|
32 |
-
url = {https://doi.org/10.11588/data/0B5VML}
|
33 |
-
}
|
34 |
-
"""
|
35 |
-
|
36 |
-
_DESCRIPTION = """\
|
37 |
-
This dataset comprises the training and test data (German tweets) from the GermEval 2018 Shared on Offensive Language Detection.
|
38 |
-
"""
|
39 |
-
|
40 |
-
_HOMEPAGE = "https://doi.org/10.11588/data/0B5VML"
|
41 |
-
|
42 |
-
_LICENSE = "CC-BY-4.0 Deed"
|
43 |
-
|
44 |
-
# The files are pulled from the official GitHub repository.
|
45 |
-
# https://github.com/uds-lsv/GermEval-2018-Data
|
46 |
-
# We use the hashed URL from master branch / June 3th 2024.
|
47 |
-
_URLS = {
|
48 |
-
"germeval18.test.txt": "https://raw.githubusercontent.com/uds-lsv/GermEval-2018-Data/9877472d39523effd54cd079b4c61157ed141508/germeval2018.test.txt",
|
49 |
-
"germeval18.train.txt": "https://raw.githubusercontent.com/uds-lsv/GermEval-2018-Data/9877472d39523effd54cd079b4c61157ed141508/germeval2018.training.txt",
|
50 |
-
}
|
51 |
-
|
52 |
-
class GermEval18(datasets.GeneratorBasedBuilder):
|
53 |
-
"""The GermEval18 dataset"""
|
54 |
-
|
55 |
-
VERSION = datasets.Version("1.1.0")
|
56 |
-
|
57 |
-
def _info(self):
|
58 |
-
features = datasets.Features(
|
59 |
-
{
|
60 |
-
"text": datasets.Value("string"),
|
61 |
-
'coarse': datasets.ClassLabel(num_classes=2, names=['OTHER', 'OFFENSE'], names_file=None, id=None),
|
62 |
-
'fine': datasets.ClassLabel(num_classes=4, names=['OTHER', 'ABUSE', 'INSULT', 'PROFANITY'], names_file=None, id=None),
|
63 |
-
}
|
64 |
-
)
|
65 |
-
return datasets.DatasetInfo(
|
66 |
-
description=_DESCRIPTION,
|
67 |
-
features=features,
|
68 |
-
homepage=_HOMEPAGE,
|
69 |
-
license=_LICENSE,
|
70 |
-
citation=_CITATION,
|
71 |
-
)
|
72 |
-
|
73 |
-
def _split_generators(self, dl_manager):
|
74 |
-
downloaded_files = dl_manager.download(_URLS)
|
75 |
-
|
76 |
-
return [
|
77 |
-
datasets.SplitGenerator(
|
78 |
-
name=datasets.Split.TRAIN,
|
79 |
-
gen_kwargs={
|
80 |
-
"filepath": downloaded_files["germeval18.train.txt"],
|
81 |
-
"split": "train",
|
82 |
-
},
|
83 |
-
),
|
84 |
-
datasets.SplitGenerator(
|
85 |
-
name=datasets.Split.TEST,
|
86 |
-
# These kwargs will be passed to _generate_examples
|
87 |
-
gen_kwargs={
|
88 |
-
"filepath": downloaded_files["germeval18.test.txt"],
|
89 |
-
"split": "test"
|
90 |
-
},
|
91 |
-
),
|
92 |
-
]
|
93 |
-
|
94 |
-
def _generate_examples(self, filepath, split):
|
95 |
-
with open(filepath, encoding="utf-8") as f:
|
96 |
-
for key, row in enumerate(f):
|
97 |
-
# Every line only has two "\t" tabs.
|
98 |
-
data_text, lbl_coarse, lbl_fine = row.rstrip().split("\t")
|
99 |
-
yield key, {
|
100 |
-
"text": data_text,
|
101 |
-
"coarse": lbl_coarse,
|
102 |
-
"fine": lbl_fine,
|
103 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|