Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
sentiment-classification
Languages:
Indonesian
Size:
10K - 100K
License:
andreaschandra
commited on
Commit
•
ee2b21e
1
Parent(s):
6cf46b5
first version
Browse files- dataset_infos.json +1 -0
- google-play-review.py +76 -0
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "This dataset is built as a playground for beginner to make a use case for creating sentiment analysis model.\n", "citation": "", "homepage": "https://github.com/jakartaresearch", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}, "stars": {"dtype": "int8", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "google_play_review", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 480786, "num_examples": 7028, "dataset_name": "google_play_review"}, "validation": {"name": "validation", "num_bytes": 216876, "num_examples": 3012, "dataset_name": "google_play_review"}}, "download_checksums": {"https://huggingface.co/datasets/jakartaresearch/google-play-review/raw/main/train.csv": {"num_bytes": 448923, "checksum": "9482d867937f49aed59d5b7b8a495e5b46c11d763fa977580ba4421742b0aed7"}, "https://huggingface.co/datasets/jakartaresearch/google-play-review/raw/main/validation.csv": {"num_bytes": 203356, "checksum": "06a84a0faf920a850b5a7e0341f9b697ba6164761e00c71338a92120fd7c96dc"}}, "download_size": 652279, "post_processing_size": null, "dataset_size": 697662, "size_in_bytes": 1349941}}
|
google-play-review.py
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
# TODO: Address all TODOs and remove all explanatory comments
|
15 |
+
"""Google Play Review: An Indonesian App Sentiment Analysis."""
|
16 |
+
|
17 |
+
|
18 |
+
import csv
|
19 |
+
import json
|
20 |
+
import os
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
_DESCRIPTION = """\
|
25 |
+
This dataset is built as a playground for beginner to make a use case for creating sentiment analysis model.
|
26 |
+
"""
|
27 |
+
|
28 |
+
_HOMEPAGE = "https://github.com/jakartaresearch"
|
29 |
+
|
30 |
+
# TODO: Add link to the official dataset URLs here
|
31 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
32 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
33 |
+
_TRAIN_URL = "https://huggingface.co/datasets/jakartaresearch/google-play-review/raw/main/train.csv"
|
34 |
+
_VAL_URL = "https://huggingface.co/datasets/jakartaresearch/google-play-review/raw/main/validation.csv"
|
35 |
+
|
36 |
+
|
37 |
+
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
38 |
+
class GooglePlayReview(datasets.GeneratorBasedBuilder):
|
39 |
+
"""GooglePlayReview: An Indonesian Sentiment Analysis Dataset."""
|
40 |
+
|
41 |
+
VERSION = datasets.Version("1.0.0")
|
42 |
+
|
43 |
+
def _info(self):
|
44 |
+
|
45 |
+
features = datasets.Features(
|
46 |
+
{
|
47 |
+
"text": datasets.Value("string"),
|
48 |
+
"label": datasets.Value("string"),
|
49 |
+
"stars": datasets.Value("int8")
|
50 |
+
}
|
51 |
+
)
|
52 |
+
|
53 |
+
return datasets.DatasetInfo(
|
54 |
+
description=_DESCRIPTION,
|
55 |
+
features=features,
|
56 |
+
homepage=_HOMEPAGE
|
57 |
+
)
|
58 |
+
|
59 |
+
def _split_generators(self, dl_manager):
|
60 |
+
|
61 |
+
train_path = dl_manager.download_and_extract(_TRAIN_URL)
|
62 |
+
val_path = dl_manager.download_and_extract(_VAL_URL)
|
63 |
+
return [
|
64 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
65 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path})
|
66 |
+
]
|
67 |
+
|
68 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
69 |
+
def _generate_examples(self, filepath):
|
70 |
+
"""Generate examples."""
|
71 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
72 |
+
csv_reader = csv.reader(csv_file, delimiter=",")
|
73 |
+
next(csv_reader)
|
74 |
+
for id_, row in enumerate(csv_reader):
|
75 |
+
text, label, stars = row
|
76 |
+
yield id_, {"text": text, "label": label, "stars": stars}
|