Delete _logic2text.py
Browse files- _logic2text.py +0 -79
_logic2text.py
DELETED
|
@@ -1,79 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
|
| 3 |
-
"""
|
| 4 |
-
The script used to load the dataset from the original source.
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
import json
|
| 9 |
-
import datasets
|
| 10 |
-
import glob
|
| 11 |
-
import os
|
| 12 |
-
|
| 13 |
-
_CITATION = """\
|
| 14 |
-
@inproceedings{chen2020logic2text,
|
| 15 |
-
title={Logic2Text: High-Fidelity Natural Language Generation from Logical Forms},
|
| 16 |
-
author={Chen, Zhiyu and Chen, Wenhu and Zha, Hanwen and Zhou, Xiyou and Zhang, Yunkai and Sundaresan, Sairam and Wang, William Yang},
|
| 17 |
-
booktitle={Findings of the Association for Computational Linguistics: EMNLP 2020},
|
| 18 |
-
pages={2096--2111},
|
| 19 |
-
year={2020}
|
| 20 |
-
}
|
| 21 |
-
"""
|
| 22 |
-
_DESCRIPTION = """\
|
| 23 |
-
Logic2Text is a large-scale dataset with 10,753 descriptions involving common logic types paired with the underlying logical forms.
|
| 24 |
-
The logical forms show diversified graph structure of free schema, which poses great challenges on the model's ability to understand the semantics.
|
| 25 |
-
"""
|
| 26 |
-
|
| 27 |
-
_URL = "https://github.com/czyssrs/Logic2Text"
|
| 28 |
-
_LICENSE = "MIT"
|
| 29 |
-
|
| 30 |
-
class Logic2Text(datasets.GeneratorBasedBuilder):
|
| 31 |
-
VERSION = "1.0.0"
|
| 32 |
-
def _info(self):
|
| 33 |
-
return datasets.DatasetInfo(
|
| 34 |
-
description=_DESCRIPTION,
|
| 35 |
-
features=datasets.Features({
|
| 36 |
-
'topic' : datasets.Value(dtype='string'),
|
| 37 |
-
'wiki' : datasets.Value(dtype='string'),
|
| 38 |
-
'url' : datasets.Value(dtype='string'),
|
| 39 |
-
'action' : datasets.Value(dtype='string'),
|
| 40 |
-
'sent' : datasets.Value(dtype='string'),
|
| 41 |
-
'annotation' : datasets.Value(dtype='string'),
|
| 42 |
-
'logic' : datasets.Value(dtype='string'),
|
| 43 |
-
'logic_str' : datasets.Value(dtype='string'),
|
| 44 |
-
'interpret' : datasets.Value(dtype='string'),
|
| 45 |
-
'num_func' : datasets.Value(dtype='string'),
|
| 46 |
-
'nid' : datasets.Value(dtype='string'),
|
| 47 |
-
'g_ids' : datasets.Value(dtype='string'),
|
| 48 |
-
'g_ids_features' : datasets.Value(dtype='string'),
|
| 49 |
-
'g_adj' : datasets.Value(dtype='string'),
|
| 50 |
-
'table_header' : datasets.Value(dtype='string'),
|
| 51 |
-
'table_cont' : datasets.Value(dtype='large_string'),
|
| 52 |
-
}),
|
| 53 |
-
supervised_keys=None,
|
| 54 |
-
homepage=_URL,
|
| 55 |
-
citation=_CITATION,
|
| 56 |
-
license=_LICENSE,
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
def _split_generators(self, dl_manager):
|
| 60 |
-
"""Returns SplitGenerators."""
|
| 61 |
-
return [
|
| 62 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": "dataset", "split" : "train"}),
|
| 63 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": "dataset", "split" : "dev"}),
|
| 64 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": "dataset", "split" : "test"}),
|
| 65 |
-
]
|
| 66 |
-
|
| 67 |
-
def _generate_examples(self, filepath, split):
|
| 68 |
-
data = []
|
| 69 |
-
filename = split if split != "dev" else "valid"
|
| 70 |
-
|
| 71 |
-
with open(os.path.join(filepath, f"{filename}.json")) as f:
|
| 72 |
-
data = json.load(f)
|
| 73 |
-
|
| 74 |
-
for example_idx, entry in enumerate(data):
|
| 75 |
-
yield example_idx, {key: str(value) for key, value in entry.items()}
|
| 76 |
-
|
| 77 |
-
if __name__ == '__main__':
|
| 78 |
-
dataset = datasets.load_dataset(__file__)
|
| 79 |
-
dataset.push_to_hub("kasnerz/logic2text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|