andreaschandra commited on
Commit
5469c7d
1 Parent(s): dad8741
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. dataset_infos.json +1 -0
  3. indonews.py +75 -0
.gitattributes CHANGED
@@ -39,3 +39,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
39
  *.mp3 filter=lfs diff=lfs merge=lfs -text
40
  *.ogg filter=lfs diff=lfs merge=lfs -text
41
  *.wav filter=lfs diff=lfs merge=lfs -text
 
 
39
  *.mp3 filter=lfs diff=lfs merge=lfs -text
40
  *.ogg filter=lfs diff=lfs merge=lfs -text
41
  *.wav filter=lfs diff=lfs merge=lfs -text
42
+ *.csv filter=lfs diff=lfs merge=lfs -text
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"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "indonews", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7800430, "num_examples": 6127, "dataset_name": "indonews"}, "validation": {"name": "validation", "num_bytes": 3334930, "num_examples": 2627, "dataset_name": "indonews"}}, "download_checksums": {"https://media.githubusercontent.com/media/jakartaresearch/hf-datasets/main/indonews/indonews/train.csv": {"num_bytes": 7797798, "checksum": "73338405e1e5ba0138b530179ed9744e877a0a5b72231f227c8d9fa5d8e94a5b"}, "https://media.githubusercontent.com/media/jakartaresearch/hf-datasets/main/indonews/indonews/validation.csv": {"num_bytes": 3333629, "checksum": "f9d8109ab57a51a68f598f58f4294e8785aca71a6b3f2de619040f01a6494c60"}}, "download_size": 11131427, "post_processing_size": null, "dataset_size": 11135360, "size_in_bytes": 22266787}}
indonews.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://media.githubusercontent.com/media/jakartaresearch/hf-datasets/main/indonews/indonews/train.csv"
34
+ _VAL_URL = "https://media.githubusercontent.com/media/jakartaresearch/hf-datasets/main/indonews/indonews/validation.csv"
35
+
36
+
37
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
38
+ class Indonews(datasets.GeneratorBasedBuilder):
39
+ """Indonews: Multiclass News Categorization scrapped popular news portals in Indonesia.."""
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
+ }
50
+ )
51
+
52
+ return datasets.DatasetInfo(
53
+ description=_DESCRIPTION,
54
+ features=features,
55
+ homepage=_HOMEPAGE
56
+ )
57
+
58
+ def _split_generators(self, dl_manager):
59
+
60
+ train_path = dl_manager.download_and_extract(_TRAIN_URL)
61
+ val_path = dl_manager.download_and_extract(_VAL_URL)
62
+ return [
63
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
64
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path})
65
+ ]
66
+
67
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
68
+ def _generate_examples(self, filepath):
69
+ """Generate examples."""
70
+ with open(filepath, encoding="utf-8") as csv_file:
71
+ csv_reader = csv.reader(csv_file, delimiter=",")
72
+ next(csv_reader)
73
+ for id_, row in enumerate(csv_reader):
74
+ text, label = row
75
+ yield id_, {"text": text, "label": label}