Datasets:
Tasks:
Text Classification
Sub-tasks:
sentiment-classification
Languages:
English
Size:
1K - 10K
License:
Upload 2 files
Browse files
README.md
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
license:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 1K<n<10K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- text-classification
|
18 |
+
task_ids:
|
19 |
+
- sentiment-classification
|
20 |
+
pretty_name: Extended Paraphrase Typology Corpus
|
21 |
+
---
|
22 |
+
# Dataset Card for [Dataset Name]
|
23 |
+
## Table of Contents
|
24 |
+
- [Dataset Card for [Dataset Name]](#dataset-card-for-dataset-name)
|
25 |
+
- [Table of Contents](#table-of-contents)
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Fields](#data-fields)
|
32 |
+
- [Data Splits](#data-splits)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
|
37 |
+
- [Who are the source language producers?](#who-are-the-source-language-producers)
|
38 |
+
- [Annotations](#annotations)
|
39 |
+
- [Annotation process](#annotation-process)
|
40 |
+
- [Who are the annotators?](#who-are-the-annotators)
|
41 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
42 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
43 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
44 |
+
- [Discussion of Biases](#discussion-of-biases)
|
45 |
+
- [Other Known Limitations](#other-known-limitations)
|
46 |
+
- [Additional Information](#additional-information)
|
47 |
+
- [Dataset Curators](#dataset-curators)
|
48 |
+
- [Licensing Information](#licensing-information)
|
49 |
+
- [Citation Information](#citation-information)
|
50 |
+
- [Contributions](#contributions)
|
51 |
+
## Dataset Description
|
52 |
+
- **Homepage:** https://github.com/venelink/ETPC/
|
53 |
+
- **Repository:**
|
54 |
+
- **Paper:** [ETPC - A Paraphrase Identification Corpus Annotated with Extended Paraphrase Typology and Negation](http://www.lrec-conf.org/proceedings/lrec2018/pdf/661.pdf)
|
55 |
+
- **Leaderboard:**
|
56 |
+
- **Point of Contact:**
|
57 |
+
### Dataset Summary
|
58 |
+
We present the Extended Paraphrase Typology (EPT) and the Extended Typology Paraphrase Corpus (ETPC). The EPT typology addresses several practical limitations of existing paraphrase typologies: it is the first typology that copes with the non-paraphrase pairs in the paraphrase identification corpora and distinguishes between contextual and habitual paraphrase types. ETPC is the largest corpus to date annotated with atomic paraphrase types. It is the first corpus with detailed annotation of both the paraphrase and the non-paraphrase pairs and the first corpus annotated with paraphrase and negation. Both new resources contribute to better understanding the paraphrase phenomenon, and allow for studying the relationship between paraphrasing and negation. To the developers of Paraphrase Identification systems ETPC corpus offers better means for evaluation and error analysis. Furthermore, the EPT typology and ETPC corpus emphasize the relationship with other areas of NLP such as Semantic Similarity, Textual Entailment, Summarization and Simplification.
|
59 |
+
### Supported Tasks and Leaderboards
|
60 |
+
- `text-classification`
|
61 |
+
### Languages
|
62 |
+
The text in the dataset is in English (`en`).
|
63 |
+
## Dataset Structure
|
64 |
+
### Data Fields
|
65 |
+
- `idx`: Monotonically increasing index ID.
|
66 |
+
- `sentence1`: Complete sentence expressing an opinion about a film.
|
67 |
+
- `sentence2`: Complete sentence expressing an opinion about a film.
|
68 |
+
- `etpc_label`: Whether the text-pair is a paraphrase, either "yes" (1) or "no" (0) according to etpc annotation schema.
|
69 |
+
- `mrpc_label`: Whether the text-pair is a paraphrase, either "yes" (1) or "no" (0) according to mrpc annotation schema.
|
70 |
+
- `negation`: Whether on sentence is a negation of another, either "yes" (1) or "no" (0).
|
71 |
+
### Data Splits
|
72 |
+
train: 5801
|
73 |
+
|
74 |
+
## Dataset Creation
|
75 |
+
### Curation Rationale
|
76 |
+
[More Information Needed]
|
77 |
+
### Source Data
|
78 |
+
#### Initial Data Collection and Normalization
|
79 |
+
[More Information Needed]
|
80 |
+
#### Who are the source language producers?
|
81 |
+
Rotten Tomatoes reviewers.
|
82 |
+
### Annotations
|
83 |
+
#### Annotation process
|
84 |
+
[More Information Needed]
|
85 |
+
#### Who are the annotators?
|
86 |
+
[More Information Needed]
|
87 |
+
### Personal and Sensitive Information
|
88 |
+
[More Information Needed]
|
89 |
+
## Considerations for Using the Data
|
90 |
+
### Social Impact of Dataset
|
91 |
+
[More Information Needed]
|
92 |
+
### Discussion of Biases
|
93 |
+
[More Information Needed]
|
94 |
+
### Other Known Limitations
|
95 |
+
[More Information Needed]
|
96 |
+
## Additional Information
|
97 |
+
### Dataset Curators
|
98 |
+
[More Information Needed]
|
99 |
+
### Licensing Information
|
100 |
+
Unknown.
|
101 |
+
### Citation Information
|
102 |
+
```bibtex
|
103 |
+
@inproceedings{kovatchev-etal-2018-etpc,
|
104 |
+
title = "{ETPC} - A Paraphrase Identification Corpus Annotated with Extended Paraphrase Typology and Negation",
|
105 |
+
author = "Kovatchev, Venelin and
|
106 |
+
Mart{\'\i}, M. Ant{\`o}nia and
|
107 |
+
Salam{\'o}, Maria",
|
108 |
+
booktitle = "Proceedings of the Eleventh International Conference on Language Resources and Evaluation ({LREC} 2018)",
|
109 |
+
month = may,
|
110 |
+
year = "2018",
|
111 |
+
address = "Miyazaki, Japan",
|
112 |
+
publisher = "European Language Resources Association (ELRA)",
|
113 |
+
url = "https://aclanthology.org/L18-1221",
|
114 |
+
}
|
115 |
+
```
|
116 |
+
### Contributions
|
117 |
+
Thanks to [@jpwahle](https://github.com/jpwahle) for adding this dataset.
|
etpc.py
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
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 |
+
|
15 |
+
# Lint as: python3
|
16 |
+
"""ETPC: The Extended Typology Paraphrase Corpus"""
|
17 |
+
|
18 |
+
import os
|
19 |
+
from typing import Dict, Generator, Any, Union, Optional, List, Tuple
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
from datasets.tasks import TextClassification
|
23 |
+
from lxml import etree
|
24 |
+
|
25 |
+
|
26 |
+
logger = datasets.logging.get_logger(__name__)
|
27 |
+
|
28 |
+
|
29 |
+
_CITATION = """\
|
30 |
+
@inproceedings{kovatchev-etal-2018-etpc,
|
31 |
+
title = "{ETPC} - A Paraphrase Identification Corpus Annotated with Extended Paraphrase Typology and Negation",
|
32 |
+
author = "Kovatchev, Venelin and
|
33 |
+
Mart{\'\i}, M. Ant{\`o}nia and
|
34 |
+
Salam{\'o}, Maria",
|
35 |
+
booktitle = "Proceedings of the Eleventh International Conference on Language Resources and Evaluation ({LREC} 2018)",
|
36 |
+
month = may,
|
37 |
+
year = "2018",
|
38 |
+
address = "Miyazaki, Japan",
|
39 |
+
publisher = "European Language Resources Association (ELRA)",
|
40 |
+
url = "https://aclanthology.org/L18-1221",
|
41 |
+
}
|
42 |
+
"""
|
43 |
+
|
44 |
+
_DESCRIPTION = """\
|
45 |
+
The EPT typology addresses several practical limitations of existing paraphrase typologies: it is the first typology that copes with the non-paraphrase pairs in the paraphrase identification corpora and distinguishes between contextual and habitual paraphrase types. ETPC is the largest corpus to date annotated with atomic paraphrase types.
|
46 |
+
"""
|
47 |
+
|
48 |
+
_HOMEPAGE = "https://github.com/venelink/ETPC"
|
49 |
+
|
50 |
+
_LICENSE = "Unknown"
|
51 |
+
|
52 |
+
_URLS = [
|
53 |
+
"https://raw.githubusercontent.com/venelink/ETPC/master/Corpus/text_pairs.xml",
|
54 |
+
"https://raw.githubusercontent.com/venelink/ETPC/master/Corpus/textual_paraphrases.xml",
|
55 |
+
]
|
56 |
+
|
57 |
+
|
58 |
+
class Sst2(datasets.GeneratorBasedBuilder):
|
59 |
+
"""SST-2 dataset."""
|
60 |
+
|
61 |
+
VERSION = datasets.Version("2.0.0")
|
62 |
+
|
63 |
+
def _info(self):
|
64 |
+
features = datasets.Features(
|
65 |
+
{
|
66 |
+
"idx": datasets.Value("int32"),
|
67 |
+
"sentence1": datasets.Value("string"),
|
68 |
+
"sentence2": datasets.Value("string"),
|
69 |
+
"etpc_label": datasets.Value("int8"),
|
70 |
+
"mrpc_label": datasets.Value("int8"),
|
71 |
+
"negation": datasets.Value("int8"),
|
72 |
+
"paraphrase_types": datasets.Value("string"),
|
73 |
+
}
|
74 |
+
)
|
75 |
+
|
76 |
+
return datasets.DatasetInfo(
|
77 |
+
description=_DESCRIPTION,
|
78 |
+
features=features,
|
79 |
+
homepage=_HOMEPAGE,
|
80 |
+
license=_LICENSE,
|
81 |
+
citation=_CITATION,
|
82 |
+
)
|
83 |
+
|
84 |
+
def _split_generators(self, dl_manager):
|
85 |
+
dl_dir = dl_manager.download_and_extract(_URLS)
|
86 |
+
return [
|
87 |
+
datasets.SplitGenerator(
|
88 |
+
name=datasets.Split.TRAIN,
|
89 |
+
gen_kwargs={
|
90 |
+
"file_paths": dl_manager.iter_files(dl_dir),
|
91 |
+
},
|
92 |
+
),
|
93 |
+
]
|
94 |
+
|
95 |
+
def _generate_examples(self, file_paths):
|
96 |
+
|
97 |
+
file_paths = list(file_paths)
|
98 |
+
text_pairs_path = file_paths[0]
|
99 |
+
paraphrase_types_path = file_paths[1]
|
100 |
+
|
101 |
+
parser = etree.XMLParser(encoding="utf-8", recover=True)
|
102 |
+
|
103 |
+
tree_text_pairs = etree.parse(text_pairs_path, parser=parser)
|
104 |
+
tree_paraphrase_types = etree.parse(paraphrase_types_path, parser=parser)
|
105 |
+
|
106 |
+
root_text_pairs = tree_text_pairs.getroot()
|
107 |
+
root_paraphrase_types = tree_paraphrase_types.getroot()
|
108 |
+
|
109 |
+
for idx, row in enumerate(root_text_pairs):
|
110 |
+
children = row.getchildren()
|
111 |
+
current_pair_id = row.find(".//pair_id").text
|
112 |
+
paraphrase_types = root_paraphrase_types.xpath(
|
113 |
+
f".//pair_id[text()='{current_pair_id}']/parent::relation/type_name/text()"
|
114 |
+
)
|
115 |
+
str_paraphrase_types = ",".join(paraphrase_types)
|
116 |
+
yield idx, {
|
117 |
+
"idx": int(row.find(".//pair_id").text)
|
118 |
+
if row.find(".//pair_id") is not None
|
119 |
+
else int(idx),
|
120 |
+
"sentence1": row.find(".//sent1_raw").text,
|
121 |
+
"sentence2": row.find(".//sent2_raw").text,
|
122 |
+
"etpc_label": int(row.find(".//etpc_label").text),
|
123 |
+
"mrpc_label": int(row.find(".//mrpc_label").text),
|
124 |
+
"negation": int(row.find(".//negation").text),
|
125 |
+
"paraphrase_types": str_paraphrase_types,
|
126 |
+
}
|