seamew commited on
Commit
dfd0f81
1 Parent(s): 2186b57
THUCNewsText.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+
3
+ import datasets
4
+
5
+
6
+ _TRAIN_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1yoH_Aa09ECjjhHMHS8ML_d5-ydDwNETu&export=download"
7
+ _DEV_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1GVslP3rnHPoxHHNeEyYDMjFxZVRiSdhM&export=download"
8
+ _TEST_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1NIF3_OHxYM7WgG8xnBP_X393_sQKK43Z&export=download"
9
+
10
+
11
+
12
+ class THUCNewsText(datasets.GeneratorBasedBuilder):
13
+
14
+
15
+ def _info(self):
16
+ return datasets.DatasetInfo(
17
+ description=None,
18
+ features=datasets.Features(
19
+ {
20
+ "text": datasets.Value("string"),
21
+ "label": datasets.features.ClassLabel(names=['education', 'entertainment', 'fashion', 'finance', 'game', 'politic', 'society', 'sport', 'stock', 'technology']),
22
+ }
23
+
24
+ ),
25
+ homepage=None,
26
+ citation=None,
27
+ )
28
+
29
+ def _split_generators(self, dl_manager):
30
+ train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
31
+ dev_path = dl_manager.download_and_extract(_DEV_DOWNLOAD_URL)
32
+ test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
33
+ return [
34
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
35
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": dev_path}),
36
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
37
+ ]
38
+
39
+ def _generate_examples(self, filepath):
40
+ with open(filepath, encoding="utf-8") as csv_file:
41
+ csv_reader = csv.reader(
42
+ csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
43
+ )
44
+ for id_, row in enumerate(csv_reader):
45
+ if id_ == 0:
46
+ continue
47
+ label, text = row
48
+ label = int(label)
49
+ yield id_, {"text": text, "label": label}
dataset_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"description": "", "citation": "", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 10, "names": ["education", "entertainment", "fashion", "finance", "game", "politic", "society", "sport", "stock", "technology"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "thuc_news_text", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 126435278, "num_examples": 50000, "dataset_name": "thuc_news_text"}, "validation": {"name": "validation", "num_bytes": 12851943, "num_examples": 5000, "dataset_name": "thuc_news_text"}, "test": {"name": "test", "num_bytes": 25321294, "num_examples": 9890, "dataset_name": "thuc_news_text"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1yoH_Aa09ECjjhHMHS8ML_d5-ydDwNETu&export=download": {"num_bytes": 126044506, "checksum": "11cddd159185e11c4ea6d4428d0439f1548804cc170f972408d93bdf5e10d891"}, "https://drive.google.com/u/0/uc?id=1GVslP3rnHPoxHHNeEyYDMjFxZVRiSdhM&export=download": {"num_bytes": 12812815, "checksum": "a8dfaa74475fa40015bcdd6532df42d6d4b2dfb2269ac82564e84260bf64c1b1"}, "https://drive.google.com/u/0/uc?id=1NIF3_OHxYM7WgG8xnBP_X393_sQKK43Z&export=download": {"num_bytes": 25244351, "checksum": "b9ad0923c44a88793c43193c5327a4feb053096087dda84b11fb36bc1816bb5b"}}, "download_size": 164101672, "post_processing_size": null, "dataset_size": 164608515, "size_in_bytes": 328710187}
thuc_news_text-test.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d81bf29698e9e5d12890dc9f37c8dfcef4c27fd021953e24a23c4e0a0ae79863
3
+ size 25322056
thuc_news_text-train.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d28b79d124463cc3a9fe76e1f155bce909fe6fa5ff677094d356b24c071e6bec
3
+ size 126436888
thuc_news_text-validation.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:619fb8d0cacd64066880bd52cd45efde09883e2fbe0b69312c3acd9e38cb2817
3
+ size 12852704