parquet-converter
commited on
Commit
·
8481361
1
Parent(s):
f2e0e4a
Update parquet files
Browse files
default/emotion_english-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:581b8a1e855ec7cffbb27147a63616f636fb561d15a3424beac21a51435abb66
|
3 |
+
size 7704
|
default/emotion_english-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:95cece726154ce0d9be9b3926e966c5b4997e0b009aa83f2dd9622538bbab8ec
|
3 |
+
size 44844
|
default/emotion_english-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cc565de51b862c29221267da44cf54d79a25d30dbee47721a1b29563ad3d4008
|
3 |
+
size 8475
|
emotion_english.py
DELETED
@@ -1,73 +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 |
-
# Version 5-0-pro.
|
16 |
-
"""emotion_english dataset: An emotion dataset of wilde's children's literature"""
|
17 |
-
|
18 |
-
|
19 |
-
import datasets
|
20 |
-
|
21 |
-
|
22 |
-
_DESCRIPTION = """\
|
23 |
-
The emotion_english dataset is an emotion dataset annotated by language experts under a project. \
|
24 |
-
The dataset can be used for tasks such as English emotion classification and identification.
|
25 |
-
"""
|
26 |
-
|
27 |
-
|
28 |
-
_HOMEPAGE = "https://github.com/nana-lyj/emotion_english"
|
29 |
-
|
30 |
-
_URLS = {
|
31 |
-
"train": f"https://raw.githubusercontent.com/nana-lyj/emotion_english/main/data/train.tsv",
|
32 |
-
"dev": f"https://raw.githubusercontent.com/nana-lyj/emotion_english/main/data/dev.tsv",
|
33 |
-
"test": f"https://raw.githubusercontent.com/nana-lyj/emotion_english/main/data/test.tsv",
|
34 |
-
}
|
35 |
-
|
36 |
-
_LABEL_MAPPING = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8}
|
37 |
-
|
38 |
-
|
39 |
-
class emotionenglish(datasets.GeneratorBasedBuilder):
|
40 |
-
"""emotion_english dataset: An emotion dataset of wilde's children's literature"""
|
41 |
-
|
42 |
-
VERSION = datasets.Version("1.0.0")
|
43 |
-
|
44 |
-
def _info(self):
|
45 |
-
return datasets.DatasetInfo(
|
46 |
-
description=_DESCRIPTION,
|
47 |
-
features=datasets.Features(
|
48 |
-
{
|
49 |
-
"id": datasets.Value("int32"),
|
50 |
-
"sentence": datasets.Value("string"),
|
51 |
-
"label": datasets.ClassLabel(names=["joy", "sadness", "anger", "fear", "trust", "disgust", "surprise", "anticipation", "other"]),
|
52 |
-
}
|
53 |
-
),
|
54 |
-
supervised_keys=None,
|
55 |
-
homepage=_HOMEPAGE,
|
56 |
-
)
|
57 |
-
|
58 |
-
def _split_generators(self, dl_manager):
|
59 |
-
downloaded_files = dl_manager.download(_URLS)
|
60 |
-
return [
|
61 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
62 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
63 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
64 |
-
]
|
65 |
-
|
66 |
-
def _generate_examples(self, filepath):
|
67 |
-
with open(filepath, encoding="utf-8") as f:
|
68 |
-
lines = f.readlines()
|
69 |
-
for line in lines:
|
70 |
-
fields = line.strip().split("\t")
|
71 |
-
idx, sentence, label = fields
|
72 |
-
label = _LABEL_MAPPING[int(label)]
|
73 |
-
yield int(idx), {"id": int(idx), "sentence": sentence, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|