Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Languages:
Swedish
Size:
100K - 1M
License:
Convert dataset to Parquet
#4
by
albertvillanova
HF staff
- opened
README.md
CHANGED
@@ -19,6 +19,7 @@ task_ids:
|
|
19 |
- sentiment-classification
|
20 |
pretty_name: Swedish Reviews
|
21 |
dataset_info:
|
|
|
22 |
features:
|
23 |
- name: text
|
24 |
dtype: string
|
@@ -28,19 +29,28 @@ dataset_info:
|
|
28 |
names:
|
29 |
'0': negative
|
30 |
'1': positive
|
31 |
-
config_name: plain_text
|
32 |
splits:
|
33 |
- name: test
|
34 |
-
num_bytes:
|
35 |
num_examples: 20697
|
36 |
- name: validation
|
37 |
-
num_bytes:
|
38 |
num_examples: 20696
|
39 |
- name: train
|
40 |
-
num_bytes:
|
41 |
num_examples: 62089
|
42 |
-
download_size:
|
43 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
---
|
45 |
|
46 |
# Dataset Card for Swedish Reviews
|
|
|
19 |
- sentiment-classification
|
20 |
pretty_name: Swedish Reviews
|
21 |
dataset_info:
|
22 |
+
config_name: plain_text
|
23 |
features:
|
24 |
- name: text
|
25 |
dtype: string
|
|
|
29 |
names:
|
30 |
'0': negative
|
31 |
'1': positive
|
|
|
32 |
splits:
|
33 |
- name: test
|
34 |
+
num_bytes: 6296529
|
35 |
num_examples: 20697
|
36 |
- name: validation
|
37 |
+
num_bytes: 6359215
|
38 |
num_examples: 20696
|
39 |
- name: train
|
40 |
+
num_bytes: 18842863
|
41 |
num_examples: 62089
|
42 |
+
download_size: 19622770
|
43 |
+
dataset_size: 31498607
|
44 |
+
configs:
|
45 |
+
- config_name: plain_text
|
46 |
+
data_files:
|
47 |
+
- split: test
|
48 |
+
path: plain_text/test-*
|
49 |
+
- split: validation
|
50 |
+
path: plain_text/validation-*
|
51 |
+
- split: train
|
52 |
+
path: plain_text/train-*
|
53 |
+
default: true
|
54 |
---
|
55 |
|
56 |
# Dataset Card for Swedish Reviews
|
plain_text/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a33dda3140526ea954d2f19de9bf3dc3630683252a23136cbf5caba0f978e229
|
3 |
+
size 3905563
|
plain_text/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6d837bdac3cefabaf2ac65b70084bf7cfb60488cf850907f7a67ad1be8fa926a
|
3 |
+
size 11760702
|
plain_text/validation-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d7c7d60749b6d78449386a9a0984f735b397ea0b1d0e859fd622af0c908410f8
|
3 |
+
size 3956505
|
swedish_reviews.py
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
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 |
-
|
16 |
-
# Lint as: python3
|
17 |
-
|
18 |
-
|
19 |
-
import csv
|
20 |
-
import os
|
21 |
-
|
22 |
-
import datasets
|
23 |
-
from datasets.tasks import TextClassification
|
24 |
-
|
25 |
-
|
26 |
-
_DOWNLOAD_URL = "https://raw.githubusercontent.com/timpal0l/swedish-sentiment/main/swedish_sentiment.zip"
|
27 |
-
_TRAIN_FILE = "train.csv"
|
28 |
-
_VAL_FILE = "dev.csv"
|
29 |
-
_TEST_FILE = "test.csv"
|
30 |
-
|
31 |
-
_CITATION = ""
|
32 |
-
|
33 |
-
_DESCRIPTION = "Swedish reviews scarped from various public available websites"
|
34 |
-
|
35 |
-
|
36 |
-
class SwedishReviews(datasets.GeneratorBasedBuilder):
|
37 |
-
BUILDER_CONFIGS = [
|
38 |
-
datasets.BuilderConfig(
|
39 |
-
name="plain_text",
|
40 |
-
version=datasets.Version("1.0.0", ""),
|
41 |
-
description="Plain text import of the Swedish Reviews dataset",
|
42 |
-
)
|
43 |
-
]
|
44 |
-
|
45 |
-
def _info(self):
|
46 |
-
return datasets.DatasetInfo(
|
47 |
-
description=_DESCRIPTION,
|
48 |
-
features=datasets.Features(
|
49 |
-
{"text": datasets.Value("string"), "label": datasets.ClassLabel(names=["negative", "positive"])}
|
50 |
-
),
|
51 |
-
supervised_keys=None,
|
52 |
-
homepage="https://github.com/timpal0l/swedish-sentiment",
|
53 |
-
citation=_CITATION,
|
54 |
-
task_templates=[TextClassification(text_column="text", label_column="label")],
|
55 |
-
)
|
56 |
-
|
57 |
-
def _split_generators(self, dl_manager):
|
58 |
-
dl_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
59 |
-
return [
|
60 |
-
datasets.SplitGenerator(
|
61 |
-
name=datasets.Split.TEST,
|
62 |
-
gen_kwargs={"filepath": os.path.join(dl_dir, _TEST_FILE)},
|
63 |
-
),
|
64 |
-
datasets.SplitGenerator(
|
65 |
-
name=datasets.Split.VALIDATION,
|
66 |
-
gen_kwargs={"filepath": os.path.join(dl_dir, _VAL_FILE)},
|
67 |
-
),
|
68 |
-
datasets.SplitGenerator(
|
69 |
-
name=datasets.Split.TRAIN,
|
70 |
-
gen_kwargs={"filepath": os.path.join(dl_dir, _TRAIN_FILE)},
|
71 |
-
),
|
72 |
-
]
|
73 |
-
|
74 |
-
def _generate_examples(self, filepath):
|
75 |
-
"""This function returns the examples in the raw (text) form."""
|
76 |
-
with open(filepath, encoding="utf-8") as f:
|
77 |
-
reader = csv.DictReader(f)
|
78 |
-
for idx, row in enumerate(reader):
|
79 |
-
yield idx, {
|
80 |
-
"text": row["text"],
|
81 |
-
"label": row["sentiment"],
|
82 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|