Albert Sawczyn commited on
Commit
9d9c13d
1 Parent(s): c6b43d5

add README.md

Browse files
Files changed (1) hide show
  1. README.md +213 -0
README.md ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - other
6
+ languages:
7
+ - pl
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: 'AspectEmo'
13
+ size_categories:
14
+ - 1K
15
+ - 1K<n<10K
16
+ source_datasets:
17
+ - original
18
+ task_categories:
19
+ - text-classification
20
+ task_ids:
21
+ - sentiment-classification
22
+ ---
23
+
24
+ # AspectEmo
25
+
26
+ ## Description
27
+
28
+ AspectEmo Corpus is an extended version of a publicly available PolEmo 2.0 corpus of Polish customer reviews used in many projects on the use of different methods in sentiment analysis. The AspectEmo corpus consists of four subcorpora, each containing online customer reviews from the following domains: school, medicine, hotels, and products. All documents are annotated at the aspect level with six sentiment categories: strong negative (minus_m), weak negative (minus_s), neutral (zero), weak positive (plus_s), strong positive (plus_m).
29
+ ## Versions
30
+
31
+ | version | config name | description | default | notes |
32
+ |---------|-------------|--------------------------------|---------|------------------|
33
+ | 1.0 | "1.0" | The version used in the paper. | YES | |
34
+ | 2.0 | - | Some bugs fixed. | NO | work in progress |
35
+
36
+ ## Tasks (input, output and metrics)
37
+
38
+ Aspect-based sentiment analysis (ABSA) is a text analysis method that categorizes data by aspects and identifies the sentiment assigned to each aspect. It is the sequence tagging task.
39
+
40
+ **Input** ('*tokens'* column): sequence of tokens
41
+
42
+ **Output** ('*labels'* column): sequence of predicted tokens’ classes ("O" + 6 possible classes: strong negative (a_minus_m), weak negative (a_minus_s), neutral (a_zero), weak positive (a_plus_s), strong positive (a_plus_m), ambiguous (a_amb) )
43
+
44
+ **Domain**: school, medicine, hotels and products
45
+
46
+ **Measurements**:
47
+
48
+ **Example***: ['Dużo', 'wymaga', ',', 'ale', 'bardzo', 'uczciwy', 'i', 'przyjazny', 'studentom', '.', 'Warto', 'chodzić', 'na', 'konsultacje', '.', 'Docenia', 'postępy', 'i', 'zaangażowanie', '.', 'Polecam', '.']* → *['O', 'a_plus_s', 'O', 'O', 'O', 'a_plus_m', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'a_zero', 'O', 'a_plus_m', 'O', 'O', 'O', 'O', 'O', 'O']*
49
+
50
+ ## Data splits
51
+
52
+ | Subset | Cardinality (sentences) |
53
+ |:-------|------------------------:|
54
+ | train | 1173 |
55
+ | val | 0 |
56
+ | test | 292 |
57
+
58
+ ## Class distribution in train
59
+
60
+ | Class | Fraction of tokens |
61
+ |:----------|---------------------:|
62
+ | O | 0.879809 |
63
+ | a_plus_m | 0.043147 |
64
+ | a_minus_m | 0.036641 |
65
+ | a_zero | 0.028115 |
66
+ | a_minus_s | 0.004506 |
67
+ | a_plus_s | 0.004492 |
68
+ | a_amb | 0.003289 |
69
+
70
+ ## Citation
71
+
72
+ ```
73
+ @misc{11321/849,
74
+ title = {{AspectEmo} 1.0: Multi-Domain Corpus of Consumer Reviews for Aspect-Based Sentiment Analysis},
75
+ author = {Koco{\'n}, Jan and Radom, Jarema and Kaczmarz-Wawryk, Ewa and Wabnic, Kamil and Zaj{\c a}czkowska, Ada and Za{\'s}ko-Zieli{\'n}ska, Monika},
76
+ url = {http://hdl.handle.net/11321/849},
77
+ note = {{CLARIN}-{PL} digital repository},
78
+ copyright = {The {MIT} License},
79
+ year = {2021}
80
+ }
81
+ ```
82
+
83
+ ## License
84
+
85
+ ```
86
+ The MIT License
87
+ ```
88
+
89
+ ## Links
90
+
91
+ [HuggingFace](https://huggingface.co/datasets/clarin-pl/aspectemo)
92
+
93
+ [Source](https://clarin-pl.eu/dspace/handle/11321/849)
94
+
95
+ [Paper](https://sentic.net/sentire2021kocon.pdf)
96
+
97
+ ## Examples
98
+
99
+ ### Loading
100
+
101
+ ```python
102
+ from pprint import pprint
103
+
104
+ from datasets import load_dataset
105
+
106
+ dataset = load_dataset("clarin-pl/aspectemo")
107
+ pprint(dataset['train'][20])
108
+
109
+ # {'labels': [0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0],
110
+ # 'tokens': ['Dużo',
111
+ # 'wymaga',
112
+ # ',',
113
+ # 'ale',
114
+ # 'bardzo',
115
+ # 'uczciwy',
116
+ # 'i',
117
+ # 'przyjazny',
118
+ # 'studentom',
119
+ # '.',
120
+ # 'Warto',
121
+ # 'chodzić',
122
+ # 'na',
123
+ # 'konsultacje',
124
+ # '.',
125
+ # 'Docenia',
126
+ # 'postępy',
127
+ # 'i',
128
+ # 'zaangażowanie',
129
+ # '.',
130
+ # 'Polecam',
131
+ # '.']}
132
+ ```
133
+
134
+ ### Evaluation
135
+
136
+ ```python
137
+ import random
138
+ from pprint import pprint
139
+
140
+ from datasets import load_dataset, load_metric
141
+
142
+ dataset = load_dataset("clarin-pl/aspectemo")
143
+ references = dataset["test"]["labels"]
144
+
145
+ # generate random predictions
146
+ predictions = [
147
+ [
148
+ random.randrange(dataset["train"].features["labels"].feature.num_classes)
149
+ for _ in range(len(labels))
150
+ ]
151
+ for labels in references
152
+ ]
153
+
154
+ # transform to original names of labels
155
+ references_named = [
156
+ [dataset["train"].features["labels"].feature.names[label] for label in labels]
157
+ for labels in references
158
+ ]
159
+ predictions_named = [
160
+ [dataset["train"].features["labels"].feature.names[label] for label in labels]
161
+ for labels in predictions
162
+ ]
163
+
164
+ # transform to BILOU scheme
165
+ references_named = [
166
+ [f"U-{label}" if label != "O" else label for label in labels]
167
+ for labels in references_named
168
+ ]
169
+ predictions_named = [
170
+ [f"U-{label}" if label != "O" else label for label in labels]
171
+ for labels in predictions_named
172
+ ]
173
+
174
+ # utilise seqeval to evaluate
175
+ seqeval = load_metric("seqeval")
176
+ seqeval_score = seqeval.compute(
177
+ predictions=predictions_named,
178
+ references=references_named,
179
+ scheme="BILOU",
180
+ mode="strict",
181
+ )
182
+
183
+ pprint(seqeval_score)
184
+
185
+ # {'a_amb': {'f1': 0.00597237775289287,
186
+ # 'number': 91,
187
+ # 'precision': 0.003037782418834251,
188
+ # 'recall': 0.17582417582417584},
189
+ # 'a_minus_m': {'f1': 0.048306148055207034,
190
+ # 'number': 1039,
191
+ # 'precision': 0.0288551620760727,
192
+ # 'recall': 0.1482194417709336},
193
+ # 'a_minus_s': {'f1': 0.004682997118155619,
194
+ # 'number': 67,
195
+ # 'precision': 0.0023701002734731083,
196
+ # 'recall': 0.19402985074626866},
197
+ # 'a_plus_m': {'f1': 0.045933014354066985,
198
+ # 'number': 1015,
199
+ # 'precision': 0.027402473834443386,
200
+ # 'recall': 0.14187192118226602},
201
+ # 'a_plus_s': {'f1': 0.0021750951604132683,
202
+ # 'number': 41,
203
+ # 'precision': 0.001095690284879474,
204
+ # 'recall': 0.14634146341463414},
205
+ # 'a_zero': {'f1': 0.025159400310184387,
206
+ # 'number': 501,
207
+ # 'precision': 0.013768389287061486,
208
+ # 'recall': 0.14570858283433133},
209
+ # 'overall_accuracy': 0.13970115681233933,
210
+ # 'overall_f1': 0.02328248652368391,
211
+ # 'overall_precision': 0.012639312620633834,
212
+ # 'overall_recall': 0.14742193173565724}
213
+ ```