Datasets:
GEM
/

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
Sebastian Gehrmann commited on
Commit
63abb80
1 Parent(s): 0f9deaf
Files changed (2) hide show
  1. dataset_infos.json +108 -0
  2. e2e_nlg.py +105 -0
dataset_infos.json ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "e2e_nlg": {
3
+ "description": "GEM is a benchmark environment for Natural Language Generation with a focus on its Evaluation,\nboth through human annotations and automated Metrics.\n\nGEM aims to:\n- measure NLG progress across 13 datasets spanning many NLG tasks and languages.\n- provide an in-depth analysis of data and models presented via data statements and challenge sets.\n- develop standards for evaluation of generated text using both automated and human metrics.\n\nIt is our goal to regularly update GEM and to encourage toward more inclusive practices in dataset development\nby extending existing data or developing datasets for additional languages.\n",
4
+ "citation": "@article{gem_benchmark,\n author = {Sebastian Gehrmann and\n Tosin P. Adewumi and\n Karmanya Aggarwal and\n Pawan Sasanka Ammanamanchi and\n Aremu Anuoluwapo and\n Antoine Bosselut and\n Khyathi Raghavi Chandu and\n Miruna{-}Adriana Clinciu and\n Dipanjan Das and\n Kaustubh D. Dhole and\n Wanyu Du and\n Esin Durmus and\n Ondrej Dusek and\n Chris Emezue and\n Varun Gangal and\n Cristina Garbacea and\n Tatsunori Hashimoto and\n Yufang Hou and\n Yacine Jernite and\n Harsh Jhamtani and\n Yangfeng Ji and\n Shailza Jolly and\n Dhruv Kumar and\n Faisal Ladhak and\n Aman Madaan and\n Mounica Maddela and\n Khyati Mahajan and\n Saad Mahamood and\n Bodhisattwa Prasad Majumder and\n Pedro Henrique Martins and\n Angelina McMillan{-}Major and\n Simon Mille and\n Emiel van Miltenburg and\n Moin Nadeem and\n Shashi Narayan and\n Vitaly Nikolaev and\n Rubungo Andre Niyongabo and\n Salomey Osei and\n Ankur P. Parikh and\n Laura Perez{-}Beltrachini and\n Niranjan Ramesh Rao and\n Vikas Raunak and\n Juan Diego Rodriguez and\n Sashank Santhanam and\n Joao Sedoc and\n Thibault Sellam and\n Samira Shaikh and\n Anastasia Shimorina and\n Marco Antonio Sobrevilla Cabezudo and\n Hendrik Strobelt and\n Nishant Subramani and\n Wei Xu and\n Diyi Yang and\n Akhila Yerukola and\n Jiawei Zhou},\n title = {The {GEM} Benchmark: Natural Language Generation, its Evaluation and\n Metrics},\n journal = {CoRR},\n volume = {abs/2102.01672},\n year = {2021},\n url = {https://arxiv.org/abs/2102.01672},\n archivePrefix = {arXiv},\n eprint = {2102.01672}\n}\n",
5
+ "homepage": "https://gem-benchmark.github.io/",
6
+ "license": "CC-BY-SA-4.0",
7
+ "features": {
8
+ "gem_id": {
9
+ "dtype": "string",
10
+ "id": null,
11
+ "_type": "Value"
12
+ },
13
+ "gem_parent_id": {
14
+ "dtype": "string",
15
+ "id": null,
16
+ "_type": "Value"
17
+ },
18
+ "meaning_representation": {
19
+ "dtype": "string",
20
+ "id": null,
21
+ "_type": "Value"
22
+ },
23
+ "target": {
24
+ "dtype": "string",
25
+ "id": null,
26
+ "_type": "Value"
27
+ },
28
+ "references": [
29
+ {
30
+ "dtype": "string",
31
+ "id": null,
32
+ "_type": "Value"
33
+ }
34
+ ]
35
+ },
36
+ "post_processed": null,
37
+ "supervised_keys": null,
38
+ "builder_name": "gem",
39
+ "config_name": "e2e_nlg",
40
+ "version": {
41
+ "version_str": "1.1.0",
42
+ "description": null,
43
+ "major": 1,
44
+ "minor": 1,
45
+ "patch": 0
46
+ },
47
+ "splits": {
48
+ "train": {
49
+ "name": "train",
50
+ "num_bytes": 9129030,
51
+ "num_examples": 33525,
52
+ "dataset_name": "gem"
53
+ },
54
+ "validation": {
55
+ "name": "validation",
56
+ "num_bytes": 1856097,
57
+ "num_examples": 4299,
58
+ "dataset_name": "gem"
59
+ },
60
+ "test": {
61
+ "name": "test",
62
+ "num_bytes": 2133695,
63
+ "num_examples": 4693,
64
+ "dataset_name": "gem"
65
+ },
66
+ "challenge_train_sample": {
67
+ "name": "challenge_train_sample",
68
+ "num_bytes": 145319,
69
+ "num_examples": 500,
70
+ "dataset_name": "gem"
71
+ },
72
+ "challenge_validation_sample": {
73
+ "name": "challenge_validation_sample",
74
+ "num_bytes": 226525,
75
+ "num_examples": 500,
76
+ "dataset_name": "gem"
77
+ },
78
+ "challenge_test_scramble": {
79
+ "name": "challenge_test_scramble",
80
+ "num_bytes": 236199,
81
+ "num_examples": 500,
82
+ "dataset_name": "gem"
83
+ }
84
+ },
85
+ "download_checksums": {
86
+ "https://github.com/tuetschek/e2e-cleaning/raw/master/cleaned-data/train-fixed.no-ol.csv": {
87
+ "num_bytes": 11100744,
88
+ "checksum": "12a4f59ec85ddd2586244aaf166f65d1b8cd468b6227e6620108baf118d5b325"
89
+ },
90
+ "https://github.com/tuetschek/e2e-cleaning/raw/master/cleaned-data/devel-fixed.no-ol.csv": {
91
+ "num_bytes": 1581285,
92
+ "checksum": "bb88df2565826a463f96e93a5ab69a8c6460de54f2e68179eb94f0019f430d4d"
93
+ },
94
+ "https://github.com/tuetschek/e2e-cleaning/raw/master/cleaned-data/test-fixed.csv": {
95
+ "num_bytes": 1915378,
96
+ "checksum": "99b43c2769a09d62fc5d37dcffaa59d4092bcffdc611f226258681df61269b17"
97
+ },
98
+ "https://storage.googleapis.com/huggingface-nlp/datasets/gem/gem_challenge_sets/e2e_nlg.zip": {
99
+ "num_bytes": 70641,
100
+ "checksum": "5d9db67219c984f778dda42e718bc8199945bde609f0b313153de2894e33a883"
101
+ }
102
+ },
103
+ "download_size": 14668048,
104
+ "post_processing_size": null,
105
+ "dataset_size": 13726865,
106
+ "size_in_bytes": 28394913
107
+ }
108
+ }
e2e_nlg.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import json
3
+ import os
4
+ import datasets
5
+
6
+ _CITATION = """\
7
+ @inproceedings{e2e_cleaned,
8
+ address = {Tokyo, Japan},
9
+ title = {Semantic {Noise} {Matters} for {Neural} {Natural} {Language} {Generation}},
10
+ url = {https://www.aclweb.org/anthology/W19-8652/},
11
+ booktitle = {Proceedings of the 12th {International} {Conference} on {Natural} {Language} {Generation} ({INLG} 2019)},
12
+ author = {Dušek, Ondřej and Howcroft, David M and Rieser, Verena},
13
+ year = {2019},
14
+ pages = {421--426},
15
+ }
16
+ """
17
+
18
+ _DESCRIPTION = """\
19
+ The E2E dataset is designed for a limited-domain data-to-text task --
20
+ generation of restaurant descriptions/recommendations based on up to 8 different
21
+ attributes (name, area, price range etc.).
22
+ """
23
+
24
+ _URLs = {
25
+ "train": "https://github.com/tuetschek/e2e-cleaning/raw/master/cleaned-data/train-fixed.no-ol.csv",
26
+ "validation": "https://github.com/tuetschek/e2e-cleaning/raw/master/cleaned-data/devel-fixed.no-ol.csv",
27
+ "test": "https://github.com/tuetschek/e2e-cleaning/raw/master/cleaned-data/test-fixed.csv",
28
+ "challenge_set": "https://storage.googleapis.com/huggingface-nlp/datasets/gem/gem_challenge_sets/e2e_nlg.zip",
29
+ }
30
+
31
+
32
+ class E2ENlg(datasets.GeneratorBasedBuilder):
33
+ VERSION = datasets.Version("1.0.0")
34
+ DEFAULT_CONFIG_NAME = "e2e_nlg"
35
+
36
+ def _info(self):
37
+ features = datasets.Features(
38
+ {
39
+ "gem_id": datasets.Value("string"),
40
+ "gem_parent_id": datasets.Value("string"),
41
+ "meaning_representation": datasets.Value("string"),
42
+ "target": datasets.Value("string"),
43
+ "references": [datasets.Value("string")],
44
+ }
45
+ )
46
+ return datasets.DatasetInfo(
47
+ description=_DESCRIPTION,
48
+ features=features,
49
+ supervised_keys=datasets.info.SupervisedKeysData(
50
+ input="meaning_representation", output="target"
51
+ ),
52
+ homepage="http://www.macs.hw.ac.uk/InteractionLab/E2E/",
53
+ citation=_CITATION,
54
+ )
55
+
56
+ def _split_generators(self, dl_manager):
57
+ """Returns SplitGenerators."""
58
+ dl_dir = dl_manager.download_and_extract(_URLs)
59
+ challenge_sets = [
60
+ ("challenge_train_sample", "train_e2e_nlg_RandomSample500.json"),
61
+ ("challenge_validation_sample", "validation_e2e_nlg_RandomSample500.json"),
62
+ ("challenge_test_scramble", "test_e2e_nlg_ScrambleInputStructure500.json"),
63
+ ]
64
+ return [
65
+ datasets.SplitGenerator(
66
+ name=spl, gen_kwargs={"filepath": dl_dir[spl], "split": spl}
67
+ )
68
+ for spl in ["train", "validation", "test"]
69
+ ] + [
70
+ datasets.SplitGenerator(
71
+ name=challenge_split,
72
+ gen_kwargs={
73
+ "filepath": os.path.join(
74
+ dl_dir["challenge_set"], "e2e_nlg", filename
75
+ ),
76
+ "split": challenge_split,
77
+ },
78
+ )
79
+ for challenge_split, filename in challenge_sets
80
+ ]
81
+
82
+ def _generate_examples(self, filepath, split, filepaths=None, lang=None):
83
+ """Yields examples."""
84
+ if split.startswith("challenge"):
85
+ exples = json.load(open(filepath, encoding="utf-8"))
86
+ if isinstance(exples, dict):
87
+ assert len(exples) == 1, "multiple entries found"
88
+ exples = list(exples.values())[0]
89
+ for id_, exple in enumerate(exples):
90
+ if len(exple) == 0:
91
+ continue
92
+ exple["gem_parent_id"] = exple["gem_id"]
93
+ exple["gem_id"] = f"e2e_nlg-{split}-{id_}"
94
+ yield id_, exple
95
+ else:
96
+ with open(filepath, encoding="utf-8") as f:
97
+ reader = csv.DictReader(f)
98
+ for id_, example in enumerate(reader):
99
+ yield id_, {
100
+ "gem_id": f"e2e_nlg-{split}-{id_}",
101
+ "gem_parent_id": f"e2e_nlg-{split}-{id_}",
102
+ "meaning_representation": example["mr"],
103
+ "target": example["ref"],
104
+ "references": [] if split == "train" else [example["ref"]],
105
+ }