Add v20230518 release file
Browse files- README.md +8 -5
- multi_lexsum.py +147 -37
- releases/v20230518/dev.json +3 -0
- releases/v20230518/sources.json +3 -0
- releases/v20230518/test.json +3 -0
- releases/v20230518/train.json +3 -0
README.md
CHANGED
@@ -75,7 +75,7 @@ Please check the exemplar usage below for loading the data:
|
|
75 |
```python
|
76 |
from datasets import load_dataset
|
77 |
|
78 |
-
multi_lexsum = load_dataset("allenai/multi_lexsum", name="
|
79 |
# Download multi_lexsum locally and load it as a Dataset object
|
80 |
|
81 |
example = multi_lexsum["validation"][0] # The first instance of the dev set
|
@@ -83,6 +83,8 @@ example["sources"] # A list of source document text for the case
|
|
83 |
|
84 |
for sum_len in ["long", "short", "tiny"]:
|
85 |
print(example["summary/" + sum_len]) # Summaries of three lengths
|
|
|
|
|
86 |
```
|
87 |
|
88 |
### Data Splits
|
@@ -125,7 +127,7 @@ The corresponding code for downloading and loading the dataset is licensed under
|
|
125 |
title = {Multi-LexSum: Real-World Summaries of Civil Rights Lawsuits at Multiple Granularities},
|
126 |
journal = {CoRR},
|
127 |
volume = {abs/2206.10883},
|
128 |
-
year = {2022}
|
129 |
url = {https://doi.org/10.48550/arXiv.2206.10883},
|
130 |
doi = {10.48550/arXiv.2206.10883}
|
131 |
}
|
@@ -134,6 +136,7 @@ The corresponding code for downloading and loading the dataset is licensed under
|
|
134 |
|
135 |
## Release History
|
136 |
|
137 |
-
| Version |
|
138 |
-
| ----------: |
|
139 |
-
| `
|
|
|
|
75 |
```python
|
76 |
from datasets import load_dataset
|
77 |
|
78 |
+
multi_lexsum = load_dataset("allenai/multi_lexsum", name="v20230518")
|
79 |
# Download multi_lexsum locally and load it as a Dataset object
|
80 |
|
81 |
example = multi_lexsum["validation"][0] # The first instance of the dev set
|
|
|
83 |
|
84 |
for sum_len in ["long", "short", "tiny"]:
|
85 |
print(example["summary/" + sum_len]) # Summaries of three lengths
|
86 |
+
|
87 |
+
print(example['case_metadata']) # The corresponding metadata for a case in a dict
|
88 |
```
|
89 |
|
90 |
### Data Splits
|
|
|
127 |
title = {Multi-LexSum: Real-World Summaries of Civil Rights Lawsuits at Multiple Granularities},
|
128 |
journal = {CoRR},
|
129 |
volume = {abs/2206.10883},
|
130 |
+
year = {2022},****
|
131 |
url = {https://doi.org/10.48550/arXiv.2206.10883},
|
132 |
doi = {10.48550/arXiv.2206.10883}
|
133 |
}
|
|
|
136 |
|
137 |
## Release History
|
138 |
|
139 |
+
| Version | Description |
|
140 |
+
| ----------: | -----------------------------------------------------------: |
|
141 |
+
| `v20230518` | The v1.1 release including case and source document metadata |
|
142 |
+
| `v20220616` | The initial v1.0 release |
|
multi_lexsum.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from typing import List, Union, Dict, Any, Tuple
|
2 |
import json
|
3 |
import os
|
|
|
4 |
|
5 |
import datasets
|
6 |
from datasets.tasks import Summarization
|
@@ -17,7 +17,6 @@ def _load_jsonl(filename):
|
|
17 |
|
18 |
|
19 |
def _load_json(filepath):
|
20 |
-
|
21 |
with open(filepath, "r") as fp:
|
22 |
res = json.load(fp)
|
23 |
return res
|
@@ -42,7 +41,7 @@ _CITATION = """
|
|
42 |
|
43 |
_DESCRIPTION = """
|
44 |
Multi-LexSum is a multi-doc summarization dataset for civil rights litigation lawsuits with summaries of three granularities.
|
45 |
-
""" # TODO: Update with full abstract
|
46 |
|
47 |
_HOMEPAGE = "https://multilexsum.github.io"
|
48 |
|
@@ -68,8 +67,8 @@ class MultiLexsumConfig(datasets.BuilderConfig):
|
|
68 |
|
69 |
|
70 |
class MultiLexsum(datasets.GeneratorBasedBuilder):
|
71 |
-
"""MultiLexSum Dataset: a multi-doc summarization dataset for
|
72 |
-
civil rights litigation lawsuits with summaries of three granularities.
|
73 |
"""
|
74 |
|
75 |
BUILDER_CONFIGS = [
|
@@ -78,30 +77,90 @@ class MultiLexsum(datasets.GeneratorBasedBuilder):
|
|
78 |
version=datasets.Version("1.0.0", "Public v1.0 release."),
|
79 |
description="The v1.0 Multi-LexSum dataset",
|
80 |
),
|
|
|
|
|
|
|
|
|
|
|
81 |
]
|
82 |
|
83 |
def _info(self):
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
def _split_generators(self, dl_manager):
|
104 |
-
|
105 |
base_url = _BASE_URL if self.config.data_dir is None else self.config.data_dir
|
106 |
downloaded_files = dl_manager.download_and_extract(
|
107 |
{
|
@@ -140,16 +199,67 @@ class MultiLexsum(datasets.GeneratorBasedBuilder):
|
|
140 |
"""This function returns the examples in the raw (text) form."""
|
141 |
logger.info(f"generating examples from = {subset_file}")
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import json
|
2 |
import os
|
3 |
+
from typing import Any, Dict, List, Tuple, Union
|
4 |
|
5 |
import datasets
|
6 |
from datasets.tasks import Summarization
|
|
|
17 |
|
18 |
|
19 |
def _load_json(filepath):
|
|
|
20 |
with open(filepath, "r") as fp:
|
21 |
res = json.load(fp)
|
22 |
return res
|
|
|
41 |
|
42 |
_DESCRIPTION = """
|
43 |
Multi-LexSum is a multi-doc summarization dataset for civil rights litigation lawsuits with summaries of three granularities.
|
44 |
+
""" # TODO: Update with full abstract
|
45 |
|
46 |
_HOMEPAGE = "https://multilexsum.github.io"
|
47 |
|
|
|
67 |
|
68 |
|
69 |
class MultiLexsum(datasets.GeneratorBasedBuilder):
|
70 |
+
"""MultiLexSum Dataset: a multi-doc summarization dataset for
|
71 |
+
civil rights litigation lawsuits with summaries of three granularities.
|
72 |
"""
|
73 |
|
74 |
BUILDER_CONFIGS = [
|
|
|
77 |
version=datasets.Version("1.0.0", "Public v1.0 release."),
|
78 |
description="The v1.0 Multi-LexSum dataset",
|
79 |
),
|
80 |
+
MultiLexsumConfig(
|
81 |
+
name="v20230518",
|
82 |
+
version=datasets.Version("1.1.0", "Public v1.1 release."),
|
83 |
+
description="It adds additional metadata for documents and cases",
|
84 |
+
),
|
85 |
]
|
86 |
|
87 |
def _info(self):
|
88 |
+
if self.config.name == "v20220616":
|
89 |
+
return datasets.DatasetInfo(
|
90 |
+
description=_DESCRIPTION,
|
91 |
+
features=datasets.Features(
|
92 |
+
{
|
93 |
+
"id": datasets.Value("string"),
|
94 |
+
"sources": datasets.Sequence(datasets.Value("string")),
|
95 |
+
"summary/long": datasets.Value("string"),
|
96 |
+
"summary/short": datasets.Value("string"),
|
97 |
+
"summary/tiny": datasets.Value("string"),
|
98 |
+
}
|
99 |
+
),
|
100 |
+
supervised_keys=None,
|
101 |
+
homepage=_HOMEPAGE,
|
102 |
+
citation=_CITATION,
|
103 |
+
task_templates=[
|
104 |
+
Summarization(text_column="source", summary_column="summary/long")
|
105 |
+
],
|
106 |
+
)
|
107 |
+
elif self.config.name == "v20230518":
|
108 |
+
return datasets.DatasetInfo(
|
109 |
+
description=_DESCRIPTION,
|
110 |
+
features=datasets.Features(
|
111 |
+
{
|
112 |
+
"id": datasets.Value("string"),
|
113 |
+
"sources": datasets.Sequence(datasets.Value("string")),
|
114 |
+
"sources_metadata": datasets.Sequence(
|
115 |
+
{
|
116 |
+
"doc_id": datasets.Value("string"),
|
117 |
+
"doc_type": datasets.Value("string"),
|
118 |
+
"doc_title": datasets.Value("string"),
|
119 |
+
"parser": datasets.Value("string"),
|
120 |
+
"is_ocr": datasets.Value("bool"),
|
121 |
+
"url": datasets.Value("string"),
|
122 |
+
}
|
123 |
+
),
|
124 |
+
"summary/long": datasets.Value("string"),
|
125 |
+
"summary/short": datasets.Value("string"),
|
126 |
+
"summary/tiny": datasets.Value("string"),
|
127 |
+
"case_metadata": datasets.Features(
|
128 |
+
{
|
129 |
+
# fmt: off
|
130 |
+
"case_name": datasets.Value("string"),
|
131 |
+
"case_type": datasets.Value("string"),
|
132 |
+
"filing_date": datasets.Value("string"),
|
133 |
+
"filing_year": datasets.Value("string"),
|
134 |
+
"case_ongoing": datasets.Value("string"),
|
135 |
+
"case_ongoing_record_time": datasets.Value("string"),
|
136 |
+
"closing_year": datasets.Value("string"),
|
137 |
+
"order_start_year": datasets.Value("string"),
|
138 |
+
"order_end_year": datasets.Value("string"),
|
139 |
+
"defendant_payment": datasets.Value("string"),
|
140 |
+
"class_action_sought": datasets.Value("string"),
|
141 |
+
"class_action_granted": datasets.Value("string"),
|
142 |
+
"attorney_orgs": [datasets.Value("string")],
|
143 |
+
"prevailing_party": datasets.Value("string"),
|
144 |
+
"plaintiff_types": [datasets.Value("string")],
|
145 |
+
"plaintiff_description": datasets.Value("string"),
|
146 |
+
"constitutional_clauses": [datasets.Value("string")],
|
147 |
+
"causes_of_action": [datasets.Value("string")],
|
148 |
+
"summary_authors": [datasets.Value("string")],
|
149 |
+
"case_url": datasets.Value("string"),
|
150 |
+
# fmt: on
|
151 |
+
}
|
152 |
+
),
|
153 |
+
}
|
154 |
+
),
|
155 |
+
supervised_keys=None,
|
156 |
+
homepage=_HOMEPAGE,
|
157 |
+
citation=_CITATION,
|
158 |
+
task_templates=[
|
159 |
+
Summarization(text_column="source", summary_column="summary/long")
|
160 |
+
],
|
161 |
+
)
|
162 |
|
163 |
def _split_generators(self, dl_manager):
|
|
|
164 |
base_url = _BASE_URL if self.config.data_dir is None else self.config.data_dir
|
165 |
downloaded_files = dl_manager.download_and_extract(
|
166 |
{
|
|
|
199 |
"""This function returns the examples in the raw (text) form."""
|
200 |
logger.info(f"generating examples from = {subset_file}")
|
201 |
|
202 |
+
if self.config.name == "v20220616":
|
203 |
+
subset_cases = _load_jsonl(subset_file)
|
204 |
+
for case_data in subset_cases:
|
205 |
+
case_sources = [
|
206 |
+
sources[source_id]["doc_text"]
|
207 |
+
for source_id in case_data["case_documents"]
|
208 |
+
]
|
209 |
+
yield case_data["case_id"], {
|
210 |
+
"id": case_data["case_id"],
|
211 |
+
"sources": case_sources,
|
212 |
+
"summary/long": case_data["summary/long"],
|
213 |
+
"summary/short": case_data["summary/short"],
|
214 |
+
"summary/tiny": case_data["summary/tiny"],
|
215 |
+
}
|
216 |
+
elif self.config.name == "v20230518":
|
217 |
+
subset_cases = _load_jsonl(subset_file)
|
218 |
+
|
219 |
+
for idx, case_data in enumerate(subset_cases):
|
220 |
+
case_sources = [
|
221 |
+
sources[source_id]["doc_text"]
|
222 |
+
for source_id in case_data["case_documents"]
|
223 |
+
]
|
224 |
+
|
225 |
+
case_source_metadata = [
|
226 |
+
{
|
227 |
+
key: val
|
228 |
+
for key, val in sources[source_id].items()
|
229 |
+
if key != "doc_text"
|
230 |
+
}
|
231 |
+
for source_id in case_data["case_documents"]
|
232 |
+
]
|
233 |
+
|
234 |
+
case_metadata = {
|
235 |
+
"case_name": case_data["case_name"],
|
236 |
+
"case_type": case_data["case_type"],
|
237 |
+
"filing_date": case_data["filing_date"],
|
238 |
+
"filing_year": case_data["filing_year"],
|
239 |
+
"case_ongoing": case_data["case_ongoing"],
|
240 |
+
"case_ongoing_record_time": case_data["case_ongoing_record_time"],
|
241 |
+
"closing_year": case_data["closing_year"],
|
242 |
+
"order_start_year": case_data["order_start_year"],
|
243 |
+
"order_end_year": case_data["order_end_year"],
|
244 |
+
"defendant_payment": case_data["defendant_payment"],
|
245 |
+
"class_action_sought": case_data["class_action_sought"],
|
246 |
+
"class_action_granted": case_data["class_action_granted"],
|
247 |
+
"attorney_orgs": case_data["attorney_org"],
|
248 |
+
"prevailing_party": case_data["prevailing_party"],
|
249 |
+
"plaintiff_types": case_data["plaintiff_types"],
|
250 |
+
"plaintiff_description": case_data["plaintiff_description"],
|
251 |
+
"constitutional_clauses": case_data["constitutional_clauses"],
|
252 |
+
"causes_of_action": case_data["causes_of_action"],
|
253 |
+
"summary_authors": case_data["summary_authors"],
|
254 |
+
"case_url": case_data["case_url"],
|
255 |
+
}
|
256 |
+
|
257 |
+
yield case_data["case_id"], {
|
258 |
+
"id": case_data["case_id"],
|
259 |
+
"sources": case_sources,
|
260 |
+
"sources_metadata": case_source_metadata,
|
261 |
+
"summary/long": case_data["summary/long"],
|
262 |
+
"summary/short": case_data["summary/short"],
|
263 |
+
"summary/tiny": case_data["summary/tiny"],
|
264 |
+
"case_metadata": case_metadata,
|
265 |
+
}
|
releases/v20230518/dev.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0ae6fe46c5557975b29ed5bbfe780e9d188623320ac6c94d75ea8412ffe64b31
|
3 |
+
size 2555645
|
releases/v20230518/sources.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:805fd58ac5f72c40c9b575fa1e1b0be1943ea3c07a1a3089827444a3e0abc858
|
3 |
+
size 2221892187
|
releases/v20230518/test.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56ffcfc1add9fbd895b024d1220317acb25109508ea76f275952ca8419594e61
|
3 |
+
size 4821719
|
releases/v20230518/train.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:168c1c22fb4739e4cb0405bfc29499744357218a386d9bc234c0dfc39f0c1302
|
3 |
+
size 17628135
|