Datasets:
parquet-converter
commited on
Commit
•
584b792
1
Parent(s):
0bf098b
Update parquet files
Browse files
README.md
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
---
|
2 |
-
task_categories:
|
3 |
-
- text-classification
|
4 |
-
language:
|
5 |
-
- zh
|
6 |
-
- en
|
7 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default/emotion_chinese_english-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:171b478b357eef25633ea3b8452ea296ce4c0b2d0b69faeeb10e7971e954cb91
|
3 |
+
size 11249
|
default/emotion_chinese_english-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:35e739131819ecc2e2a3840627beb6e19538043b89b7aec329fc30796f4fa7e1
|
3 |
+
size 72227
|
default/emotion_chinese_english-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5f7f1f6d7eee1418f595bd4e0649167da719dee19171c4a8a58c206ab06a961c
|
3 |
+
size 11825
|
emotion_chinese_english.py
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
"""emotion_chinese_english dataset: A multilingual emotion dataset of wilde's children's literature"""
|
16 |
-
|
17 |
-
|
18 |
-
import datasets
|
19 |
-
|
20 |
-
|
21 |
-
_DESCRIPTION = """\
|
22 |
-
The emotion_chinese_english dataset is a multilingual emotion dataset annotated by language experts under a project. \
|
23 |
-
The dataset can be used for tasks such as multilingual (Chinese and English) emotion classification and identification.
|
24 |
-
"""
|
25 |
-
|
26 |
-
|
27 |
-
_HOMEPAGE = "https://github.com/nana-lyj/emotion_chinese_english"
|
28 |
-
|
29 |
-
_URLS = {
|
30 |
-
"train": f"https://raw.githubusercontent.com/nana-lyj/emotion_chinese_english/main/data/train.tsv",
|
31 |
-
"dev": f"https://raw.githubusercontent.com/nana-lyj/emotion_chinese_english/main/data/dev.tsv",
|
32 |
-
"test": f"https://raw.githubusercontent.com/nana-lyj/emotion_chinese_english/main/data/test.tsv",
|
33 |
-
}
|
34 |
-
|
35 |
-
_LABEL_MAPPING = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8}
|
36 |
-
|
37 |
-
|
38 |
-
class emotionchineseenglish(datasets.GeneratorBasedBuilder):
|
39 |
-
"""emotion_chinese_english dataset: A multilingual emotion dataset of wilde's children's literature"""
|
40 |
-
|
41 |
-
VERSION = datasets.Version("1.0.0")
|
42 |
-
|
43 |
-
def _info(self):
|
44 |
-
return datasets.DatasetInfo(
|
45 |
-
description=_DESCRIPTION,
|
46 |
-
features=datasets.Features(
|
47 |
-
{
|
48 |
-
"id": datasets.Value("int32"),
|
49 |
-
"sentence": datasets.Value("string"),
|
50 |
-
"label": datasets.ClassLabel(names=["joy", "sadness", "anger", "fear", "trust", "disgust", "surprise", "anticipation", "other"]),
|
51 |
-
}
|
52 |
-
),
|
53 |
-
supervised_keys=None,
|
54 |
-
homepage=_HOMEPAGE,
|
55 |
-
)
|
56 |
-
|
57 |
-
def _split_generators(self, dl_manager):
|
58 |
-
downloaded_files = dl_manager.download(_URLS)
|
59 |
-
return [
|
60 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
61 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
62 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
63 |
-
]
|
64 |
-
|
65 |
-
def _generate_examples(self, filepath):
|
66 |
-
with open(filepath, encoding="utf-8") as f:
|
67 |
-
lines = f.readlines()
|
68 |
-
for line in lines:
|
69 |
-
fields = line.strip().split("\t")
|
70 |
-
idx, sentence, label = fields
|
71 |
-
label = _LABEL_MAPPING[int(label)]
|
72 |
-
yield int(idx), {"id": int(idx), "sentence": sentence, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|