gsarti commited on
Commit
563fcc9
1 Parent(s): da8671c

Added card and loading scripts

Browse files
Files changed (2) hide show
  1. README.md +130 -0
  2. change_it.py +157 -0
README.md ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - it
8
+ licenses:
9
+ - cc-by-nc-sa-4.0
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: change-it
13
+ size_categories:
14
+ - unknown
15
+ source_datasets:
16
+ - original
17
+ task_categories:
18
+ - conditional-text-generation
19
+ task_ids:
20
+ - conditional-text-generation-other-style-transfer
21
+ - summarization
22
+ paperswithcode_id: glue
23
+ ---
24
+
25
+ # Dataset Card for CHANGE-IT
26
+
27
+ ## Table of Contents
28
+
29
+ - [Dataset Card for CHANGE-IT](#dataset-card-for-change-it)
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
+ - [Additional Information](#additional-information)
41
+ - [Dataset Curators](#dataset-curators)
42
+ - [Licensing Information](#licensing-information)
43
+ - [Citation Information](#citation-information)
44
+
45
+ ## Dataset Description
46
+
47
+ - **Homepage:** [https://live.european-language-grid.eu/catalogue/corpus/7373](https://live.european-language-grid.eu/catalogue/corpus/7373)
48
+ - **Repository:** [Github](https://github.com/michelecafagna26/CHANGE-IT)
49
+ - **Paper:** [CEUR-ws.org](http://ceur-ws.org/Vol-2765/paper169.pdf)
50
+ - **Video** [Vimeo](https://vimeo.com/484098874)
51
+ - **Point of Contact:** [Lorenzo De Mattei](lorenzo.demattei@gmail.com)
52
+ - **Size of downloaded dataset files:** 955.33 MB
53
+ - **Size of the generated dataset:** 229.68 MB
54
+ - **Total amount of disk used:** 1185.01 MB
55
+
56
+ ### Dataset Summary
57
+
58
+ The CHANGE-IT dataset contains approximately 152,000 article-headline pairs, collected from two Italian newspapers situated at opposite ends of the political spectrum, namely la Repubblica (left) and Il Giornale (right), with the two newspapers equally represented. The dataset has been used in the context
59
+ of the [CHANGE-IT task](https://sites.google.com/view/change-it) during the [Evalita 2020 evaluation campaign](http://www.evalita.it/2020). CHANGE-IT is a generation task for Italian – more specifically, a style transfer task for headlines of Italian newspapers. Given a (collection of) headlines from one newspaper, namely Il Giornale (G) or La Repubblica (R), it challenges automatic systems to change all G-headlines to headlines in style R, and all R-headlines to headlines in style G. Although the task only concerns headline change, the dataset comprehends both the headlines as well as their respective full articles.
60
+
61
+ ### Supported Tasks and Leaderboards
62
+
63
+
64
+
65
+ ### Languages
66
+
67
+ The language data in GLUE is in Italian (BCP-47 `it`)
68
+
69
+ ## Dataset Structure
70
+
71
+ ### Data Instances
72
+
73
+ A sample from the `test` split of the `ilgiornale` config is provided below. The other configuration, `ilgiornale`, has the same structure.
74
+
75
+ ```json
76
+ {
77
+ "id": 0,
78
+ "headline": "Ucraina, coalizione della Timoshenko denuncia irruzione nella sede",
79
+ "full_text": "Rimane alta la tensione in Ucraina , dove da giorni i manifestanti scendono in piazza per protestare contro la decisione del presidente Viktor Yanukovich, che ha deciso di congelare l'accordo di associazione con l'Unione Europea. Il momento è molto delicato. L'opposizione teme una repressione violenza della protesta, con le forze speciali che hanno costretto i manifestanti a Kiev ad allontanarsi dalla sede del governo, per ripiegare su piazza Indipendenza. Il leader d'opposizione Vitaly Klitschko ha invitato il presidente a non utilizzare la forza, se non vuole avere il sangue dei manifestanti sulle sue mani. Nel frattempo il presidente Yanukovich ha aperto alla possibilità di un dialogo, annunciando per domani un incontro con i suoi due predecessori, Leonid Kuchma e Viktor Yushchenko. Ieri un milioni di persone sono scese in piazza, scaduti i due giorni di ultimatum dati al governo per indire nuove elezioni, I manifestanti hanno rovesciato la grande statua di Lenin posta sul boulevard Shevchenko. Piazza Indipendenza (Maidan Nezalezhnosti) resta il punto più caldo della capitale. Qui sono state erette barricate davanti agli ingressi della metropolitana, nel tentativo di preparsi a un'azione della polizia, che al momento non ha però preso iniziative contro i dimostranti. In serata Batkivshcyna, la coalizione dell'ex premier Yulia Timoshenko , ha denunciato l'irruzione di almeno venti agenti della polizia antisommossa nel proprio quartier generale. Il portavoce della polizia, Olga Bilyk, ha smentito: \"Né la polizia di Kiev, né la Berkut - ha dichiarato - hanno condotto operazioni nella sede\".",
80
+ "alignment": "A2"
81
+ }
82
+ ```
83
+
84
+ The text is provided as-is, without further preprocessing or tokenization.
85
+
86
+ ### Data Fields
87
+
88
+ - `headline`: The original headline for the newspaper.
89
+ - `full_text`: The article full text associated to the respective headline.
90
+ - `alignment`: The alignment value used for the style transfer experiments. Values:
91
+ - `A1`: Top 5K pairs, highly aligned.
92
+ - `A2`: Test set, highly aligned.
93
+ - `A3`: 10K to 20K pairs, fairly aligned.
94
+ - `R`: Bottom ~50K pairs, weakly/not aligned.
95
+
96
+ ### Data Splits
97
+
98
+ | config| train| test|
99
+ |---------:|-------------------------------------:|-----------:|
100
+ |`ilgiornale`|5'000 (A1) + 10'000 (A3) + 48'701 (R) | 5'000 (A2) |
101
+ |`repubblica`|5'000 (A1) + 10'000 (A3) + 48'701 (R) | 5'000 (A2) |
102
+
103
+ ### Dataset Creation
104
+
105
+ Please refer to the original article [CHANGE-IT @ EVALITA 2020: Change Headlines, Adapt News, GEnerate](http://ceur-ws.org/Vol-2765/paper169.pdf) for additional information on dataset creation.
106
+
107
+ ## Additional Information
108
+
109
+ ### Dataset Curators
110
+
111
+ The organizers of the CHANGE-IT shared tasks are the curators of the original dataset. For problems or updates on the 🤗 Datasets version, please contact [gabriele.sarti996@gmail.com](mailto:gabriele.sarti996@gmail.com).
112
+
113
+ ### Licensing Information
114
+
115
+ Licensed with Creative Commons Attribution Non Commercial Share Alike 4.0. License available [here](https://creativecommons.org/licenses/by-nc-sa/4.0/).
116
+
117
+ ### Citation Information
118
+
119
+ Please cite the authors if you use these corpora in your work:
120
+
121
+ ```
122
+ @inproceedings{demattei-etal-2020-changeit,
123
+ author = {De Mattei, Lorenzo and Cafagna, Michele and Dell'Orletta, Felice and Nissim, Malvina and Gatt, Albert},
124
+ title = {{CHANGE-IT @ EVALITA 2020}: Change Headlines, Adapt News, GEnerate},
125
+ booktitle = {Proceedings of Seventh Evaluation Campaign of Natural Language Processing and Speech Tools for Italian. Final Workshop (EVALITA 2020)},
126
+ editor = {Basile, Valerio and Croce, Danilo and Di Maro, Maria, and Passaro, Lucia C.},
127
+ publisher = {CEUR.org},
128
+ year = {2020},
129
+ address = {Online}
130
+ }
change_it.py ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import os
3
+
4
+ import datasets
5
+
6
+
7
+ _CITATION = """\
8
+ @inproceedings{demattei-etal-2020-changeit,
9
+ author = {De Mattei, Lorenzo and Cafagna, Michele and Dell'Orletta, Felice and Nissim, Malvina and Gatt, Albert},
10
+ title = {{CHANGE-IT @ EVALITA 2020}: Change Headlines, Adapt News, GEnerate},
11
+ booktitle = {Proceedings of Seventh Evaluation Campaign of Natural Language Processing and Speech Tools for Italian. Final Workshop (EVALITA 2020)},
12
+ editor = {Basile, Valerio and Croce, Danilo and Di Maro, Maria, and Passaro, Lucia C.},
13
+ publisher = {CEUR.org},
14
+ year = {2020},
15
+ address = {Online}
16
+ }
17
+ """
18
+
19
+ _DESCRIPTION = """\
20
+ The CHANGE-IT dataset contains approximately 152,000 article-headline pairs, collected from two Italian
21
+ newspapers situated at opposite ends of the political spectrum, namely la Repubblica (left) and
22
+ Il Giornale (right), with the two newspapers equally represented. The dataset has been used in the context
23
+ of the CHANGE-IT task (https://sites.google.com/view/change-it) during the Evalita 2020 evaluation campaign
24
+ (http://www.evalita.it/2020). CHANGE-IT is a generation task for Italian – more specifically, a style transfer
25
+ task for headlines of Italian newspapers. Given a (collection of) headlines from one newspaper, namely
26
+ Il Giornale (G) or La Repubblica (R), it challenges automatic systems to change all G-headlines to headlines in
27
+ style R, and all R-headlines to headlines in style G. Although the task only concerns headline change, the dataset
28
+ comprehends both the headlines as well as their respective full articles.
29
+ """
30
+
31
+ _HOMEPAGE = "https://live.european-language-grid.eu/catalogue/corpus/7373"
32
+
33
+ _LICENSE = "Creative Commons Attribution Non Commercial Share Alike 4.0 International"
34
+
35
+ _CONFIGS = ["repubblica", "ilgiornale"]
36
+
37
+ _SPLITS = {
38
+ "train": "train",
39
+ "test": "change-it-test-set"
40
+ }
41
+
42
+ _PATHS = {
43
+ cfg:{
44
+ split:os.path.join("CHANGE-it", split_path, f"change-it.{cfg}.{split}.csv")
45
+ for (split, split_path) in _SPLITS.items()
46
+ } for cfg in _CONFIGS
47
+ }
48
+
49
+
50
+ class ChangeItConfig(datasets.BuilderConfig):
51
+ """BuilderConfig for MATINF."""
52
+
53
+ def __init__(
54
+ self,
55
+ **kwargs,
56
+ ):
57
+ """BuilderConfig for CHANGE-IT.
58
+
59
+ Args:
60
+ **kwargs: keyword arguments forwarded to super.
61
+ """
62
+ super().__init__(version=datasets.Version("1.0.0"), **kwargs)
63
+
64
+
65
+ class ChangeIt(datasets.GeneratorBasedBuilder):
66
+ VERSION = datasets.Version("1.0.0")
67
+
68
+ BUILDER_CONFIGS = [
69
+ ChangeItConfig(
70
+ name=_CONFIGS[0],
71
+ ),
72
+ ChangeItConfig(
73
+ name=_CONFIGS[1],
74
+ ),
75
+ ]
76
+
77
+ @property
78
+ def manual_download_instructions(self):
79
+ return (
80
+ "To use CHANGE-IT you have to download it manually from the European Language Grid website."
81
+ "Please visit https://live.european-language-grid.eu/catalogue/corpus/7373, download and unizip"
82
+ "the folder. The root must contain a CHANGE-it subfolder, that contains the train and change-it-test-set subfolders."
83
+ "Then, load the dataset with: `datasets.load_dataset('gsarti/change_it', data_dir='path/to/root/folder')`"
84
+ )
85
+
86
+ def get_alignment_rating(self, id, split):
87
+ if split == "train":
88
+ if id <= 5000:
89
+ return "A1"
90
+ elif 5000 < id < 15000:
91
+ return "A3"
92
+ else:
93
+ return "R"
94
+ elif split == "test":
95
+ return "A2"
96
+ else:
97
+ raise ValueError("Unknown split {}".format(split))
98
+
99
+ def _info(self):
100
+ features = datasets.Features(
101
+ {
102
+ "id": datasets.Value("int32"),
103
+ "headline": datasets.Value("string"),
104
+ "full_text": datasets.Value("string"),
105
+ "alignment": datasets.Value("string")
106
+ }
107
+ )
108
+ return datasets.DatasetInfo(
109
+ description=_DESCRIPTION,
110
+ features=features,
111
+ supervised_keys=None,
112
+ homepage=_HOMEPAGE,
113
+ license=_LICENSE,
114
+ citation=_CITATION,
115
+ )
116
+
117
+ def _split_generators(self, dl_manager):
118
+ """Returns SplitGenerators."""
119
+ data_dir = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
120
+
121
+ if not os.path.exists(data_dir):
122
+ raise FileNotFoundError(
123
+ "{} does not exist. Make sure you insert the unzipped CHANGE-IT dir via "
124
+ "`datasets.load_dataset('gsarti/change_it', data_dir=...)`"
125
+ "Manual download instructions: {}".format(
126
+ data_dir, self.manual_download_instructions
127
+ )
128
+ )
129
+ cfg_paths = _PATHS[self.config.name]
130
+ return [
131
+ datasets.SplitGenerator(
132
+ name=datasets.Split.TRAIN,
133
+ gen_kwargs={
134
+ "filepath": os.path.join(data_dir, cfg_paths["train"]),
135
+ "split": "train"
136
+ },
137
+ ),
138
+ datasets.SplitGenerator(
139
+ name=datasets.Split.TEST,
140
+ gen_kwargs={
141
+ "filepath": os.path.join(data_dir, cfg_paths["test"]),
142
+ "split": "test"
143
+ },
144
+ ),
145
+ ]
146
+
147
+ def _generate_examples(self, filepath: str, split: str):
148
+ """Yields examples as (key, example) tuples."""
149
+ with open(filepath, encoding="utf8") as f:
150
+ reader = csv.DictReader(f)
151
+ for id_, row in enumerate(reader):
152
+ yield id_, {
153
+ "id": id_,
154
+ "headline": row["headline"],
155
+ "full_text": row["full_text"],
156
+ "alignment": self.get_alignment_rating(id_, split)
157
+ }