Update from $USER
Browse files- ChnSentiCorp.py +48 -0
- chn_senti_corp-test.arrow +3 -0
- chn_senti_corp-train.arrow +3 -0
- chn_senti_corp-validation.arrow +3 -0
- dataset_info.json +1 -0
ChnSentiCorp.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import csv
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
|
6 |
+
_TRAIN_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1uV-aDQoMI51A27OxVgJnzxqZFQqkDydZ&export=download"
|
7 |
+
_DEV_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1kI_LUYm9m0pVGDb4LHqtjwauUrIGo_rC&export=download"
|
8 |
+
_TEST_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1YJkSqGFeo-8ifmgVbxGMTte7Y-yxPHg7&export=download"
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
class ChnSentiCorp(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=["negative", "positive"])
|
22 |
+
}
|
23 |
+
),
|
24 |
+
homepage=None,
|
25 |
+
citation=None,
|
26 |
+
)
|
27 |
+
|
28 |
+
def _split_generators(self, dl_manager):
|
29 |
+
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
30 |
+
dev_path = dl_manager.download_and_extract(_DEV_DOWNLOAD_URL)
|
31 |
+
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
32 |
+
return [
|
33 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
34 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": dev_path}),
|
35 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
36 |
+
]
|
37 |
+
|
38 |
+
def _generate_examples(self, filepath):
|
39 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
40 |
+
csv_reader = csv.reader(
|
41 |
+
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
42 |
+
)
|
43 |
+
for id_, row in enumerate(csv_reader):
|
44 |
+
if id_ == 0:
|
45 |
+
continue
|
46 |
+
label, text = row
|
47 |
+
label = int(label)
|
48 |
+
yield id_, {"text": text, "label": label}
|
chn_senti_corp-test.arrow
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8abe8bad8ce309d81ce9aab2d4d1317bca4845bfec2f58cfe15a9aa9795a82e8
|
3 |
+
size 381200
|
chn_senti_corp-train.arrow
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:700595b90463a84f5fb6466e1723d0de67decc464a666d9fbaffce6050eb5773
|
3 |
+
size 3107032
|
chn_senti_corp-validation.arrow
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c7484a693e3f15bce7eb42c8d8d97ae2c63d9c2e2b7c1c8aecd0e345ed7c1b6d
|
3 |
+
size 385688
|
dataset_info.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"description": "", "citation": "", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["negative", "positive"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "chn_senti_corp", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3106365, "num_examples": 9600, "dataset_name": "chn_senti_corp"}, "validation": {"name": "validation", "num_bytes": 385021, "num_examples": 1200, "dataset_name": "chn_senti_corp"}, "test": {"name": "test", "num_bytes": 380533, "num_examples": 1200, "dataset_name": "chn_senti_corp"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1uV-aDQoMI51A27OxVgJnzxqZFQqkDydZ&export=download": {"num_bytes": 3032906, "checksum": "5394d3b2867ece9452a275fc84924ae030d827bb57b90c6aed6009ffdd1b8cee"}, "https://drive.google.com/u/0/uc?id=1kI_LUYm9m0pVGDb4LHqtjwauUrIGo_rC&export=download": {"num_bytes": 375862, "checksum": "a8770badf76a638fb21f92d5be9280eb8c50a7644dbe2dd881aff040c6fe6513"}, "https://drive.google.com/u/0/uc?id=1YJkSqGFeo-8ifmgVbxGMTte7Y-yxPHg7&export=download": {"num_bytes": 371381, "checksum": "5ffc04692e4f7bf6b18eb9f94cef3090bd5fb55bb3e138ac7080f0739529ef1f"}}, "download_size": 3780149, "post_processing_size": null, "dataset_size": 3871919, "size_in_bytes": 7652068}
|