albertvillanova HF staff commited on
Commit
4f4f5e0
1 Parent(s): 5f5bab0

Delete loading script

Browse files
Files changed (1) hide show
  1. gnad10.py +0 -88
gnad10.py DELETED
@@ -1,88 +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
- """Ten Thousand German News Articles Dataset"""
16
-
17
-
18
- import csv
19
-
20
- import datasets
21
- from datasets.tasks import TextClassification
22
-
23
-
24
- _DESCRIPTION = """\
25
- This dataset is intended to advance topic classification for German texts. A classifier that is efffective in
26
- English may not be effective in German dataset because it has a higher inflection and longer compound words.
27
- The 10kGNAD dataset contains 10273 German news articles from an Austrian online newspaper categorized into
28
- 9 categories. Article titles and text are concatenated together and authors are removed to avoid a keyword-like
29
- classification on authors that write frequently about one category. This dataset can be used as a benchmark
30
- for German topic classification.
31
- """
32
-
33
- _HOMEPAGE = "https://tblock.github.io/10kGNAD/"
34
-
35
- _LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 4.0"
36
-
37
- _TRAIN_DOWNLOAD_URL = "https://raw.githubusercontent.com/tblock/10kGNAD/master/train.csv"
38
- _TEST_DOWNLOAD_URL = "https://raw.githubusercontent.com/tblock/10kGNAD/master/test.csv"
39
-
40
-
41
- class Gnad10(datasets.GeneratorBasedBuilder):
42
- """10k German news articles for topic classification"""
43
-
44
- VERSION = datasets.Version("1.1.0")
45
-
46
- def _info(self):
47
- return datasets.DatasetInfo(
48
- description=_DESCRIPTION,
49
- features=datasets.Features(
50
- {
51
- "text": datasets.Value("string"),
52
- "label": datasets.features.ClassLabel(
53
- names=[
54
- "Web",
55
- "Panorama",
56
- "International",
57
- "Wirtschaft",
58
- "Sport",
59
- "Inland",
60
- "Etat",
61
- "Wissenschaft",
62
- "Kultur",
63
- ]
64
- ),
65
- }
66
- ),
67
- homepage="https://tblock.github.io/10kGNAD/",
68
- task_templates=[TextClassification(text_column="text", label_column="label")],
69
- )
70
-
71
- def _split_generators(self, dl_manager):
72
- """Returns SplitGenerators."""
73
-
74
- train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
75
- test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
76
- return [
77
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
78
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
79
- ]
80
-
81
- def _generate_examples(self, filepath):
82
- """Generate German news articles examples."""
83
-
84
- with open(filepath, encoding="utf-8") as csv_file:
85
- csv_reader = csv.reader(csv_file, delimiter=";", quotechar="'", quoting=csv.QUOTE_ALL)
86
- for id_, row in enumerate(csv_reader):
87
- label, text = row
88
- yield id_, {"text": text, "label": label}