andreaschandra commited on
Commit
abd0271
1 Parent(s): ebb85ce
Files changed (3) hide show
  1. README.md +151 -0
  2. dataset_infos.json +1 -0
  3. semeval-absa.py +143 -0
README.md ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - found
4
+ language:
5
+ - en
6
+ language_creators:
7
+ - found
8
+ license:
9
+ - cc-by-4.0
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: 'SemEval 2015: Aspect-based Sentiement Analysis'
13
+ size_categories:
14
+ - 1K<n<10K
15
+ source_datasets:
16
+ - original
17
+ tags:
18
+ - aspect-based-sentiment-analysis
19
+ - semeval
20
+ - semeval2015
21
+ task_categories:
22
+ - text-classification
23
+ task_ids:
24
+ - sentiment-classification
25
+ ---
26
+
27
+ # Dataset Card for SemEval Task 5: Aspect-based Sentiment Analysis
28
+
29
+ ## Table of Contents
30
+ - [Table of Contents](#table-of-contents)
31
+ - [Dataset Description](#dataset-description)
32
+ - [Dataset Summary](#dataset-summary)
33
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
34
+ - [Languages](#languages)
35
+ - [Dataset Structure](#dataset-structure)
36
+ - [Data Instances](#data-instances)
37
+ - [Data Fields](#data-fields)
38
+ - [Data Splits](#data-splits)
39
+ - [Dataset Creation](#dataset-creation)
40
+ - [Curation Rationale](#curation-rationale)
41
+ - [Source Data](#source-data)
42
+ - [Annotations](#annotations)
43
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
44
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
45
+ - [Social Impact of Dataset](#social-impact-of-dataset)
46
+ - [Discussion of Biases](#discussion-of-biases)
47
+ - [Other Known Limitations](#other-known-limitations)
48
+ - [Additional Information](#additional-information)
49
+ - [Dataset Curators](#dataset-curators)
50
+ - [Licensing Information](#licensing-information)
51
+ - [Citation Information](#citation-information)
52
+ - [Contributions](#contributions)
53
+
54
+ ## Dataset Description
55
+
56
+ - **Homepage:**
57
+ - **Repository:**
58
+ - **Paper:**
59
+ - **Leaderboard:**
60
+ - **Point of Contact:**
61
+
62
+ ### Dataset Summary
63
+
64
+ This dataset is orignally from [SemEval-2015 Task 12](https://alt.qcri.org/semeval2015/task12/).
65
+ From the page:
66
+ > SE-ABSA15 will focus on the same domains as SE-ABSA14 (restaurants and laptops). However, unlike SE-ABSA14, the input datasets of SE-ABSA15 will contain entire reviews, not isolated (potentially out of context) sentences. SE-ABSA15 consolidates the four subtasks of SE-ABSA14 within a unified framework. In addition, SE-ABSA15 will include an out-of-domain ABSA subtask, involving test data from a domain unknown to the participants, other than the domains that will be considered during training. In particular, SE-ABSA15 consists of the following two subtasks.
67
+
68
+
69
+ ### Supported Tasks and Leaderboards
70
+
71
+ [More Information Needed]
72
+
73
+ ### Languages
74
+
75
+ [More Information Needed]
76
+
77
+ ## Dataset Structure
78
+
79
+ ### Data Instances
80
+
81
+ [More Information Needed]
82
+
83
+ ### Data Fields
84
+
85
+ [More Information Needed]
86
+
87
+ ### Data Splits
88
+
89
+ [More Information Needed]
90
+
91
+ ## Dataset Creation
92
+
93
+ ### Curation Rationale
94
+
95
+ [More Information Needed]
96
+
97
+ ### Source Data
98
+
99
+ #### Initial Data Collection and Normalization
100
+
101
+ [More Information Needed]
102
+
103
+ #### Who are the source language producers?
104
+
105
+ [More Information Needed]
106
+
107
+ ### Annotations
108
+
109
+ #### Annotation process
110
+
111
+ [More Information Needed]
112
+
113
+ #### Who are the annotators?
114
+
115
+ [More Information Needed]
116
+
117
+ ### Personal and Sensitive Information
118
+
119
+ [More Information Needed]
120
+
121
+ ## Considerations for Using the Data
122
+
123
+ ### Social Impact of Dataset
124
+
125
+ [More Information Needed]
126
+
127
+ ### Discussion of Biases
128
+
129
+ [More Information Needed]
130
+
131
+ ### Other Known Limitations
132
+
133
+ [More Information Needed]
134
+
135
+ ## Additional Information
136
+
137
+ ### Dataset Curators
138
+
139
+ [More Information Needed]
140
+
141
+ ### Licensing Information
142
+
143
+ [More Information Needed]
144
+
145
+ ### Citation Information
146
+
147
+ [More Information Needed]
148
+
149
+ ### Contributions
150
+
151
+ Thanks to [@github-username](https://github.com/<github-username>) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"laptop": {"description": "This dataset is built as a playground for aspect-based sentiment analysis.\n", "citation": "", "homepage": "https://alt.qcri.org/semeval2015/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "aspects": {"feature": {"term": {"dtype": "string", "id": null, "_type": "Value"}, "polarity": {"dtype": "string", "id": null, "_type": "Value"}, "from": {"dtype": "int16", "id": null, "_type": "Value"}, "to": {"dtype": "int16", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "absa", "config_name": "laptop", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 410525, "num_examples": 3048, "dataset_name": "absa"}, "validation": {"name": "validation", "num_bytes": 101593, "num_examples": 800, "dataset_name": "absa"}}, "download_checksums": {"https://drive.google.com/uc?id=1Zvh4bZOZgSkIHrrA5WVvyPQO6-wWk4xQ": {"num_bytes": 568072, "checksum": "061e7902171bc3e08bd1bdc79c5766423c36cf29c29b4c9df5a53de800d5e9af"}, "https://drive.google.com/uc?id=14NgRdqcEHFfki0z49iMR8wqOEBnqdLH9": {"num_bytes": 142849, "checksum": "98c0459acb7daa1546916ea3fa5e795ceb3eacae0c5747206a559f0e8d46a7cd"}}, "download_size": 710921, "post_processing_size": null, "dataset_size": 512118, "size_in_bytes": 1223039}, "restaurant": {"description": "This dataset is built as a playground for aspect-based sentiment analysis.\n", "citation": "", "homepage": "https://alt.qcri.org/semeval2015/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "aspects": {"feature": {"term": {"dtype": "string", "id": null, "_type": "Value"}, "polarity": {"dtype": "string", "id": null, "_type": "Value"}, "from": {"dtype": "int16", "id": null, "_type": "Value"}, "to": {"dtype": "int16", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "category": {"feature": {"category": {"dtype": "string", "id": null, "_type": "Value"}, "polarity": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "absa", "config_name": "restaurant", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 545642, "num_examples": 3044, "dataset_name": "absa"}, "validation": {"name": "validation", "num_bytes": 160312, "num_examples": 800, "dataset_name": "absa"}}, "download_checksums": {"https://drive.google.com/uc?id=1fx1fWemdTYjonYSVfX-vcgU3KQa7C85V": {"num_bytes": 831483, "checksum": "6ff945386c4d0cab23728fe316298c7c534a7cc713b5f9a40349722d0fa7e0f2"}, "https://drive.google.com/uc?id=1fHD0USeUgiLrnTo6zvRajk8whvsTVdAX": {"num_bytes": 239963, "checksum": "2600b4af013590b4c613e1cbae12071fcb097860f5e3253d0cab2a9f886648cd"}}, "download_size": 1071446, "post_processing_size": null, "dataset_size": 705954, "size_in_bytes": 1777400}}
semeval-absa.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # TODO: Address all TODOs and remove all explanatory comments
15
+ """SemEval 2015: Aspect-based Sentiment Analysis"""
16
+
17
+
18
+ import csv
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+ _DESCRIPTION = """\
25
+ This dataset is built as a playground for aspect-based sentiment analysis.
26
+ """
27
+
28
+ _HOMEPAGE = "https://alt.qcri.org/semeval2015/"
29
+
30
+ # TODO: Add link to the official dataset URLs here
31
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
32
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
33
+ _TRAIN_LAPTOP_URL = "https://drive.google.com/uc?id=1Zvh4bZOZgSkIHrrA5WVvyPQO6-wWk4xQ"
34
+ _VAL_LAPTOP_URL = "https://drive.google.com/uc?id=14NgRdqcEHFfki0z49iMR8wqOEBnqdLH9"
35
+ _TRAIN_RESTAURANT_URL = "https://drive.google.com/uc?id=1fx1fWemdTYjonYSVfX-vcgU3KQa7C85V"
36
+ _VAL_RESTAURANT_URL = "https://drive.google.com/uc?id=1fHD0USeUgiLrnTo6zvRajk8whvsTVdAX"
37
+
38
+ DOMAINS = ['laptop', 'restaurant']
39
+
40
+ class ABSAConfig(datasets.BuilderConfig):
41
+ """SemEval 2015 - ABSA Configs"""
42
+
43
+ def __init__(self, domain: str, **kwargs):
44
+ if domain not in DOMAINS:
45
+ raise ValueError(f"Invalild domain: {domain}. Available domains: {DOMAINS}",)
46
+
47
+ name = domain
48
+ super(ABSAConfig, self).__init__(name=name, description=_DESCRIPTION, **kwargs)
49
+
50
+ self.domain = domain
51
+
52
+ self.url_train = _TRAIN_LAPTOP_URL if domain == 'laptop' else _TRAIN_RESTAURANT_URL
53
+ self.url_val = _VAL_LAPTOP_URL if domain == 'laptop' else _VAL_RESTAURANT_URL
54
+
55
+
56
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
57
+ class ABSA(datasets.GeneratorBasedBuilder):
58
+ """SemEval 2015: Aspect-based Sentiment Analysis."""
59
+
60
+ _VERSION = datasets.Version("1.0.0")
61
+
62
+ BUILDER_CONFIGS = [
63
+ ABSAConfig(
64
+ domain='laptop',
65
+ version=_VERSION
66
+ ),
67
+ ABSAConfig(
68
+ domain='restaurant',
69
+ version=_VERSION
70
+ )
71
+ ]
72
+
73
+ def _info(self):
74
+ if self.config.domain == 'restaurant':
75
+ features = datasets.Features(
76
+ {
77
+ "id": datasets.Value("string"),
78
+ "text": datasets.Value("string"),
79
+ "aspects": datasets.Sequence({
80
+ 'term': datasets.Value("string"),
81
+ 'polarity': datasets.Value("string"),
82
+ 'from': datasets.Value("int16"),
83
+ 'to': datasets.Value("int16"),
84
+ }),
85
+ "category": datasets.Sequence({
86
+ 'category': datasets.Value("string"),
87
+ 'polarity': datasets.Value("string")
88
+ })
89
+ }
90
+ )
91
+ else:
92
+ features = datasets.Features(
93
+ {
94
+ "id": datasets.Value("string"),
95
+ "text": datasets.Value("string"),
96
+ "aspects": datasets.Sequence({
97
+ 'term': datasets.Value("string"),
98
+ 'polarity': datasets.Value("string"),
99
+ 'from': datasets.Value("int16"),
100
+ 'to': datasets.Value("int16"),
101
+ })
102
+ }
103
+ )
104
+ # features = datasets.Features(
105
+ # {
106
+ # "id": datasets.Value("int16"),
107
+ # "text": datasets.Value("string"),
108
+ # "aspects": datasets.Sequence([{
109
+ # 'term': datasets.Value("string"),
110
+ # 'polarity': datasets.Value("string"),
111
+ # 'from': datasets.Value("int8"),
112
+ # 'to': datasets.Value("int8"),
113
+ # }]),
114
+ # "category": datasets.Sequence([{
115
+ # 'category': datasets.Value("string"),
116
+ # 'polarity': datasets.Value("string")
117
+ # }])
118
+ # }
119
+ # )
120
+
121
+
122
+ return datasets.DatasetInfo(
123
+ description=_DESCRIPTION,
124
+ features=features,
125
+ homepage=_HOMEPAGE
126
+ )
127
+
128
+ def _split_generators(self, dl_manager):
129
+
130
+ train_path = dl_manager.download(self.config.url_train)
131
+ val_path = dl_manager.download(self.config.url_val)
132
+ return [
133
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
134
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path})
135
+ ]
136
+
137
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
138
+ def _generate_examples(self, filepath):
139
+ """Generate examples."""
140
+ with open(filepath, 'r') as f:
141
+ contents = json.load(f)
142
+ for id_, row in enumerate(contents):
143
+ yield id_, row