Update emotion_chinese.py
Browse files- emotion_chinese.py +11 -10
emotion_chinese.py
CHANGED
@@ -3,7 +3,7 @@
|
|
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 |
#
|
@@ -12,6 +12,7 @@
|
|
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 |
|
@@ -24,18 +25,18 @@ The dataset can be used for tasks such as multilingual (Chinese and English) emo
|
|
24 |
"""
|
25 |
|
26 |
|
27 |
-
_HOMEPAGE = "https://github.com/nana-lyj/
|
28 |
|
29 |
-
_BASE_URL = "https://github.com/nana-lyj/emotion_chinese_english/tree/main/data/"
|
30 |
_URLS = {
|
31 |
-
"train": f"
|
32 |
-
"dev": f"
|
33 |
-
"test": f"
|
34 |
}
|
35 |
-
_LABEL_MAPPING = {0, 1, 2, 3, 4, 5, 6, 7, 8}
|
36 |
|
|
|
37 |
|
38 |
-
|
|
|
39 |
"""emotion_chinese_english dataset: A multilingual emotion dataset of wilde's children's literature"""
|
40 |
|
41 |
VERSION = datasets.Version("1.0.0")
|
@@ -67,6 +68,6 @@ class WildeEmotion(datasets.GeneratorBasedBuilder):
|
|
67 |
lines = f.readlines()
|
68 |
for line in lines:
|
69 |
fields = line.strip().split("\t")
|
70 |
-
idx,
|
71 |
label = _LABEL_MAPPING[int(label)]
|
72 |
-
yield int(idx), {"id": int(idx), "sentence":
|
|
|
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 |
#
|
|
|
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_chinese_english dataset: A multilingual emotion dataset of wilde's children's literature"""
|
17 |
|
18 |
|
|
|
25 |
"""
|
26 |
|
27 |
|
28 |
+
_HOMEPAGE = "https://github.com/nana-lyj/emotion_chinese"
|
29 |
|
|
|
30 |
_URLS = {
|
31 |
+
"train": f"https://raw.githubusercontent.com/nana-lyj/emotion_chinese/main/data/train.tsv",
|
32 |
+
"dev": f"https://raw.githubusercontent.com/nana-lyj/emotion_chinese/main/data/dev.tsv",
|
33 |
+
"test": f"https://raw.githubusercontent.com/nana-lyj/emotion_chinese/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 emotionchineseenglish(datasets.GeneratorBasedBuilder):
|
40 |
"""emotion_chinese_english dataset: A multilingual emotion dataset of wilde's children's literature"""
|
41 |
|
42 |
VERSION = datasets.Version("1.0.0")
|
|
|
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}
|