Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
Polish
Size:
10K - 100K
License:
Commit
•
58d2590
1
Parent(s):
c88016b
Delete loading script
Browse files- allegro_reviews.py +0 -109
allegro_reviews.py
DELETED
@@ -1,109 +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 |
-
"""Allegro Reviews dataset"""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
import os
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
|
23 |
-
|
24 |
-
_CITATION = """\
|
25 |
-
@inproceedings{rybak-etal-2020-klej,
|
26 |
-
title = "{KLEJ}: Comprehensive Benchmark for Polish Language Understanding",
|
27 |
-
author = "Rybak, Piotr and Mroczkowski, Robert and Tracz, Janusz and Gawlik, Ireneusz",
|
28 |
-
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
|
29 |
-
month = jul,
|
30 |
-
year = "2020",
|
31 |
-
address = "Online",
|
32 |
-
publisher = "Association for Computational Linguistics",
|
33 |
-
url = "https://www.aclweb.org/anthology/2020.acl-main.111",
|
34 |
-
pages = "1191--1201",
|
35 |
-
}
|
36 |
-
"""
|
37 |
-
|
38 |
-
_DESCRIPTION = """\
|
39 |
-
Allegro Reviews is a sentiment analysis dataset, consisting of 11,588 product reviews written in Polish and extracted
|
40 |
-
from Allegro.pl - a popular e-commerce marketplace. Each review contains at least 50 words and has a rating on a scale
|
41 |
-
from one (negative review) to five (positive review).
|
42 |
-
|
43 |
-
We recommend using the provided train/dev/test split. The ratings for the test set reviews are kept hidden.
|
44 |
-
You can evaluate your model using the online evaluation tool available on klejbenchmark.com.
|
45 |
-
"""
|
46 |
-
|
47 |
-
_HOMEPAGE = "https://github.com/allegro/klejbenchmark-allegroreviews"
|
48 |
-
|
49 |
-
_LICENSE = "CC BY-SA 4.0"
|
50 |
-
|
51 |
-
_URLs = "https://klejbenchmark.com/static/data/klej_ar.zip"
|
52 |
-
|
53 |
-
|
54 |
-
class AllegroReviews(datasets.GeneratorBasedBuilder):
|
55 |
-
"""
|
56 |
-
Allegro Reviews is a sentiment analysis dataset, consisting of 11,588 product reviews written in Polish
|
57 |
-
and extracted from Allegro.pl - a popular e-commerce marketplace.
|
58 |
-
"""
|
59 |
-
|
60 |
-
VERSION = datasets.Version("1.1.0")
|
61 |
-
|
62 |
-
def _info(self):
|
63 |
-
return datasets.DatasetInfo(
|
64 |
-
description=_DESCRIPTION,
|
65 |
-
features=datasets.Features(
|
66 |
-
{
|
67 |
-
"text": datasets.Value("string"),
|
68 |
-
"rating": datasets.Value("float"),
|
69 |
-
}
|
70 |
-
),
|
71 |
-
supervised_keys=None,
|
72 |
-
homepage=_HOMEPAGE,
|
73 |
-
license=_LICENSE,
|
74 |
-
citation=_CITATION,
|
75 |
-
)
|
76 |
-
|
77 |
-
def _split_generators(self, dl_manager):
|
78 |
-
"""Returns SplitGenerators."""
|
79 |
-
data_dir = dl_manager.download_and_extract(_URLs)
|
80 |
-
return [
|
81 |
-
datasets.SplitGenerator(
|
82 |
-
name=datasets.Split.TRAIN,
|
83 |
-
gen_kwargs={
|
84 |
-
"filepath": os.path.join(data_dir, "train.tsv"),
|
85 |
-
"split": "train",
|
86 |
-
},
|
87 |
-
),
|
88 |
-
datasets.SplitGenerator(
|
89 |
-
name=datasets.Split.TEST,
|
90 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "test_features.tsv"), "split": "test"},
|
91 |
-
),
|
92 |
-
datasets.SplitGenerator(
|
93 |
-
name=datasets.Split.VALIDATION,
|
94 |
-
gen_kwargs={
|
95 |
-
"filepath": os.path.join(data_dir, "dev.tsv"),
|
96 |
-
"split": "dev",
|
97 |
-
},
|
98 |
-
),
|
99 |
-
]
|
100 |
-
|
101 |
-
def _generate_examples(self, filepath, split):
|
102 |
-
"""Yields examples."""
|
103 |
-
with open(filepath, encoding="utf-8") as f:
|
104 |
-
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
105 |
-
for id_, row in enumerate(reader):
|
106 |
-
yield id_, {
|
107 |
-
"text": row["text"],
|
108 |
-
"rating": "-1" if split == "test" else row["rating"],
|
109 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|