ccdv commited on
Commit
f4422b4
1 Parent(s): a7c46c7
Files changed (4) hide show
  1. govreport-summarization.py +96 -0
  2. test.zip +3 -0
  3. train.zip +3 -0
  4. valid.zip +3 -0
govreport-summarization.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+
4
+ import datasets
5
+ from datasets.tasks import TextClassification
6
+
7
+ _DESCRIPTION = """
8
+ GovReport dataset for summarization.
9
+ From paper: Efficient Attentions for Long Document Summarization" by L. Huang et al.
10
+ See: https://arxiv.org/pdf/2104.02112.pdf
11
+ See: https://github.com/luyang-huang96/LongDocSum
12
+ """
13
+ _CITATION = """\
14
+ @misc{huang2021efficient,
15
+ title={Efficient Attentions for Long Document Summarization},
16
+ author={Luyang Huang and Shuyang Cao and Nikolaus Parulian and Heng Ji and Lu Wang},
17
+ year={2021},
18
+ eprint={2104.02112},
19
+ archivePrefix={arXiv},
20
+ primaryClass={cs.CL}
21
+ }
22
+ }
23
+ """
24
+ _ABSTRACT = "abstract"
25
+ _ARTICLE = "article"
26
+
27
+ class GovReportSummarizationConfig(datasets.BuilderConfig):
28
+ """BuilderConfig for GovReportSummarization."""
29
+
30
+ def __init__(self, **kwargs):
31
+ """BuilderConfig for GovReportSummarization.
32
+ Args:
33
+ **kwargs: keyword arguments forwarded to super.
34
+ """
35
+ super(GovReportSummarizationConfig, self).__init__(**kwargs)
36
+
37
+
38
+ class GovReportSummarizationDataset(datasets.GeneratorBasedBuilder):
39
+ """GovReportSummarization Dataset."""
40
+
41
+ _TRAIN_FILE = "train.zip"
42
+ _VAL_FILE = "val.zip"
43
+ _TEST_FILE = "test.zip"
44
+
45
+ BUILDER_CONFIGS = [
46
+ GovReportSummarizationConfig(
47
+ name="document",
48
+ version=datasets.Version("1.0.0"),
49
+ description="GovReport dataset for summarization, document",
50
+ ),
51
+ ]
52
+
53
+ DEFAULT_CONFIG_NAME = "document"
54
+
55
+ def _info(self):
56
+ # Should return a datasets.DatasetInfo object
57
+ return datasets.DatasetInfo(
58
+ description=_DESCRIPTION,
59
+ features=datasets.Features(
60
+ {
61
+ _ARTICLE: datasets.Value("string"),
62
+ _ABSTRACT: datasets.Value("string"),
63
+ #"id": datasets.Value("string"),
64
+ }
65
+ ),
66
+ supervised_keys=None,
67
+ homepage="https://github.com/luyang-huang96/LongDocSum",
68
+ citation=_CITATION,
69
+ )
70
+
71
+ def _split_generators(self, dl_manager):
72
+
73
+ train_path = dl_manager.download_and_extract(self._TRAIN_FILE) + "/train.txt"
74
+ val_path = dl_manager.download_and_extract(self._VAL_FILE) + "/val.txt"
75
+ test_path = dl_manager.download_and_extract(self._TEST_FILE) + "/test.txt"
76
+
77
+ return [
78
+ datasets.SplitGenerator(
79
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
80
+ ),
81
+ datasets.SplitGenerator(
82
+ name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}
83
+ ),
84
+ datasets.SplitGenerator(
85
+ name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}
86
+ ),
87
+ ]
88
+
89
+ def _generate_examples(self, filepath):
90
+ """Generate GovReportSummarization examples."""
91
+ with open(filepath, encoding="utf-8") as f:
92
+ for id_, row in enumerate(f):
93
+ data = json.loads(row)
94
+ report = data["report"]
95
+ summary = data["summary"]
96
+ yield id_, {"report": report, "summary": summary}
test.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a88ab045b282014eb2509537e6423c3ac8cb0bd709a6f13f1f54c00b74992a66
3
+ size 14617513
train.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd34bc80bb468f68dc7ffe6ba0a70fcce292b397a081e746da243432460a7721
3
+ size 276873459
valid.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65fe863ce429f5ad669744aae2de57490d2970b1ade8bc1094386c0599d3307b
3
+ size 15912114