affahrizain commited on
Commit
1cd71f7
1 Parent(s): 4b294e1

fresh commit with full data.csv

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +36 -0
  3. data.csv +3 -0
  4. id-review-gen.py +73 -0
.gitattributes CHANGED
@@ -53,3 +53,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
+ *.csv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - machine-generated
4
+ language:
5
+ - id
6
+ language_creators:
7
+ - found
8
+ license:
9
+ - apache-2.0
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: id-review-gen
13
+ size_categories:
14
+ - 1K<n<10K
15
+ source_datasets:
16
+ - original
17
+ tags:
18
+ - product review
19
+ - review
20
+ task_categories:
21
+ - text-generation
22
+ task_ids:
23
+ - language-modeling
24
+ dataset_info:
25
+ features:
26
+ - name: text
27
+ dtype: string
28
+ - name: label
29
+ dtype: string
30
+ splits:
31
+ - name: train
32
+ num_bytes: 253740
33
+ num_examples: 3797
34
+ download_size: 232695
35
+ dataset_size: 253740
36
+ ---
data.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be5fd795dbfd22936d262aa0adef4269a7687bfc867e41adc2bc09682a7df6c3
3
+ size 13384578
id-review-gen.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """id-review-gen: An Indonesian Review Generation Dataset."""
16
+
17
+
18
+ import csv
19
+ import pandas as pd
20
+
21
+ import datasets
22
+
23
+ _DESCRIPTION = """\
24
+ This dataset is built as a playground for review text generation.
25
+ """
26
+
27
+ _HOMEPAGE = "https://github.com/jakartaresearch"
28
+
29
+ # TODO: Add link to the official dataset URLs here
30
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
31
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
32
+ _TRAIN_URL = (
33
+ "https://huggingface.co/datasets/jakartaresearch/id-review-gen/raw/main/data.csv"
34
+ )
35
+
36
+
37
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
38
+ class ReviewGen(datasets.GeneratorBasedBuilder):
39
+ """GooglePlayReview: An Indonesian Sentiment Analysis Dataset."""
40
+
41
+ VERSION = datasets.Version("1.0.0")
42
+
43
+ def _info(self):
44
+ features = datasets.Features(
45
+ {"text": datasets.Value("string"), "label": datasets.Value("string")}
46
+ )
47
+
48
+ return datasets.DatasetInfo(
49
+ description=_DESCRIPTION, features=features, homepage=_HOMEPAGE
50
+ )
51
+
52
+ def _split_generators(self, dl_manager):
53
+ train_path = dl_manager.download_and_extract(_TRAIN_URL)
54
+ return [
55
+ datasets.SplitGenerator(
56
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
57
+ )
58
+ ]
59
+
60
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
61
+ def _generate_examples(self, filepath):
62
+ """Generate examples."""
63
+ df = pd.read_csv(filepath, encoding="utf-8")
64
+ for item in df.itertuples():
65
+ print(item)
66
+ yield item.Index, {"text": item.text, "label": item.label}
67
+
68
+ # with open(filepath, encoding="utf-8") as csv_file:
69
+ # csv_reader = csv.reader(csv_file, delimiter=",")
70
+ # next(csv_reader)
71
+ # for id_, row in enumerate(csv_reader):
72
+ # text, label = row
73
+ # yield id_, {"text": text, "label": label}