Convert dataset to Parquet

#4
by albertvillanova HF staff - opened
README.md CHANGED
@@ -19,6 +19,7 @@ task_ids:
19
  - topic-classification
20
  pretty_name: YahooAnswersTopics
21
  dataset_info:
 
22
  features:
23
  - name: id
24
  dtype: int32
@@ -42,16 +43,23 @@ dataset_info:
42
  dtype: string
43
  - name: best_answer
44
  dtype: string
45
- config_name: yahoo_answers_topics
46
  splits:
47
  - name: train
48
- num_bytes: 760460695
49
  num_examples: 1400000
50
  - name: test
51
- num_bytes: 32661362
52
  num_examples: 60000
53
- download_size: 319476345
54
- dataset_size: 793122057
 
 
 
 
 
 
 
 
55
  train-eval-index:
56
  - config: yahoo_answers_topics
57
  task: text-classification
 
19
  - topic-classification
20
  pretty_name: YahooAnswersTopics
21
  dataset_info:
22
+ config_name: yahoo_answers_topics
23
  features:
24
  - name: id
25
  dtype: int32
 
43
  dtype: string
44
  - name: best_answer
45
  dtype: string
 
46
  splits:
47
  - name: train
48
+ num_bytes: 760285695
49
  num_examples: 1400000
50
  - name: test
51
+ num_bytes: 32653862
52
  num_examples: 60000
53
+ download_size: 533429663
54
+ dataset_size: 792939557
55
+ configs:
56
+ - config_name: yahoo_answers_topics
57
+ data_files:
58
+ - split: train
59
+ path: yahoo_answers_topics/train-*
60
+ - split: test
61
+ path: yahoo_answers_topics/test-*
62
+ default: true
63
  train-eval-index:
64
  - config: yahoo_answers_topics
65
  task: text-classification
yahoo_answers_topics.py DELETED
@@ -1,105 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors.
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
- """Yahoo! Answers Topic Classification Dataset"""
16
-
17
-
18
- import csv
19
-
20
- import datasets
21
-
22
-
23
- _DESCRIPTION = """
24
- Yahoo! Answers Topic Classification is text classification dataset. \
25
- The dataset is the Yahoo! Answers corpus as of 10/25/2007. \
26
- The Yahoo! Answers topic classification dataset is constructed using 10 largest main categories. \
27
- From all the answers and other meta-information, this dataset only used the best answer content and the main category information.
28
- """
29
-
30
- _URL = "https://s3.amazonaws.com/fast-ai-nlp/yahoo_answers_csv.tgz"
31
-
32
- _TOPICS = [
33
- "Society & Culture",
34
- "Science & Mathematics",
35
- "Health",
36
- "Education & Reference",
37
- "Computers & Internet",
38
- "Sports",
39
- "Business & Finance",
40
- "Entertainment & Music",
41
- "Family & Relationships",
42
- "Politics & Government",
43
- ]
44
-
45
-
46
- class YahooAnswersTopics(datasets.GeneratorBasedBuilder):
47
- "Yahoo! Answers Topic Classification Dataset"
48
-
49
- VERSION = datasets.Version("1.0.0")
50
- BUILDER_CONFIGS = [
51
- datasets.BuilderConfig(
52
- name="yahoo_answers_topics",
53
- version=datasets.Version("1.0.0", ""),
54
- ),
55
- ]
56
-
57
- def _info(self):
58
- return datasets.DatasetInfo(
59
- description=_DESCRIPTION,
60
- features=datasets.Features(
61
- {
62
- "id": datasets.Value("int32"),
63
- "topic": datasets.features.ClassLabel(names=_TOPICS),
64
- "question_title": datasets.Value("string"),
65
- "question_content": datasets.Value("string"),
66
- "best_answer": datasets.Value("string"),
67
- },
68
- ),
69
- supervised_keys=None,
70
- homepage="https://github.com/LC-John/Yahoo-Answers-Topic-Classification-Dataset",
71
- )
72
-
73
- def _split_generators(self, dl_manager):
74
- archive = dl_manager.download(_URL)
75
- return [
76
- datasets.SplitGenerator(
77
- name=datasets.Split.TRAIN,
78
- gen_kwargs={
79
- "filepath": "yahoo_answers_csv/train.csv",
80
- "files": dl_manager.iter_archive(archive),
81
- },
82
- ),
83
- datasets.SplitGenerator(
84
- name=datasets.Split.TEST,
85
- gen_kwargs={
86
- "filepath": "yahoo_answers_csv/test.csv",
87
- "files": dl_manager.iter_archive(archive),
88
- },
89
- ),
90
- ]
91
-
92
- def _generate_examples(self, filepath, files):
93
- for path, f in files:
94
- if path == filepath:
95
- lines = (line.decode("utf-8") for line in f)
96
- rows = csv.reader(lines)
97
- for i, row in enumerate(rows):
98
- yield i, {
99
- "id": i,
100
- "topic": int(row[0]) - 1,
101
- "question_title": row[1],
102
- "question_content": row[2],
103
- "best_answer": row[3],
104
- }
105
- break
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
yahoo_answers_topics/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ae212b4eccfc514668b9c9952f16aadf6d3b056a202cb897d30e3dd3671c690
3
+ size 21939321
yahoo_answers_topics/train-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0089bdde22f78e563c1cf21a5e87a15724845c08641154f40ca9baa8d069a42a
3
+ size 241340294
yahoo_answers_topics/train-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b3c9dc56fe11aa0d79158b7ef9c1b82d8a40109d9eb220c52b875fd91979f89
3
+ size 270150048