Datasets:
Tasks:
Summarization
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
bills-summarization
License:
Commit
•
77f3575
1
Parent(s):
80bf8bc
Delete loading script
Browse files- billsum.py +0 -108
billsum.py
DELETED
@@ -1,108 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
|
16 |
-
# Lint as: python3
|
17 |
-
"""BillSum Dataset."""
|
18 |
-
|
19 |
-
|
20 |
-
import json
|
21 |
-
import os
|
22 |
-
|
23 |
-
import datasets
|
24 |
-
|
25 |
-
|
26 |
-
_CITATION = """
|
27 |
-
@misc{kornilova2019billsum,
|
28 |
-
title={BillSum: A Corpus for Automatic Summarization of US Legislation},
|
29 |
-
author={Anastassia Kornilova and Vlad Eidelman},
|
30 |
-
year={2019},
|
31 |
-
eprint={1910.00523},
|
32 |
-
archivePrefix={arXiv},
|
33 |
-
primaryClass={cs.CL}
|
34 |
-
}
|
35 |
-
"""
|
36 |
-
|
37 |
-
_DESCRIPTION = """
|
38 |
-
BillSum, summarization of US Congressional and California state bills.
|
39 |
-
|
40 |
-
There are several features:
|
41 |
-
- text: bill text.
|
42 |
-
- summary: summary of the bills.
|
43 |
-
- title: title of the bills.
|
44 |
-
features for us bills. ca bills does not have.
|
45 |
-
- text_len: number of chars in text.
|
46 |
-
- sum_len: number of chars in summary.
|
47 |
-
"""
|
48 |
-
|
49 |
-
_URL = "https://drive.google.com/uc?export=download&id=1g89WgFHMRbr4QrvA0ngh26PY081Nv3lx"
|
50 |
-
|
51 |
-
_LICENSE = "CC0"
|
52 |
-
|
53 |
-
_DOCUMENT = "text"
|
54 |
-
_SUMMARY = "summary"
|
55 |
-
|
56 |
-
|
57 |
-
class Billsum(datasets.GeneratorBasedBuilder):
|
58 |
-
"""BillSum Dataset."""
|
59 |
-
|
60 |
-
# 2.0.0 data source updated to filter near duplicates.
|
61 |
-
# 3.0.0 none of the test examples are 'near duplicates' of an example in the
|
62 |
-
# train set AND they dont have the same title, regardless of similarity.
|
63 |
-
VERSION = datasets.Version("3.0.0")
|
64 |
-
|
65 |
-
def _info(self):
|
66 |
-
return datasets.DatasetInfo(
|
67 |
-
description=_DESCRIPTION,
|
68 |
-
license=_LICENSE,
|
69 |
-
features=datasets.Features(
|
70 |
-
{
|
71 |
-
_DOCUMENT: datasets.Value("string"),
|
72 |
-
_SUMMARY: datasets.Value("string"),
|
73 |
-
"title": datasets.Value("string"),
|
74 |
-
}
|
75 |
-
),
|
76 |
-
supervised_keys=(_DOCUMENT, _SUMMARY),
|
77 |
-
homepage="https://github.com/FiscalNote/BillSum",
|
78 |
-
citation=_CITATION,
|
79 |
-
)
|
80 |
-
|
81 |
-
def _split_generators(self, dl_manager):
|
82 |
-
"""Returns SplitGenerators."""
|
83 |
-
dl_path = dl_manager.download_and_extract(_URL)
|
84 |
-
return [
|
85 |
-
datasets.SplitGenerator(
|
86 |
-
name=datasets.Split.TRAIN,
|
87 |
-
gen_kwargs={"path": os.path.join(dl_path, "us_train_data_final_OFFICIAL.jsonl"), "key": "bill_id"},
|
88 |
-
),
|
89 |
-
datasets.SplitGenerator(
|
90 |
-
name=datasets.Split.TEST,
|
91 |
-
gen_kwargs={"path": os.path.join(dl_path, "us_test_data_final_OFFICIAL.jsonl"), "key": "bill_id"},
|
92 |
-
),
|
93 |
-
datasets.SplitGenerator(
|
94 |
-
name="ca_test",
|
95 |
-
gen_kwargs={"path": os.path.join(dl_path, "ca_test_data_final_OFFICIAL.jsonl"), "key": "external_id"},
|
96 |
-
),
|
97 |
-
]
|
98 |
-
|
99 |
-
def _generate_examples(self, path=None, key=None):
|
100 |
-
"""Yields examples."""
|
101 |
-
with open(path, encoding="utf-8") as f:
|
102 |
-
for line in f:
|
103 |
-
# in us bills, json has fields:
|
104 |
-
# text, summary, title, bill_id, text_len, sum_len
|
105 |
-
# in ca bills, json has fields:
|
106 |
-
# text, summary, title, external_id
|
107 |
-
d = json.loads(line)
|
108 |
-
yield d[key], {k: d[k] for k in [_DOCUMENT, _SUMMARY, "title"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|