Datasets:
Commit
•
ff7a392
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +179 -0
- dataset_infos.json +1 -0
- dummy/ca/0.0.0/dummy_data.zip +3 -0
- dummy/eu/0.0.0/dummy_data.zip +3 -0
- multi_booked.py +165 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
ca:
|
8 |
+
- ca
|
9 |
+
eu:
|
10 |
+
- eu
|
11 |
+
licenses:
|
12 |
+
- cc-by-3-0
|
13 |
+
multilinguality:
|
14 |
+
- monolingual
|
15 |
+
size_categories:
|
16 |
+
- n<1K
|
17 |
+
source_datasets:
|
18 |
+
- original
|
19 |
+
task_categories:
|
20 |
+
- text-classification
|
21 |
+
task_ids:
|
22 |
+
- sentiment-classification
|
23 |
+
---
|
24 |
+
|
25 |
+
# Dataset Card for MultiBooked
|
26 |
+
|
27 |
+
## Table of Contents
|
28 |
+
- [Dataset Description](#dataset-description)
|
29 |
+
- [Dataset Summary](#dataset-summary)
|
30 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
31 |
+
- [Languages](#languages)
|
32 |
+
- [Dataset Structure](#dataset-structure)
|
33 |
+
- [Data Instances](#data-instances)
|
34 |
+
- [Data Fields](#data-instances)
|
35 |
+
- [Data Splits](#data-instances)
|
36 |
+
- [Dataset Creation](#dataset-creation)
|
37 |
+
- [Curation Rationale](#curation-rationale)
|
38 |
+
- [Source Data](#source-data)
|
39 |
+
- [Annotations](#annotations)
|
40 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
41 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
42 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
43 |
+
- [Discussion of Biases](#discussion-of-biases)
|
44 |
+
- [Other Known Limitations](#other-known-limitations)
|
45 |
+
- [Additional Information](#additional-information)
|
46 |
+
- [Dataset Curators](#dataset-curators)
|
47 |
+
- [Licensing Information](#licensing-information)
|
48 |
+
- [Citation Information](#citation-information)
|
49 |
+
|
50 |
+
## Dataset Description
|
51 |
+
|
52 |
+
- **Homepage:** http://hdl.handle.net/10230/33928
|
53 |
+
- **Repository:** https://github.com/jerbarnes/multibooked
|
54 |
+
- **Paper:** https://arxiv.org/abs/1803.08614
|
55 |
+
- **Leaderboard:**
|
56 |
+
- **Point of Contact:**
|
57 |
+
|
58 |
+
### Dataset Summary
|
59 |
+
|
60 |
+
MultiBooked is a corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification.
|
61 |
+
|
62 |
+
The corpora are compiled from hotel reviews taken mainly from booking.com. The corpora are in Kaf/Naf format, which is
|
63 |
+
an xml-style stand-off format that allows for multiple layers of annotation. Each review was sentence- and
|
64 |
+
word-tokenized and lemmatized using Freeling for Catalan and ixa-pipes for Basque. Finally, for each language two
|
65 |
+
annotators annotated opinion holders, opinion targets, and opinion expressions for each review, following the
|
66 |
+
guidelines set out in the OpeNER project.
|
67 |
+
|
68 |
+
### Supported Tasks and Leaderboards
|
69 |
+
|
70 |
+
[More Information Needed]
|
71 |
+
|
72 |
+
### Languages
|
73 |
+
|
74 |
+
Each sub-dataset is monolingual in the languages:
|
75 |
+
- ca: Catalan
|
76 |
+
- eu: Basque
|
77 |
+
|
78 |
+
## Dataset Structure
|
79 |
+
|
80 |
+
### Data Instances
|
81 |
+
|
82 |
+
[More Information Needed]
|
83 |
+
|
84 |
+
### Data Fields
|
85 |
+
|
86 |
+
- `text`: layer of the original text.
|
87 |
+
- `wid`: list of word IDs for each word within the example.
|
88 |
+
- `sent`: list of sentence IDs for each sentence within the example.
|
89 |
+
- `para`: list of paragraph IDs for each paragraph within the example.
|
90 |
+
- `word`: list of words.
|
91 |
+
- `terms`: layer of the terms resulting from the analysis of the original text (lemmatization, morphological,
|
92 |
+
PoS tagging)
|
93 |
+
- `tid`: list of term IDs for each term within the example.
|
94 |
+
- `lemma`: list of lemmas.
|
95 |
+
- `morphofeat`: list of morphological features.
|
96 |
+
- `pos`: list of PoS tags.
|
97 |
+
- `target`: list of sublists of the corresponding word IDs (normally, the sublists contain only one element,
|
98 |
+
in a one-to-one correspondence between words and terms).
|
99 |
+
- `opinions`: layer of the opinions in the text.
|
100 |
+
- `oid`: list of opinion IDs
|
101 |
+
- `opinion_holder_target`: list of sublists of the corresponding term IDs that span the opinion holder.
|
102 |
+
- `opinion_target_target`: list of sublists of the corresponding term IDs that span the opinion target.
|
103 |
+
- `opinion_expression_polarity`: list of the opinion expression polarities. The polarity can take one of the values:
|
104 |
+
`StrongNegative`, `Negative`, `Positive`, or `StrongPositive`.
|
105 |
+
- `opinion_expression_target`: list of sublists of the corresponding term IDs that span the opinion expression.
|
106 |
+
|
107 |
+
### Data Splits
|
108 |
+
|
109 |
+
[More Information Needed]
|
110 |
+
|
111 |
+
## Dataset Creation
|
112 |
+
|
113 |
+
### Curation Rationale
|
114 |
+
|
115 |
+
[More Information Needed]
|
116 |
+
|
117 |
+
### Source Data
|
118 |
+
|
119 |
+
#### Initial Data Collection and Normalization
|
120 |
+
|
121 |
+
[More Information Needed]
|
122 |
+
|
123 |
+
#### Who are the source language producers?
|
124 |
+
|
125 |
+
[More Information Needed]
|
126 |
+
|
127 |
+
### Annotations
|
128 |
+
|
129 |
+
#### Annotation process
|
130 |
+
|
131 |
+
[More Information Needed]
|
132 |
+
|
133 |
+
#### Who are the annotators?
|
134 |
+
|
135 |
+
[More Information Needed]
|
136 |
+
|
137 |
+
### Personal and Sensitive Information
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
## Considerations for Using the Data
|
142 |
+
|
143 |
+
### Social Impact of Dataset
|
144 |
+
|
145 |
+
[More Information Needed]
|
146 |
+
|
147 |
+
### Discussion of Biases
|
148 |
+
|
149 |
+
[More Information Needed]
|
150 |
+
|
151 |
+
### Other Known Limitations
|
152 |
+
|
153 |
+
[More Information Needed]
|
154 |
+
|
155 |
+
## Additional Information
|
156 |
+
|
157 |
+
### Dataset Curators
|
158 |
+
|
159 |
+
[More Information Needed]
|
160 |
+
|
161 |
+
### Licensing Information
|
162 |
+
|
163 |
+
Dataset is under the [CC-BY 3.0](https://creativecommons.org/licenses/by/3.0/) license.
|
164 |
+
|
165 |
+
### Citation Information
|
166 |
+
|
167 |
+
```
|
168 |
+
@inproceedings{Barnes2018multibooked,
|
169 |
+
author={Barnes, Jeremy and Lambert, Patrik and Badia, Toni},
|
170 |
+
title={MultiBooked: A corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification},
|
171 |
+
booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC'18)},
|
172 |
+
year = {2018},
|
173 |
+
month = {May},
|
174 |
+
date = {7-12},
|
175 |
+
address = {Miyazaki, Japan},
|
176 |
+
publisher = {European Language Resources Association (ELRA)},
|
177 |
+
language = {english}
|
178 |
+
}
|
179 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"ca": {"description": "MultiBooked is a corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification.\n\nThe corpora are compiled from hotel reviews taken mainly from booking.com. The corpora are in Kaf/Naf format, which is\nan xml-style stand-off format that allows for multiple layers of annotation. Each review was sentence- and\nword-tokenized and lemmatized using Freeling for Catalan and ixa-pipes for Basque. Finally, for each language two\nannotators annotated opinion holders, opinion targets, and opinion expressions for each review, following the\nguidelines set out in the OpeNER project.\n", "citation": "@inproceedings{Barnes2018multibooked,\n author={Barnes, Jeremy and Lambert, Patrik and Badia, Toni},\n title={MultiBooked: A corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification},\n booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC'18)},\n year = {2018},\n month = {May},\n date = {7-12},\n address = {Miyazaki, Japan},\n publisher = {European Language Resources Association (ELRA)},\n language = {english}\n}\n", "homepage": "http://hdl.handle.net/10230/33928", "license": "CC-BY 3.0", "features": {"text": {"feature": {"wid": {"dtype": "string", "id": null, "_type": "Value"}, "sent": {"dtype": "string", "id": null, "_type": "Value"}, "para": {"dtype": "string", "id": null, "_type": "Value"}, "word": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "terms": {"feature": {"tid": {"dtype": "string", "id": null, "_type": "Value"}, "lemma": {"dtype": "string", "id": null, "_type": "Value"}, "morphofeat": {"dtype": "string", "id": null, "_type": "Value"}, "pos": {"dtype": "string", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}, "opinions": {"feature": {"oid": {"dtype": "string", "id": null, "_type": "Value"}, "opinion_holder_target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "opinion_target_target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "opinion_expression_polarity": {"num_classes": 4, "names": ["StrongNegative", "Negative", "Positive", "StrongPositive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "opinion_expression_target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_booked", "config_name": "ca", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1952731, "num_examples": 567, "dataset_name": "multi_booked"}}, "download_checksums": {"https://github.com/jerbarnes/multibooked/archive/master.zip": {"num_bytes": 4429415, "checksum": "c9512b7fe0e5afc690aaf0205d61bc37e68836e008db05f17643a0de57007c80"}}, "download_size": 4429415, "post_processing_size": null, "dataset_size": 1952731, "size_in_bytes": 6382146}, "eu": {"description": "MultiBooked is a corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification.\n\nThe corpora are compiled from hotel reviews taken mainly from booking.com. The corpora are in Kaf/Naf format, which is\nan xml-style stand-off format that allows for multiple layers of annotation. Each review was sentence- and\nword-tokenized and lemmatized using Freeling for Catalan and ixa-pipes for Basque. Finally, for each language two\nannotators annotated opinion holders, opinion targets, and opinion expressions for each review, following the\nguidelines set out in the OpeNER project.\n", "citation": "@inproceedings{Barnes2018multibooked,\n author={Barnes, Jeremy and Lambert, Patrik and Badia, Toni},\n title={MultiBooked: A corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification},\n booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC'18)},\n year = {2018},\n month = {May},\n date = {7-12},\n address = {Miyazaki, Japan},\n publisher = {European Language Resources Association (ELRA)},\n language = {english}\n}\n", "homepage": "http://hdl.handle.net/10230/33928", "license": "CC-BY 3.0", "features": {"text": {"feature": {"wid": {"dtype": "string", "id": null, "_type": "Value"}, "sent": {"dtype": "string", "id": null, "_type": "Value"}, "para": {"dtype": "string", "id": null, "_type": "Value"}, "word": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "terms": {"feature": {"tid": {"dtype": "string", "id": null, "_type": "Value"}, "lemma": {"dtype": "string", "id": null, "_type": "Value"}, "morphofeat": {"dtype": "string", "id": null, "_type": "Value"}, "pos": {"dtype": "string", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}, "opinions": {"feature": {"oid": {"dtype": "string", "id": null, "_type": "Value"}, "opinion_holder_target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "opinion_target_target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "opinion_expression_polarity": {"num_classes": 4, "names": ["StrongNegative", "Negative", "Positive", "StrongPositive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "opinion_expression_target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "multi_booked", "config_name": "eu", "version": "0.0.0", "splits": {"train": {"name": "train", "num_bytes": 1175816, "num_examples": 343, "dataset_name": "multi_booked"}}, "download_checksums": {"https://github.com/jerbarnes/multibooked/archive/master.zip": {"num_bytes": 4429415, "checksum": "c9512b7fe0e5afc690aaf0205d61bc37e68836e008db05f17643a0de57007c80"}}, "download_size": 4429415, "post_processing_size": null, "dataset_size": 1175816, "size_in_bytes": 5605231}}
|
dummy/ca/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0616a84fa84c1a1b704419fe90d649531f2bef757afeaeff79aad623cb21465b
|
3 |
+
size 6433
|
dummy/eu/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f29994756cbe56b8af73604715bea4ed884ba46b6ec26ce0a49b5cbe5aaccd1d
|
3 |
+
size 2496
|
multi_booked.py
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""MultiBooked dataset."""
|
16 |
+
|
17 |
+
import os
|
18 |
+
import xml.etree.ElementTree as ET
|
19 |
+
from collections import defaultdict
|
20 |
+
from pathlib import Path
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
_CITATION = """\
|
26 |
+
@inproceedings{Barnes2018multibooked,
|
27 |
+
author={Barnes, Jeremy and Lambert, Patrik and Badia, Toni},
|
28 |
+
title={MultiBooked: A corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification},
|
29 |
+
booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC'18)},
|
30 |
+
year = {2018},
|
31 |
+
month = {May},
|
32 |
+
date = {7-12},
|
33 |
+
address = {Miyazaki, Japan},
|
34 |
+
publisher = {European Language Resources Association (ELRA)},
|
35 |
+
language = {english}
|
36 |
+
}
|
37 |
+
"""
|
38 |
+
|
39 |
+
_DESCRIPTION = """\
|
40 |
+
MultiBooked is a corpus of Basque and Catalan Hotel Reviews Annotated for Aspect-level Sentiment Classification.
|
41 |
+
|
42 |
+
The corpora are compiled from hotel reviews taken mainly from booking.com. The corpora are in Kaf/Naf format, which is
|
43 |
+
an xml-style stand-off format that allows for multiple layers of annotation. Each review was sentence- and
|
44 |
+
word-tokenized and lemmatized using Freeling for Catalan and ixa-pipes for Basque. Finally, for each language two
|
45 |
+
annotators annotated opinion holders, opinion targets, and opinion expressions for each review, following the
|
46 |
+
guidelines set out in the OpeNER project.
|
47 |
+
"""
|
48 |
+
|
49 |
+
_HOMEPAGE = "http://hdl.handle.net/10230/33928"
|
50 |
+
|
51 |
+
_LICENSE = "CC-BY 3.0"
|
52 |
+
|
53 |
+
_URL = "https://github.com/jerbarnes/multibooked/archive/master.zip"
|
54 |
+
|
55 |
+
|
56 |
+
class MultiBooked(datasets.GeneratorBasedBuilder):
|
57 |
+
"""MultiBooked dataset."""
|
58 |
+
|
59 |
+
VERSION = datasets.Version("0.0.0")
|
60 |
+
|
61 |
+
BUILDER_CONFIGS = [
|
62 |
+
datasets.BuilderConfig(name="ca", description="MultiBooked dataset in Catalan language."),
|
63 |
+
datasets.BuilderConfig(name="eu", description="MultiBooked dataset in Basque language."),
|
64 |
+
]
|
65 |
+
|
66 |
+
def _info(self):
|
67 |
+
return datasets.DatasetInfo(
|
68 |
+
description=_DESCRIPTION,
|
69 |
+
features=datasets.Features(
|
70 |
+
{
|
71 |
+
"text": datasets.features.Sequence(
|
72 |
+
{
|
73 |
+
"wid": datasets.Value("string"),
|
74 |
+
"sent": datasets.Value("string"),
|
75 |
+
"para": datasets.Value("string"),
|
76 |
+
"word": datasets.Value("string"),
|
77 |
+
}
|
78 |
+
),
|
79 |
+
"terms": datasets.features.Sequence(
|
80 |
+
{
|
81 |
+
"tid": datasets.Value("string"),
|
82 |
+
"lemma": datasets.Value("string"),
|
83 |
+
"morphofeat": datasets.Value("string"),
|
84 |
+
"pos": datasets.Value("string"),
|
85 |
+
"target": datasets.features.Sequence(datasets.Value("string")),
|
86 |
+
}
|
87 |
+
),
|
88 |
+
"opinions": datasets.features.Sequence(
|
89 |
+
{
|
90 |
+
"oid": datasets.Value("string"),
|
91 |
+
"opinion_holder_target": datasets.features.Sequence(datasets.Value("string")),
|
92 |
+
"opinion_target_target": datasets.features.Sequence(datasets.Value("string")),
|
93 |
+
"opinion_expression_polarity": datasets.features.ClassLabel(
|
94 |
+
names=["StrongNegative", "Negative", "Positive", "StrongPositive"]
|
95 |
+
),
|
96 |
+
"opinion_expression_target": datasets.features.Sequence(datasets.Value("string")),
|
97 |
+
}
|
98 |
+
),
|
99 |
+
}
|
100 |
+
),
|
101 |
+
supervised_keys=None,
|
102 |
+
homepage=_HOMEPAGE,
|
103 |
+
license=_LICENSE,
|
104 |
+
citation=_CITATION,
|
105 |
+
)
|
106 |
+
|
107 |
+
def _split_generators(self, dl_manager):
|
108 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
109 |
+
return [
|
110 |
+
datasets.SplitGenerator(
|
111 |
+
name=datasets.Split.TRAIN,
|
112 |
+
gen_kwargs={
|
113 |
+
"dirpath": os.path.join(data_dir, "multibooked-master", "corpora", self.config.name),
|
114 |
+
},
|
115 |
+
),
|
116 |
+
]
|
117 |
+
|
118 |
+
def _generate_examples(self, dirpath):
|
119 |
+
for id_, filepath in enumerate(sorted(Path(dirpath).iterdir())):
|
120 |
+
example = defaultdict(lambda: defaultdict(list))
|
121 |
+
with open(filepath, encoding="utf-8") as f:
|
122 |
+
for _, elem in ET.iterparse(f):
|
123 |
+
if elem.tag == "text":
|
124 |
+
for child in elem:
|
125 |
+
# sometimes wid is missing in the eu configuration
|
126 |
+
example["text"]["wid"].append(child.attrib.get("wid", ""))
|
127 |
+
example["text"]["sent"].append(child.attrib["sent"])
|
128 |
+
example["text"]["para"].append(child.attrib["para"])
|
129 |
+
example["text"]["word"].append(child.text)
|
130 |
+
elif elem.tag == "terms":
|
131 |
+
for child in elem:
|
132 |
+
# sometimes tid is missing in the eu configuration
|
133 |
+
example["terms"]["tid"].append(child.attrib.get("tid", ""))
|
134 |
+
example["terms"]["lemma"].append(child.attrib["lemma"])
|
135 |
+
example["terms"]["morphofeat"].append(child.attrib["morphofeat"])
|
136 |
+
example["terms"]["pos"].append(child.attrib["pos"])
|
137 |
+
targets = []
|
138 |
+
for target in child.findall("span/target"):
|
139 |
+
targets.append(target.attrib["id"])
|
140 |
+
example["terms"]["target"].append(targets)
|
141 |
+
elif elem.tag == "opinions":
|
142 |
+
for child in elem:
|
143 |
+
example["opinions"]["oid"].append(child.attrib["oid"])
|
144 |
+
# Opinion holder
|
145 |
+
opinion_holder = child.find("opinion_holder")
|
146 |
+
targets = []
|
147 |
+
for target in opinion_holder.findall("span/target"):
|
148 |
+
targets.append(target.attrib["id"])
|
149 |
+
example["opinions"]["opinion_holder_target"].append(targets)
|
150 |
+
# Opinion target
|
151 |
+
opinion_target = child.find("opinion_target")
|
152 |
+
targets = []
|
153 |
+
for target in opinion_target.findall("span/target"):
|
154 |
+
targets.append(target.attrib["id"])
|
155 |
+
example["opinions"]["opinion_target_target"].append(targets)
|
156 |
+
# Opinion expression
|
157 |
+
opinion_expression = child.find("opinion_expression")
|
158 |
+
example["opinions"]["opinion_expression_polarity"].append(
|
159 |
+
opinion_expression.attrib["polarity"]
|
160 |
+
)
|
161 |
+
targets = []
|
162 |
+
for target in opinion_expression.findall("span/target"):
|
163 |
+
targets.append(target.attrib["id"])
|
164 |
+
example["opinions"]["opinion_expression_target"].append(targets)
|
165 |
+
yield id_, example
|