Datasets:
Commit
•
be4dac5
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 +198 -0
- dataset_infos.json +1 -0
- dummy/subtask-1/0.0.0/dummy_data.zip +3 -0
- dummy/subtask-2/0.0.0/dummy_data.zip +3 -0
- humicroedit.py +171 -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,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
- expert-generated
|
5 |
+
language_creators:
|
6 |
+
- crowdsourced
|
7 |
+
languages:
|
8 |
+
- en
|
9 |
+
licenses:
|
10 |
+
- unknown
|
11 |
+
multilinguality:
|
12 |
+
- monolingual
|
13 |
+
size_categories:
|
14 |
+
- 10K<n<100K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
subtask-1:
|
19 |
+
- text-scoring
|
20 |
+
subtask-2:
|
21 |
+
- text-classification
|
22 |
+
task_ids:
|
23 |
+
subtask-1:
|
24 |
+
- text-scoring-other-funniness-score-prediction
|
25 |
+
subtask-2:
|
26 |
+
- text-classification-other-funnier-headline-identification
|
27 |
+
---
|
28 |
+
|
29 |
+
# Dataset Card for [Dataset Name]
|
30 |
+
|
31 |
+
## Table of Contents
|
32 |
+
- [Dataset Description](#dataset-description)
|
33 |
+
- [Dataset Summary](#dataset-summary)
|
34 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
35 |
+
- [Languages](#languages)
|
36 |
+
- [Dataset Structure](#dataset-structure)
|
37 |
+
- [Data Instances](#data-instances)
|
38 |
+
- [Data Fields](#data-instances)
|
39 |
+
- [Data Splits](#data-instances)
|
40 |
+
- [Dataset Creation](#dataset-creation)
|
41 |
+
- [Curation Rationale](#curation-rationale)
|
42 |
+
- [Source Data](#source-data)
|
43 |
+
- [Annotations](#annotations)
|
44 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
45 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
46 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
47 |
+
- [Discussion of Biases](#discussion-of-biases)
|
48 |
+
- [Other Known Limitations](#other-known-limitations)
|
49 |
+
- [Additional Information](#additional-information)
|
50 |
+
- [Dataset Curators](#dataset-curators)
|
51 |
+
- [Licensing Information](#licensing-information)
|
52 |
+
- [Citation Information](#citation-information)
|
53 |
+
|
54 |
+
## Dataset Description
|
55 |
+
|
56 |
+
- **Homepage:**[Humicroedit](https://www.cs.rochester.edu/u/nhossain/humicroedit.html)
|
57 |
+
- **Repository:**
|
58 |
+
- **Paper:**["President Vows to Cut Taxes Hair": Dataset and Analysis of Creative Text Editing for Humorous Headlines.](http://cs.rochester.edu/~nhossain/humicroedit-naacl-19.pdf)
|
59 |
+
- **Leaderboard:**
|
60 |
+
- **Point of Contact:**[nhossain@cs.rochester.edu]
|
61 |
+
|
62 |
+
### Dataset Summary
|
63 |
+
|
64 |
+
This is the task dataset for SemEval-2020 Task 7: Assessing Humor in Edited News Headlines.
|
65 |
+
|
66 |
+
### Supported Tasks and Leaderboards
|
67 |
+
|
68 |
+
[Task Description Page](https://competitions.codalab.org/competitions/20970)
|
69 |
+
|
70 |
+
- Regression Task: In this task, given the original and the edited headline, the participant is required to predict the mean funniness of the edited headline. Success on this task is typically measured by achieving a *low* Mean Square Error.
|
71 |
+
- Predict the funnier of the two edited headlines: Given the original headline and two edited versions, the participant has to predict which edited version is the funnier of the two. Success on this task is typically measured by achieving a *high* accuracy.
|
72 |
+
|
73 |
+
### Languages
|
74 |
+
|
75 |
+
English
|
76 |
+
|
77 |
+
## Dataset Structure
|
78 |
+
|
79 |
+
### Data Instances
|
80 |
+
For subtask-1, i.e Given the original and the edited headline, predict the mean funniness of the edited headline.
|
81 |
+
```
|
82 |
+
{
|
83 |
+
'id': 1183,
|
84 |
+
'original': 'Kushner to visit <Mexico/> following latest trump tirades.',
|
85 |
+
'edit': 'therapist',
|
86 |
+
'grades': '33332',
|
87 |
+
'meanGrade': 2.8
|
88 |
+
}
|
89 |
+
```
|
90 |
+
For subtask-2, i.e Given the original headline and two edited versions, predict which edited version is the funnier of the two.
|
91 |
+
```
|
92 |
+
{
|
93 |
+
'id': 1183,
|
94 |
+
'original1': 'Gene Cernan , Last <Astronaut/> on the Moon , Dies at 82',
|
95 |
+
'edit1': 'Dancer',
|
96 |
+
'grades1': '1113',
|
97 |
+
'meanGrade1': 1.2,
|
98 |
+
'original2': 'Gene Cernan , Last Astronaut on the Moon , <Dies/> at 82',
|
99 |
+
'edit2': 'impregnated',
|
100 |
+
'grades2': '30001',
|
101 |
+
'meanGrade2': 0.8,
|
102 |
+
'label': 1
|
103 |
+
}
|
104 |
+
```
|
105 |
+
|
106 |
+
### Data Fields
|
107 |
+
For subtask-1
|
108 |
+
- `id`: Unique identifier of an edited headline.
|
109 |
+
- `original`: The headline with replaced word(s) identified with the </> tag.
|
110 |
+
- `edit`: The new word which replaces the word marked in </> tag in the original field.
|
111 |
+
- `grades`: 'grades' are the concatenation of all the grades by different annotators.
|
112 |
+
- `mean` is the mean of all the judges scores.
|
113 |
+
|
114 |
+
|
115 |
+
For subtask-2
|
116 |
+
- `id`: Unique identifier of an edited headline.
|
117 |
+
- `original1`: The original headline with replaced word(s) identified with </> tag.
|
118 |
+
- `edit1`: The new word which replaces the word marked in </> tag in the `original1` field.
|
119 |
+
- `grades1`: The concatenation of all the grades annotated by different annotators for sentence1.
|
120 |
+
- `meanGrade1` is the mean of all the judges scores for sentence1.
|
121 |
+
- `original2`: The original headline with replaced word(s) identified with </> tag.
|
122 |
+
- `edit2`: The new word which replaces the word marked in </> tag in the `original1` field.
|
123 |
+
- `grades2`: The concatenation of all the grades annotated by different annotators for the sentence2.
|
124 |
+
- `meanGrade2` is the mean of all the judges scores for sentence2.
|
125 |
+
- `label` is 1 if sentence1 is more humourous than sentence2,
|
126 |
+
2 if sentence 2 is more humorous than sentence1,
|
127 |
+
0 if both the sentences are equally humorous
|
128 |
+
|
129 |
+
### Data Splits
|
130 |
+
| Sub Task | Train | Dev | Test | Funlines|
|
131 |
+
| ----- | ------ | ---- | ---- |-----|
|
132 |
+
| Subtask-1:Regression | 9652 | 2419 | 3024| 8248 |
|
133 |
+
| Subtask-2: Funnier headline prediction| 9381 | 2355 | 2960| 1958 |
|
134 |
+
|
135 |
+
## Dataset Creation
|
136 |
+
|
137 |
+
### Curation Rationale
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
### Source Data
|
142 |
+
|
143 |
+
#### Initial Data Collection and Normalization
|
144 |
+
|
145 |
+
Crowd-sourced the data by gamifying it as on the website funlines.co. Players rate the headlines on a scale of 0-4.
|
146 |
+
Players are scored based on their editing and rating, and they
|
147 |
+
are ranked on the game’s leaderboard page.
|
148 |
+
|
149 |
+
#### Who are the source language producers?
|
150 |
+
|
151 |
+
[More Information Needed]
|
152 |
+
|
153 |
+
### Annotations
|
154 |
+
|
155 |
+
#### Annotation process
|
156 |
+
|
157 |
+
[More Information Needed]
|
158 |
+
|
159 |
+
#### Who are the annotators?
|
160 |
+
|
161 |
+
[More Information Needed]
|
162 |
+
|
163 |
+
### Personal and Sensitive Information
|
164 |
+
|
165 |
+
[More Information Needed]
|
166 |
+
|
167 |
+
## Considerations for Using the Data
|
168 |
+
|
169 |
+
### Social Impact of Dataset
|
170 |
+
|
171 |
+
[More Information Needed]
|
172 |
+
|
173 |
+
### Discussion of Biases
|
174 |
+
|
175 |
+
[More Information Needed]
|
176 |
+
|
177 |
+
### Other Known Limitations
|
178 |
+
|
179 |
+
[More Information Needed]
|
180 |
+
|
181 |
+
## Additional Information
|
182 |
+
|
183 |
+
### Dataset Curators
|
184 |
+
|
185 |
+
[More Information Needed]
|
186 |
+
|
187 |
+
### Licensing Information
|
188 |
+
|
189 |
+
[More Information Needed]
|
190 |
+
|
191 |
+
### Citation Information
|
192 |
+
```
|
193 |
+
@article{hossain2019president,
|
194 |
+
title={" President Vows to Cut< Taxes> Hair": Dataset and Analysis of Creative Text Editing for Humorous Headlines},
|
195 |
+
author={Hossain, Nabil and Krumm, John and Gamon, Michael},
|
196 |
+
journal={arXiv preprint arXiv:1906.00274},
|
197 |
+
year={2019}
|
198 |
+
}```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"subtask-1": {"description": "This new dataset is designed to assess the funniness of edited news headlines.\n", "citation": "@article{hossain2019president,\n title={\" President Vows to Cut< Taxes> Hair\": Dataset and Analysis of Creative Text Editing for Humorous Headlines},\n author={Hossain, Nabil and Krumm, John and Gamon, Michael},\n journal={arXiv preprint arXiv:1906.00274},\n year={2019}\n}\n", "homepage": "https://www.cs.rochester.edu/u/nhossain/humicroedit.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "original": {"dtype": "string", "id": null, "_type": "Value"}, "edit": {"dtype": "string", "id": null, "_type": "Value"}, "grades": {"dtype": "string", "id": null, "_type": "Value"}, "meanGrade": {"dtype": "float32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "humicroedit", "config_name": "subtask-1", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1058589, "num_examples": 9652, "dataset_name": "humicroedit"}, "test": {"name": "test", "num_bytes": 332113, "num_examples": 3024, "dataset_name": "humicroedit"}, "validation": {"name": "validation", "num_bytes": 269083, "num_examples": 2419, "dataset_name": "humicroedit"}, "funlines": {"name": "funlines", "num_bytes": 942376, "num_examples": 8248, "dataset_name": "humicroedit"}}, "download_checksums": {"https://cs.rochester.edu/u/nhossain/semeval-2020-task-7-dataset.zip": {"num_bytes": 1621456, "checksum": "12a6cbf28c8b698ad80be42a65ac867b57e4c71662eedab607805e167ba791ab"}}, "download_size": 1621456, "post_processing_size": null, "dataset_size": 2602161, "size_in_bytes": 4223617}, "subtask-2": {"description": "This new dataset is designed to assess the funniness of edited news headlines.\n", "citation": "@article{hossain2019president,\n title={\" President Vows to Cut< Taxes> Hair\": Dataset and Analysis of Creative Text Editing for Humorous Headlines},\n author={Hossain, Nabil and Krumm, John and Gamon, Michael},\n journal={arXiv preprint arXiv:1906.00274},\n year={2019}\n}\n", "homepage": "https://www.cs.rochester.edu/u/nhossain/humicroedit.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "original1": {"dtype": "string", "id": null, "_type": "Value"}, "edit1": {"dtype": "string", "id": null, "_type": "Value"}, "grades1": {"dtype": "string", "id": null, "_type": "Value"}, "meanGrade1": {"dtype": "float32", "id": null, "_type": "Value"}, "original2": {"dtype": "string", "id": null, "_type": "Value"}, "edit2": {"dtype": "string", "id": null, "_type": "Value"}, "grades2": {"dtype": "string", "id": null, "_type": "Value"}, "meanGrade2": {"dtype": "float32", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["equal", "sentence1", "sentence2"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "humicroedit", "config_name": "subtask-2", "version": "0.0.0", "splits": {"train": {"name": "train", "num_bytes": 2102667, "num_examples": 9381, "dataset_name": "humicroedit"}, "test": {"name": "test", "num_bytes": 665087, "num_examples": 2960, "dataset_name": "humicroedit"}, "validation": {"name": "validation", "num_bytes": 535044, "num_examples": 2355, "dataset_name": "humicroedit"}, "funlines": {"name": "funlines", "num_bytes": 451416, "num_examples": 1958, "dataset_name": "humicroedit"}}, "download_checksums": {"https://cs.rochester.edu/u/nhossain/semeval-2020-task-7-dataset.zip": {"num_bytes": 1621456, "checksum": "12a6cbf28c8b698ad80be42a65ac867b57e4c71662eedab607805e167ba791ab"}}, "download_size": 1621456, "post_processing_size": null, "dataset_size": 3754214, "size_in_bytes": 5375670}}
|
dummy/subtask-1/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1485a5c24f0cc12e146bc632d83e4e31219caea5023cf590792ff886de1109b4
|
3 |
+
size 5867
|
dummy/subtask-2/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1485a5c24f0cc12e146bc632d83e4e31219caea5023cf590792ff886de1109b4
|
3 |
+
size 5867
|
humicroedit.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""This is humorous headline dataset called Humicroedit introduced in the Task-7 of SemEval 2020."""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import os
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
_CITATION = """\
|
26 |
+
@article{hossain2019president,
|
27 |
+
title={" President Vows to Cut< Taxes> Hair": Dataset and Analysis of Creative Text Editing for Humorous Headlines},
|
28 |
+
author={Hossain, Nabil and Krumm, John and Gamon, Michael},
|
29 |
+
journal={arXiv preprint arXiv:1906.00274},
|
30 |
+
year={2019}
|
31 |
+
}
|
32 |
+
"""
|
33 |
+
|
34 |
+
_DESCRIPTION = """\
|
35 |
+
This new dataset is designed to assess the funniness of edited news headlines.
|
36 |
+
"""
|
37 |
+
|
38 |
+
_HOMEPAGE = "https://www.cs.rochester.edu/u/nhossain/humicroedit.html"
|
39 |
+
_LICENSE = ""
|
40 |
+
|
41 |
+
_URL = "https://cs.rochester.edu/u/nhossain/semeval-2020-task-7-dataset.zip"
|
42 |
+
|
43 |
+
|
44 |
+
class Humicroedit(datasets.GeneratorBasedBuilder):
|
45 |
+
"""This is humorous headline dataset called Humicroedit introduced in the Task-7 of SemEval 2020."""
|
46 |
+
|
47 |
+
VERSION = datasets.Version("1.1.0")
|
48 |
+
|
49 |
+
# This is an example of a dataset with multiple configurations.
|
50 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
51 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
52 |
+
|
53 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
54 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
55 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
56 |
+
|
57 |
+
# You will be able to load one or the other configurations in the following list with
|
58 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
59 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
60 |
+
BUILDER_CONFIGS = [
|
61 |
+
datasets.BuilderConfig(name="subtask-1", description="This part of the dataset covers the data for subtask-1"),
|
62 |
+
datasets.BuilderConfig(name="subtask-2", description="This part of the dataset covers the data for subtask-2"),
|
63 |
+
]
|
64 |
+
|
65 |
+
def _info(self):
|
66 |
+
if self.config.name == "subtask-1":
|
67 |
+
features = datasets.Features(
|
68 |
+
{
|
69 |
+
"id": datasets.Value("string"),
|
70 |
+
"original": datasets.Value("string"),
|
71 |
+
"edit": datasets.Value("string"),
|
72 |
+
"grades": datasets.Value("string"),
|
73 |
+
"meanGrade": datasets.Value("float"),
|
74 |
+
# These are the features of your dataset like images, labels ...
|
75 |
+
}
|
76 |
+
)
|
77 |
+
else:
|
78 |
+
features = datasets.Features(
|
79 |
+
{
|
80 |
+
"id": datasets.Value("string"),
|
81 |
+
"original1": datasets.Value("string"),
|
82 |
+
"edit1": datasets.Value("string"),
|
83 |
+
"grades1": datasets.Value("string"),
|
84 |
+
"meanGrade1": datasets.Value("float"),
|
85 |
+
"original2": datasets.Value("string"),
|
86 |
+
"edit2": datasets.Value("string"),
|
87 |
+
"grades2": datasets.Value("string"),
|
88 |
+
"meanGrade2": datasets.Value("float"),
|
89 |
+
"label": datasets.ClassLabel(names=["equal", "sentence1", "sentence2"]),
|
90 |
+
}
|
91 |
+
)
|
92 |
+
return datasets.DatasetInfo(
|
93 |
+
description=_DESCRIPTION,
|
94 |
+
features=features,
|
95 |
+
supervised_keys=None,
|
96 |
+
homepage=_HOMEPAGE,
|
97 |
+
license=_LICENSE,
|
98 |
+
citation=_CITATION,
|
99 |
+
)
|
100 |
+
|
101 |
+
def _split_generators(self, dl_manager):
|
102 |
+
"""Returns SplitGenerators."""
|
103 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
104 |
+
ROOT = "semeval-2020-task-7-dataset"
|
105 |
+
|
106 |
+
return [
|
107 |
+
datasets.SplitGenerator(
|
108 |
+
name=datasets.Split.TRAIN,
|
109 |
+
# These kwargs will be passed to _generate_examples
|
110 |
+
gen_kwargs={
|
111 |
+
"filepath": os.path.join(data_dir, ROOT, self.config.name, "train.csv"),
|
112 |
+
"split": "train",
|
113 |
+
},
|
114 |
+
),
|
115 |
+
datasets.SplitGenerator(
|
116 |
+
name=datasets.Split.TEST,
|
117 |
+
# These kwargs will be passed to _generate_examples
|
118 |
+
gen_kwargs={"filepath": os.path.join(data_dir, ROOT, self.config.name, "test.csv"), "split": "test"},
|
119 |
+
),
|
120 |
+
datasets.SplitGenerator(
|
121 |
+
name=datasets.Split.VALIDATION,
|
122 |
+
# These kwargs will be passed to _generate_examples
|
123 |
+
gen_kwargs={
|
124 |
+
"filepath": os.path.join(data_dir, ROOT, self.config.name, "dev.csv"),
|
125 |
+
"split": "dev",
|
126 |
+
},
|
127 |
+
),
|
128 |
+
datasets.SplitGenerator(
|
129 |
+
name=datasets.Split("funlines"),
|
130 |
+
# These kwargs will be passed to _generate_examples
|
131 |
+
gen_kwargs={
|
132 |
+
"filepath": os.path.join(data_dir, ROOT, self.config.name, "train_funlines.csv"),
|
133 |
+
"split": "funlines",
|
134 |
+
},
|
135 |
+
),
|
136 |
+
]
|
137 |
+
|
138 |
+
def _generate_examples(self, filepath, split):
|
139 |
+
""" Yields examples. """
|
140 |
+
label_names = ["equal", "sentence1", "sentence2"]
|
141 |
+
|
142 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
143 |
+
csv_reader = csv.reader(
|
144 |
+
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
145 |
+
)
|
146 |
+
next(csv_reader)
|
147 |
+
|
148 |
+
for id_, row in enumerate(csv_reader):
|
149 |
+
if self.config.name == "subtask-1":
|
150 |
+
row_id, original, edit, grades, meanGrade = row
|
151 |
+
yield id_, {
|
152 |
+
"id": row_id,
|
153 |
+
"original": original,
|
154 |
+
"edit": edit,
|
155 |
+
"grades": grades,
|
156 |
+
"meanGrade": meanGrade,
|
157 |
+
}
|
158 |
+
else:
|
159 |
+
row_id, original1, edit1, grades1, meanGrade1, original2, edit2, grades2, meanGrade2, label = row
|
160 |
+
yield id_, {
|
161 |
+
"id": row_id,
|
162 |
+
"original1": original1,
|
163 |
+
"edit1": edit1,
|
164 |
+
"grades1": grades1,
|
165 |
+
"meanGrade1": meanGrade1,
|
166 |
+
"original2": original2,
|
167 |
+
"edit2": edit2,
|
168 |
+
"grades2": grades2,
|
169 |
+
"meanGrade2": meanGrade2,
|
170 |
+
"label": label_names[int(label)],
|
171 |
+
}
|