albertvillanova HF staff commited on
Commit
de06e6d
1 Parent(s): 493f8f1

Delete loading script

Browse files
Files changed (1) hide show
  1. wongnai_reviews.py +0 -76
wongnai_reviews.py DELETED
@@ -1,76 +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
- """TODO: Add a description here."""
16
-
17
-
18
- import csv
19
- import os
20
-
21
- import datasets
22
- from datasets.tasks import TextClassification
23
-
24
-
25
- # no BibTeX citation
26
- _CITATION = ""
27
-
28
- _DESCRIPTION = """\
29
- Wongnai's review dataset contains restaurant reviews and ratings, mainly in Thai language.
30
- The reviews are in 5 classes ranging from 1 to 5 stars.
31
- """
32
-
33
- _LICENSE = "LGPL-3.0"
34
-
35
- _URLs = {"default": "https://archive.org/download/wongnai_reviews/wongnai_reviews_withtest.zip"}
36
-
37
-
38
- class WongnaiReviews(datasets.GeneratorBasedBuilder):
39
- VERSION = datasets.Version("1.0.1")
40
-
41
- def _info(self):
42
- features = datasets.Features(
43
- {
44
- "review_body": datasets.Value("string"),
45
- "star_rating": datasets.features.ClassLabel(names=["1", "2", "3", "4", "5"]),
46
- }
47
- )
48
- return datasets.DatasetInfo(
49
- description=_DESCRIPTION,
50
- features=features,
51
- supervised_keys=None,
52
- homepage="https://github.com/wongnai/wongnai-corpus",
53
- license=_LICENSE,
54
- citation=_CITATION,
55
- task_templates=[TextClassification(text_column="review_body", label_column="star_rating")],
56
- )
57
-
58
- def _split_generators(self, dl_manager):
59
- my_urls = _URLs[self.config.name]
60
- data_dir = dl_manager.download_and_extract(my_urls)
61
- return [
62
- datasets.SplitGenerator(
63
- name=datasets.Split.TRAIN,
64
- gen_kwargs={"filepath": os.path.join(data_dir, "w_review_train.csv"), "split": "train"},
65
- ),
66
- datasets.SplitGenerator(
67
- name=datasets.Split.TEST,
68
- gen_kwargs={"filepath": os.path.join(data_dir, "w_review_test.csv"), "split": "test"},
69
- ),
70
- ]
71
-
72
- def _generate_examples(self, filepath, split):
73
- with open(filepath, encoding="utf-8") as f:
74
- spamreader = csv.reader(f, delimiter=";", quotechar='"')
75
- for id_, row in enumerate(spamreader):
76
- yield id_, {"review_body": row[0], "star_rating": row[1]}