init
Browse files- Weibo.py +47 -0
- dataset_info.json +1 -0
- weibo-test.arrow +3 -0
- weibo-train.arrow +3 -0
- weibo-validation.arrow +3 -0
Weibo.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
|
| 3 |
+
import datasets
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
_TRAIN_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1KhI9WDqbx64nUTQT_FsUqU6mu6AkEc3m&export=download"
|
| 7 |
+
_DEV_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1C_-pJhh38ItfyF2-u2tTmRx2OI5zr-I9&export=download"
|
| 8 |
+
_TEST_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1v5KRU1pIYUf13ebTLyfSQFRbiEO-DM8U&export=download"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Weibo(datasets.GeneratorBasedBuilder):
|
| 13 |
+
|
| 14 |
+
def _info(self):
|
| 15 |
+
return datasets.DatasetInfo(
|
| 16 |
+
description=None,
|
| 17 |
+
features=datasets.Features(
|
| 18 |
+
{
|
| 19 |
+
"text": datasets.Value("string"),
|
| 20 |
+
"label": datasets.features.ClassLabel(names=['like', 'disgust', 'happiness', 'sadness', 'anger', 'surprise', 'fear', 'none']),
|
| 21 |
+
}
|
| 22 |
+
),
|
| 23 |
+
homepage=None,
|
| 24 |
+
citation=None,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
def _split_generators(self, dl_manager):
|
| 28 |
+
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
| 29 |
+
dev_path = dl_manager.download_and_extract(_DEV_DOWNLOAD_URL)
|
| 30 |
+
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
| 31 |
+
return [
|
| 32 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
| 33 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": dev_path}),
|
| 34 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
def _generate_examples(self, filepath):
|
| 38 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
| 39 |
+
csv_reader = csv.reader(
|
| 40 |
+
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
| 41 |
+
)
|
| 42 |
+
for id_, row in enumerate(csv_reader):
|
| 43 |
+
if id_ == 0:
|
| 44 |
+
continue
|
| 45 |
+
label, text = row
|
| 46 |
+
label = int(label)
|
| 47 |
+
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": 8, "names": ["like", "disgust", "happiness", "sadness", "anger", "surprise", "fear", "none"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "weibo", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4573502, "num_examples": 50000, "dataset_name": "weibo"}, "validation": {"name": "validation", "num_bytes": 455846, "num_examples": 5000, "dataset_name": "weibo"}, "test": {"name": "test", "num_bytes": 415985, "num_examples": 4571, "dataset_name": "weibo"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1KhI9WDqbx64nUTQT_FsUqU6mu6AkEc3m&export=download": {"num_bytes": 4176878, "checksum": "e89e6a384b7bdac2a126fddb21c3a0111e3a23f9d1e65001bec8cfc9e9eb1f27"}, "https://drive.google.com/u/0/uc?id=1C_-pJhh38ItfyF2-u2tTmRx2OI5zr-I9&export=download": {"num_bytes": 416174, "checksum": "ba90c6d212b762346148175b3912e6e95ad3bdab5b12a34b6c7f0ff968a1acfa"}, "https://drive.google.com/u/0/uc?id=1v5KRU1pIYUf13ebTLyfSQFRbiEO-DM8U&export=download": {"num_bytes": 379771, "checksum": "d1fcf8637aba4b9a4ceb7bd0c8481f5ca22b494bd495fb8624dfb89372965d27"}}, "download_size": 4972823, "post_processing_size": null, "dataset_size": 5445333, "size_in_bytes": 10418156}
|
weibo-test.arrow
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af007165fce137c26bcb06691e60d12dd36a9a9952ca25a5f27443071f1aaf07
|
| 3 |
+
size 416704
|
weibo-train.arrow
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7785f0edfa876284b06f2ee0cebb60c70bc7c4167e1fee4e258fc9b86e03894
|
| 3 |
+
size 4575080
|
weibo-validation.arrow
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:272a8e65b8baec693b59c42dab68da4ebe79cb2551cf299578ebebbb8923eac9
|
| 3 |
+
size 456568
|