Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
topic-classification
Languages:
English
Size:
1M - 10M
License:
Replace yahoo_answers_topics data url (#4023)
Browse files* replace yahoo_answers_topics data url
* update dummy data
Commit from https://github.com/huggingface/datasets/commit/84f5681217714e856fac127f3b236ac3758da8dd
- dataset_infos.json +1 -1
- dummy/yahoo_answers_topics/1.0.0/dummy_data.zip +2 -2
- yahoo_answers_topics.py +26 -19
dataset_infos.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"yahoo_answers_topics": {"description": "\nYahoo! Answers Topic Classification is text classification dataset. The dataset is the Yahoo! Answers corpus as of 10/25/2007. The Yahoo! Answers topic classification dataset is constructed using 10 largest main categories. From all the answers and other meta-information, this dataset only used the best answer content and the main category information.\n", "citation": "", "homepage": "https://github.com/LC-John/Yahoo-Answers-Topic-Classification-Dataset", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "topic": {"num_classes": 10, "names": ["Society & Culture", "Science & Mathematics", "Health", "Education & Reference", "Computers & Internet", "Sports", "Business & Finance", "Entertainment & Music", "Family & Relationships", "Politics & Government"], "
|
|
|
1 |
+
{"yahoo_answers_topics": {"description": "\nYahoo! Answers Topic Classification is text classification dataset. The dataset is the Yahoo! Answers corpus as of 10/25/2007. The Yahoo! Answers topic classification dataset is constructed using 10 largest main categories. From all the answers and other meta-information, this dataset only used the best answer content and the main category information.\n", "citation": "", "homepage": "https://github.com/LC-John/Yahoo-Answers-Topic-Classification-Dataset", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "topic": {"num_classes": 10, "names": ["Society & Culture", "Science & Mathematics", "Health", "Education & Reference", "Computers & Internet", "Sports", "Business & Finance", "Entertainment & Music", "Family & Relationships", "Politics & Government"], "id": null, "_type": "ClassLabel"}, "question_title": {"dtype": "string", "id": null, "_type": "Value"}, "question_content": {"dtype": "string", "id": null, "_type": "Value"}, "best_answer": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "yahoo_answers_topics", "config_name": "yahoo_answers_topics", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 760460695, "num_examples": 1400000, "dataset_name": "yahoo_answers_topics"}, "test": {"name": "test", "num_bytes": 32661362, "num_examples": 60000, "dataset_name": "yahoo_answers_topics"}}, "download_checksums": {"https://s3.amazonaws.com/fast-ai-nlp/yahoo_answers_csv.tgz": {"num_bytes": 319476345, "checksum": "2d4277855faf8b35259009425fa8f7fe1888b5644b47165508942d000f4c96ae"}}, "download_size": 319476345, "post_processing_size": null, "dataset_size": 793122057, "size_in_bytes": 1112598402}}
|
dummy/yahoo_answers_topics/1.0.0/dummy_data.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d8f0088fdaea629d5b61db618d9aeb38c574114205c7c951ba4dcab3c0727324
|
3 |
+
size 5544
|
yahoo_answers_topics.py
CHANGED
@@ -16,7 +16,6 @@
|
|
16 |
|
17 |
|
18 |
import csv
|
19 |
-
import os
|
20 |
|
21 |
import datasets
|
22 |
|
@@ -28,7 +27,7 @@ The Yahoo! Answers topic classification dataset is constructed using 10 largest
|
|
28 |
From all the answers and other meta-information, this dataset only used the best answer content and the main category information.
|
29 |
"""
|
30 |
|
31 |
-
_URL = "https://
|
32 |
|
33 |
_TOPICS = [
|
34 |
"Society & Culture",
|
@@ -72,27 +71,35 @@ class YahooAnswersTopics(datasets.GeneratorBasedBuilder):
|
|
72 |
)
|
73 |
|
74 |
def _split_generators(self, dl_manager):
|
75 |
-
|
76 |
-
|
77 |
-
# Extracting (un-taring) the training data
|
78 |
-
data_dir = os.path.join(data_dir, "yahoo_answers_csv")
|
79 |
return [
|
80 |
datasets.SplitGenerator(
|
81 |
-
name=datasets.Split.TRAIN,
|
|
|
|
|
|
|
|
|
82 |
),
|
83 |
datasets.SplitGenerator(
|
84 |
-
name=datasets.Split.TEST,
|
|
|
|
|
|
|
|
|
85 |
),
|
86 |
]
|
87 |
|
88 |
-
def _generate_examples(self, filepath):
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
import csv
|
|
|
19 |
|
20 |
import datasets
|
21 |
|
|
|
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",
|
|
|
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
|