seamew commited on
Commit
e562464
1 Parent(s): 3deee92

Update from $USER

Browse files
THUCNews.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=1eOg09b1PKWP2yOix0jhhLMAGj79wvDpJ&export=download"
7
+ _DEV_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1vk6wsjDdspwTG8gVeZ6TV5-RkiV3wUyD&export=download"
8
+ _TEST_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1Ba2IIeFJMYBfOJsYyloHkHZ7lb3ADRwW&export=download"
9
+
10
+
11
+
12
+ class THUCNews(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=['sports', 'entertainment', 'property', 'education', 'fashion', 'affairs', 'game', 'sociology', 'technology', 'economics']),
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": ["sports", "entertainment", "property", "education", "fashion", "affairs", "game", "sociology", "technology", "economics"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "thuc_news", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3206827, "num_examples": 50000, "dataset_name": "thuc_news"}, "validation": {"name": "validation", "num_bytes": 320133, "num_examples": 5000, "dataset_name": "thuc_news"}, "test": {"name": "test", "num_bytes": 631946, "num_examples": 10000, "dataset_name": "thuc_news"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1eOg09b1PKWP2yOix0jhhLMAGj79wvDpJ&export=download": {"num_bytes": 2847111, "checksum": "840a218b7afaa083707e6e5b2035225134368364ec54f5191a97c580cb560fd1"}, "https://drive.google.com/u/0/uc?id=1vk6wsjDdspwTG8gVeZ6TV5-RkiV3wUyD&export=download": {"num_bytes": 284613, "checksum": "6f45976af7ba1b761efe5e1ec9ae0e16cf745fee6557609d3c70f9b8f8c76ba2"}, "https://drive.google.com/u/0/uc?id=1Ba2IIeFJMYBfOJsYyloHkHZ7lb3ADRwW&export=download": {"num_bytes": 561708, "checksum": "c34d4550b2ddd5537b6a0ef006fa17478db766ba372de9195a938e64c7cf434f"}}, "download_size": 3693432, "post_processing_size": null, "dataset_size": 4158906, "size_in_bytes": 7852338}
thuc_news-test.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67d9d00d1ce187f4148650a838e5e19bc4871f223a356a28b57db278bf0d9d56
3
+ size 632712
thuc_news-train.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a697fc622a759ef6f68bc5354eb90e0d0bc589f8c0a7ddbaa7889405832292fb
3
+ size 3208456
thuc_news-validation.arrow ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2298b5d5259de568dd15c5292341166dae52c0f756efbea8582811e12ae37dfd
3
+ size 320904