Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
Catalan
Size:
10K - 100K
DOI:
License:
jsaizant
commited on
Commit
•
72cc805
1
Parent(s):
b34ec94
Moved files and dataloader to OLD
Browse files- OLD/CaSERa-catalan-stance-emotions-raco.py +97 -0
- OLD/data.jsonl +3 -0
OLD/CaSERa-catalan-stance-emotions-raco.py
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Loading script for the ReviewsFinder dataset.
|
2 |
+
|
3 |
+
|
4 |
+
import json
|
5 |
+
|
6 |
+
import datasets
|
7 |
+
|
8 |
+
|
9 |
+
logger = datasets.logging.get_logger(__name__)
|
10 |
+
|
11 |
+
|
12 |
+
_CITATION = """ """
|
13 |
+
|
14 |
+
|
15 |
+
_DESCRIPTION = """ The CaSERA dataset is a Catalan corpus from the forum Racó Català annotated with Emotions and Dynamic Stance. The dataset contains 15.782 unique sentences grouped in 10.745 pairs of sentences, paired as original messages and answers to these messages.
|
16 |
+
"""
|
17 |
+
|
18 |
+
|
19 |
+
_HOMEPAGE = """ https://huggingface.co/datasets/projecte-aina/CaSERA-catalan-stance-emotions-raco """
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
_URL = "https://huggingface.co/datasets/projecte-aina/CaSERa-catalan-stance-emotions-raco/resolve/main/"
|
24 |
+
_FILE = "data.jsonl"
|
25 |
+
|
26 |
+
|
27 |
+
class CaSERAConfig(datasets.BuilderConfig):
|
28 |
+
""" Builder config for the CaSERA dataset """
|
29 |
+
|
30 |
+
def __init__(self, **kwargs):
|
31 |
+
"""BuilderConfig for CaSERA.
|
32 |
+
Args:
|
33 |
+
**kwargs: keyword arguments forwarded to super.
|
34 |
+
"""
|
35 |
+
super(CaSERAConfig, self).__init__(**kwargs)
|
36 |
+
|
37 |
+
|
38 |
+
class CaSERA(datasets.GeneratorBasedBuilder):
|
39 |
+
""" CaSERA Dataset """
|
40 |
+
|
41 |
+
|
42 |
+
BUILDER_CONFIGS = [
|
43 |
+
CaSERAConfig(
|
44 |
+
name="CaSERA",
|
45 |
+
version=datasets.Version("1.0.0"),
|
46 |
+
description="CaSERA dataset",
|
47 |
+
),
|
48 |
+
]
|
49 |
+
|
50 |
+
|
51 |
+
def _info(self):
|
52 |
+
return datasets.DatasetInfo(
|
53 |
+
description=_DESCRIPTION,
|
54 |
+
features=datasets.Features(
|
55 |
+
{"id_conversation": datasets.Value("string"),
|
56 |
+
"id_reply": datasets.Value("string"),
|
57 |
+
"parent_text": datasets.Value("string"),
|
58 |
+
"reply_text": datasets.Value("string"),
|
59 |
+
"dynamic_stance": datasets.features.ClassLabel
|
60 |
+
(names=
|
61 |
+
['Agree', 'Disagree', 'Elaborate', 'Query', 'Neutral', 'Unrelated', 'NA'
|
62 |
+
]
|
63 |
+
),
|
64 |
+
"parent_emotion": datasets.Sequence(datasets.Value("string")),
|
65 |
+
"reply_emotion": datasets.Sequence(datasets.Value("string")),
|
66 |
+
}
|
67 |
+
),
|
68 |
+
homepage=_HOMEPAGE,
|
69 |
+
citation=_CITATION,
|
70 |
+
)
|
71 |
+
|
72 |
+
def _split_generators(self, dl_manager):
|
73 |
+
"""Returns SplitGenerators."""
|
74 |
+
urls_to_download = {
|
75 |
+
"data": f"{_URL}{_FILE}",
|
76 |
+
}
|
77 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
78 |
+
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["data"]}),
|
81 |
+
]
|
82 |
+
|
83 |
+
def _generate_examples(self, filepath):
|
84 |
+
"""This function returns the examples in the raw (text) form."""
|
85 |
+
logger.info("generating examples from = %s", filepath)
|
86 |
+
with open(filepath, encoding="utf-8") as f:
|
87 |
+
data = [json.loads(line) for line in f]
|
88 |
+
for id_, pair in enumerate(data):
|
89 |
+
yield id_, {
|
90 |
+
"id_conversation": pair["id_conversation"],
|
91 |
+
"id_reply": pair["id_reply"],
|
92 |
+
"parent_text":pair["parent_text"],
|
93 |
+
"reply_text": pair["reply_text"],
|
94 |
+
"dynamic_stance": pair["dynamic_stance"],
|
95 |
+
"parent_emotion": pair["parent_emotion"],
|
96 |
+
"reply_emotion": pair["reply_emotion"],
|
97 |
+
}
|
OLD/data.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f5c7be063098d1b812760b5d2d4beba2e5dd867df12ecdb7ffe3cc8e28194f33
|
3 |
+
size 16606618
|