Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
topic-classification
Languages:
German
Size:
10K - 100K
License:
Convert dataset to Parquet
#4
by
albertvillanova
HF staff
- opened
- README.md +11 -4
- data/test-00000-of-00001.parquet +3 -0
- data/train-00000-of-00001.parquet +3 -0
- gnad10.py +0 -88
README.md
CHANGED
@@ -37,13 +37,20 @@ dataset_info:
|
|
37 |
'8': Kultur
|
38 |
splits:
|
39 |
- name: train
|
40 |
-
num_bytes:
|
41 |
num_examples: 9245
|
42 |
- name: test
|
43 |
-
num_bytes:
|
44 |
num_examples: 1028
|
45 |
-
download_size:
|
46 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
---
|
48 |
|
49 |
# Dataset Card for 10k German News Articles Datasets
|
|
|
37 |
'8': Kultur
|
38 |
splits:
|
39 |
- name: train
|
40 |
+
num_bytes: 24418220
|
41 |
num_examples: 9245
|
42 |
- name: test
|
43 |
+
num_bytes: 2756401
|
44 |
num_examples: 1028
|
45 |
+
download_size: 17244356
|
46 |
+
dataset_size: 27174621
|
47 |
+
configs:
|
48 |
+
- config_name: default
|
49 |
+
data_files:
|
50 |
+
- split: train
|
51 |
+
path: data/train-*
|
52 |
+
- split: test
|
53 |
+
path: data/test-*
|
54 |
---
|
55 |
|
56 |
# Dataset Card for 10k German News Articles Datasets
|
data/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e41f0625bb8d484e8520831e2c40c8dc22d7b2b42c72d6492e6d72dc5da7cdf6
|
3 |
+
size 1760077
|
data/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:922be5c13e771aea80df739f1d0831499448fc35417342c1c3fbebbd82ddc72a
|
3 |
+
size 15484279
|
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}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|