Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Languages:
Swedish
Size:
100K - 1M
License:
Commit
•
1fa3273
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +123 -0
- dataset_infos.json +1 -0
- dummy/plain_text/1.0.0/dummy_data.zip +3 -0
- swedish_reviews.py +81 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- found
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- sv
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- n<1K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- text-classification
|
18 |
+
task_ids:
|
19 |
+
- sentiment-classification
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for Swedish Reviews
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Homepage:** [swedish_reviews homepage](https://github.com/timpal0l/swedish-sentiment)
|
50 |
+
- **Repository:** [swedish_reviews repository](https://github.com/timpal0l/swedish-sentiment)
|
51 |
+
- **Point of Contact:** [Tim Isbister](mailto:timisbisters@gmail.com)
|
52 |
+
|
53 |
+
### Dataset Summary
|
54 |
+
|
55 |
+
The dataset is scraped from various Swedish websites where reviews are present. The dataset consists of 103 482 samples split between `train`, `valid` and `test`. It is a sample of the full dataset, where this sample is balanced to the minority class (negative). The original data dump was heavly skewved to positive samples with a 95/5 ratio.
|
56 |
+
|
57 |
+
### Supported Tasks and Leaderboards
|
58 |
+
|
59 |
+
This dataset can be used to evaluate sentiment classification on Swedish.
|
60 |
+
|
61 |
+
### Languages
|
62 |
+
|
63 |
+
The text in the dataset is in Swedish.
|
64 |
+
|
65 |
+
## Dataset Structure
|
66 |
+
|
67 |
+
### Data Instances
|
68 |
+
|
69 |
+
What a sample looks like:
|
70 |
+
```
|
71 |
+
{
|
72 |
+
'text': 'Jag tycker huggingface är ett grymt project!',
|
73 |
+
'label': 1,
|
74 |
+
}
|
75 |
+
```
|
76 |
+
|
77 |
+
### Data Fields
|
78 |
+
|
79 |
+
- `text`: A text where the sentiment expression is present.
|
80 |
+
- `label`: a int representing the label `0`for negative and `1`for positive.
|
81 |
+
|
82 |
+
### Data Splits
|
83 |
+
|
84 |
+
The data is split into a training, validation and test set. The final split sizes are as follow:
|
85 |
+
|
86 |
+
| Train | Valid | Test |
|
87 |
+
| ------ | ----- | ---- |
|
88 |
+
| 62089 | 20696 | 20697 |
|
89 |
+
|
90 |
+
## Dataset Creation
|
91 |
+
|
92 |
+
### Curation Rationale
|
93 |
+
|
94 |
+
### Source Data
|
95 |
+
Various Swedish websites with product reviews.
|
96 |
+
#### Initial Data Collection and Normalization
|
97 |
+
|
98 |
+
#### Who are the source language producers?
|
99 |
+
Swedish
|
100 |
+
### Annotations
|
101 |
+
|
102 |
+
#### Annotation process
|
103 |
+
Automatically annotated based on user reviews on a scale 1-5, where 1-2 is considered `negative` and 4-5 is `positive`, 3 is skipped as it tends to be more neutral.
|
104 |
+
#### Who are the annotators?
|
105 |
+
The users who have been using the products.
|
106 |
+
### Personal and Sensitive Information
|
107 |
+
[More Information Needed]
|
108 |
+
## Considerations for Using the Data
|
109 |
+
[More Information Needed]
|
110 |
+
### Social Impact of Dataset
|
111 |
+
[More Information Needed]
|
112 |
+
### Discussion of Biases
|
113 |
+
[More Information Needed]
|
114 |
+
### Other Known Limitations
|
115 |
+
[More Information Needed]
|
116 |
+
## Additional Information
|
117 |
+
[More Information Needed]
|
118 |
+
### Dataset Curators
|
119 |
+
The corpus was scraped by @timpal0l
|
120 |
+
### Licensing Information
|
121 |
+
Research only.
|
122 |
+
### Citation Information
|
123 |
+
No paper exists currently.
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"plain_text": {"description": "Swedish reviews scarped from various public available websites", "citation": "", "homepage": "https://github.com/timpal0l/swedish-sentiment", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["negative", "positive"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "swedish_reviews", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 6296541, "num_examples": 20697, "dataset_name": "swedish_reviews"}, "validation": {"name": "validation", "num_bytes": 6359227, "num_examples": 20696, "dataset_name": "swedish_reviews"}, "train": {"name": "train", "num_bytes": 18842891, "num_examples": 62089, "dataset_name": "swedish_reviews"}}, "download_checksums": {"https://raw.githubusercontent.com/timpal0l/swedish-sentiment/main/swedish_sentiment.zip": {"num_bytes": 11841056, "checksum": "1bf3b7111af2bd1c43b30e32201d35b70ebacb80cd505666383142183e46ca98"}}, "download_size": 11841056, "post_processing_size": null, "dataset_size": 31498659, "size_in_bytes": 43339715}}
|
dummy/plain_text/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d261eed415e16b93d94da5b578f25bf7b0eb04c3e02e9fe2ca02c6382909a4d0
|
3 |
+
size 2617
|
swedish_reviews.py
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
from __future__ import absolute_import, division, print_function
|
19 |
+
|
20 |
+
import csv
|
21 |
+
import os
|
22 |
+
|
23 |
+
import datasets
|
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 |
+
)
|
55 |
+
|
56 |
+
def _split_generators(self, dl_manager):
|
57 |
+
dl_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
58 |
+
return [
|
59 |
+
datasets.SplitGenerator(
|
60 |
+
name=datasets.Split.TEST,
|
61 |
+
gen_kwargs={"filepath": os.path.join(dl_dir, _TEST_FILE)},
|
62 |
+
),
|
63 |
+
datasets.SplitGenerator(
|
64 |
+
name=datasets.Split.VALIDATION,
|
65 |
+
gen_kwargs={"filepath": os.path.join(dl_dir, _VAL_FILE)},
|
66 |
+
),
|
67 |
+
datasets.SplitGenerator(
|
68 |
+
name=datasets.Split.TRAIN,
|
69 |
+
gen_kwargs={"filepath": os.path.join(dl_dir, _TRAIN_FILE)},
|
70 |
+
),
|
71 |
+
]
|
72 |
+
|
73 |
+
def _generate_examples(self, filepath):
|
74 |
+
"""This function returns the examples in the raw (text) form."""
|
75 |
+
with open(filepath, encoding="utf-8") as f:
|
76 |
+
reader = csv.DictReader(f)
|
77 |
+
for idx, row in enumerate(reader):
|
78 |
+
yield idx, {
|
79 |
+
"text": row["text"],
|
80 |
+
"label": row["sentiment"],
|
81 |
+
}
|