data release
Browse files- CaSSA-catalan-structured-sentiment-analysis.py +84 -0
- README.md +181 -1
- data.jsonl +0 -0
CaSSA-catalan-structured-sentiment-analysis.py
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = """ """
|
16 |
+
|
17 |
+
|
18 |
+
_HOMEPAGE = """ https://huggingface.co/datasets/projecte-aina/CaSSA-catalan-structured-sentiment-analysis/ """
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
_URL = "https://huggingface.co/datasets/projecte-aina/CaSSA-catalan-structured-sentiment-analysis/tree/main"
|
23 |
+
_FILE = "data.jsonl"
|
24 |
+
|
25 |
+
|
26 |
+
class CaSSAConfig(datasets.BuilderConfig):
|
27 |
+
""" Builder config for the CaSSA dataset """
|
28 |
+
|
29 |
+
def __init__(self, **kwargs):
|
30 |
+
"""BuilderConfig for CaSSA.
|
31 |
+
Args:
|
32 |
+
**kwargs: keyword arguments forwarded to super.
|
33 |
+
"""
|
34 |
+
super(CaSSAConfig, self).__init__(**kwargs)
|
35 |
+
|
36 |
+
|
37 |
+
class CaSSA(datasets.GeneratorBasedBuilder):
|
38 |
+
""" CaSSA Dataset """
|
39 |
+
|
40 |
+
|
41 |
+
BUILDER_CONFIGS = [
|
42 |
+
CaSSAConfig(
|
43 |
+
name="CaSSA",
|
44 |
+
version=datasets.Version("1.0.0"),
|
45 |
+
description="CaSSA dataset",
|
46 |
+
),
|
47 |
+
]
|
48 |
+
|
49 |
+
|
50 |
+
def _info(self):
|
51 |
+
return datasets.DatasetInfo(
|
52 |
+
description=_DESCRIPTION,
|
53 |
+
features=datasets.Features(
|
54 |
+
{"sent_id": datasets.Value("string"),
|
55 |
+
"text": datasets.Value("string"),
|
56 |
+
"opinions": datasets.Value("string"),
|
57 |
+
}
|
58 |
+
),
|
59 |
+
homepage=_HOMEPAGE,
|
60 |
+
citation=_CITATION,
|
61 |
+
)
|
62 |
+
|
63 |
+
def _split_generators(self, dl_manager):
|
64 |
+
"""Returns SplitGenerators."""
|
65 |
+
urls_to_download = {
|
66 |
+
"data": f"{_URL}{_FILE}",
|
67 |
+
}
|
68 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
69 |
+
|
70 |
+
return [
|
71 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["data"]}),
|
72 |
+
]
|
73 |
+
|
74 |
+
def _generate_examples(self, filepath):
|
75 |
+
"""This function returns the examples in the raw (text) form."""
|
76 |
+
logger.info("generating examples from = %s", filepath)
|
77 |
+
with open(filepath, encoding="utf-8") as f:
|
78 |
+
data = [json.loads(line) for line in f]
|
79 |
+
for id_, text in enumerate(data):
|
80 |
+
yield id_, {
|
81 |
+
"sent_id": text['sent_id'],
|
82 |
+
"text": text['text'],
|
83 |
+
"opinions": text['opinions']
|
84 |
+
}
|
README.md
CHANGED
@@ -1,3 +1,183 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
annotations_creators:
|
3 |
+
- Barcelona Supercomputing Center
|
4 |
+
language_creators:
|
5 |
+
- Racó Català
|
6 |
+
- GuiaCat
|
7 |
+
language:
|
8 |
+
- ca
|
9 |
+
license:
|
10 |
+
- cc-by-nc-4.0
|
11 |
+
multilinguality:
|
12 |
+
- monolingual
|
13 |
+
pretty_name: CaSSA
|
14 |
+
size_categories:
|
15 |
+
- ?
|
16 |
+
task_categories:
|
17 |
+
- text-classification
|
18 |
+
task_ids: []
|
19 |
---
|
20 |
+
|
21 |
+
# Dataset Card for CaSSA, the Catalan Structured Sentiment Analysis
|
22 |
+
|
23 |
+
## Table of Contents
|
24 |
+
- [Table of Contents](#table-of-contents)
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-fields)
|
32 |
+
- [Data Splits](#data-splits)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Annotations](#annotations)
|
36 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
37 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
38 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
39 |
+
- [Discussion of Biases](#discussion-of-biases)
|
40 |
+
- [Other Known Limitations](#other-known-limitations)
|
41 |
+
- [Additional Information](#additional-information)
|
42 |
+
- [Dataset Curators](#dataset-curators)
|
43 |
+
- [Licensing Information](#licensing-information)
|
44 |
+
- [Citation Information](#citation-information)
|
45 |
+
- [Contributions](#contributions)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Point of Contact:** [Blanca Calvo](aina@bsc.es)
|
50 |
+
|
51 |
+
### Dataset Summary
|
52 |
+
|
53 |
+
The CaSSA dataset is a corpus of 6,400 reviews and forum messages annotated with polar expressions. Each piece of text is annotated with all the expressions of polarity that it contains. For each polar expression, we annotated the expression itself, the target (the object of the expression), and the source (the subject expressing the sentiment). 25,453 polar expressions have been annotated.
|
54 |
+
|
55 |
+
### Supported Tasks and Leaderboards
|
56 |
+
|
57 |
+
This dataset can be used to train models for sentiment analysis.
|
58 |
+
|
59 |
+
### Languages
|
60 |
+
|
61 |
+
The dataset is in Catalan (`ca-CA`).
|
62 |
+
|
63 |
+
## Dataset Structure
|
64 |
+
|
65 |
+
Each instance in the dataset is a text. For each text, there can be 0 to unlimited polar expressions, which are contained in the "opinions" field. Each opinion contains a source, a target, a polar expression, a polarity value and an intensity value.
|
66 |
+
|
67 |
+
### Data Instances
|
68 |
+
|
69 |
+
```
|
70 |
+
{
|
71 |
+
"sent_id": "2d6a3a0f-6686-4d8b-9c5f-51c424ff90be",
|
72 |
+
"text": "El seu menú de nit de cap de setmana es boníssim, plats fets amb criteri i que surten com un rellotge. Servei proper i amable. Per poc mes de 20 euros entre pisos i flautes menges com un rei.",
|
73 |
+
"opinions":
|
74 |
+
[
|
75 |
+
{
|
76 |
+
"Source": [[], []],
|
77 |
+
"Target": [["Servei"], ["23:24"]],
|
78 |
+
"Polar_expression": [["proper"], ["24:25"]],
|
79 |
+
"Polarity": "Neutral",
|
80 |
+
"Intensity": "Standard"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"Source": [[], []],
|
84 |
+
"Target": [["Servei"], ["23:24"]],
|
85 |
+
"Polar_expression": [["amable"], ["26:27"]],
|
86 |
+
"Polarity": "Positive",
|
87 |
+
"Intensity": "Standard"
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"Source": [[], []],
|
91 |
+
"Target": [[], []],
|
92 |
+
"Polar_expression": [["menges com un rei"], ["38:42"]],
|
93 |
+
"Polarity": "Positive",
|
94 |
+
"Intensity": "Strong"
|
95 |
+
},
|
96 |
+
{
|
97 |
+
"Source": [["seu"], ["1:2"]],
|
98 |
+
"Target": [["menú de nit de cap de setmana"], ["2:9"]],
|
99 |
+
"Polar_expression": [["bon\u00edssim"], ["10:11"]],
|
100 |
+
"Polarity": "Positive",
|
101 |
+
"Intensity": "Strong"},
|
102 |
+
{
|
103 |
+
"Source": [[], []],
|
104 |
+
"Target": [["plats"], ["12:13"]],
|
105 |
+
"Polar_expression": [["amb criteri"], ["14:16"]],
|
106 |
+
"Polarity": "Positive",
|
107 |
+
"Intensity": "Standard"
|
108 |
+
}
|
109 |
+
]
|
110 |
+
}
|
111 |
+
|
112 |
+
```
|
113 |
+
|
114 |
+
### Data Splits
|
115 |
+
|
116 |
+
The dataset does not contain splits.
|
117 |
+
|
118 |
+
## Dataset Creation
|
119 |
+
|
120 |
+
### Curation Rationale
|
121 |
+
|
122 |
+
We created this corpus to contribute to the development of language models in Catalan, a low-resource language.
|
123 |
+
|
124 |
+
### Source Data
|
125 |
+
|
126 |
+
The data was collected using the messages from the GuiaCat online guide and the forum Racó Català.
|
127 |
+
|
128 |
+
#### Initial Data Collection and Normalization
|
129 |
+
|
130 |
+
We selected all the restaurant reviews we had from GuiaCat, and used a LLM to select messages in Racó Català that were written in the style of reviews.
|
131 |
+
|
132 |
+
#### Who are the source language producers?
|
133 |
+
|
134 |
+
The source language producers are users of GuiaCat and Racó Català.
|
135 |
+
|
136 |
+
### Annotations
|
137 |
+
|
138 |
+
Each opinion contains a source, a target, a polar expression, a polarity value and an intensity value. Source, Target, and Polar_expressions are spans, which are represented both by the string and by the position of the tokens. Polarity and Intensity are labels, which can respectively be, Positive, Negative and Neutral, and Standard and Strong.
|
139 |
+
|
140 |
+
#### Annotation process
|
141 |
+
|
142 |
+
- The data was annotated by 2 annotators. In the cases in which they did not fully agree, a third annotated selected the preferred annotation.
|
143 |
+
|
144 |
+
#### Who are the annotators?
|
145 |
+
|
146 |
+
All the annotators are native speakers of Catalan.
|
147 |
+
|
148 |
+
### Personal and Sensitive Information
|
149 |
+
|
150 |
+
The data from Racó Català was annonymised to remove user names and emails, which were changed to random Catalan names. The mentions to the forum itself have also been changed.
|
151 |
+
|
152 |
+
## Considerations for Using the Data
|
153 |
+
|
154 |
+
### Social Impact of Dataset
|
155 |
+
|
156 |
+
We hope this corpus contributes to the development of language models in Catalan, a low-resource language.
|
157 |
+
|
158 |
+
### Discussion of Biases
|
159 |
+
|
160 |
+
We are aware that, since the data comes from online reviews and a public forum, this will contain biases, hate speech and toxic content. We have not applied any steps to reduce their impact.
|
161 |
+
|
162 |
+
### Other Known Limitations
|
163 |
+
|
164 |
+
## Additional Information
|
165 |
+
|
166 |
+
### Dataset Curators
|
167 |
+
|
168 |
+
Language Technologies Unit (LangTech) at the Barcelona Supercomputing Center.
|
169 |
+
|
170 |
+
This work was funded by the [Departament de la Vicepresidència i de Polítiques Digitals i Territori de la Generalitat de Catalunya](https://politiquesdigitals.gencat.cat/ca/inici/index.html#googtrans(ca|en) within the framework of [Projecte AINA](https://politiquesdigitals.gencat.cat/ca/economia/catalonia-ai/aina).
|
171 |
+
|
172 |
+
|
173 |
+
### Licensing Information
|
174 |
+
|
175 |
+
[Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/).
|
176 |
+
|
177 |
+
### Citation Information
|
178 |
+
|
179 |
+
```
|
180 |
+
|
181 |
+
```
|
182 |
+
|
183 |
+
### Contributions
|
data.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|