kiddothe2b
commited on
Commit
•
727ca82
1
Parent(s):
68a157b
Initial commit
Browse files- README.md +103 -1
- canadian_court_cases.zip +3 -0
- canadian_legislation.zip +3 -0
- ecthr_cases.zip +3 -0
- eurlex.zip +3 -0
- indian_courts_cases.zip +3 -0
- lexfiles.py +172 -0
- uk_courts_cases.zip +3 -0
- uk_legislation.zip +3 -0
- us_contracts.zip +3 -0
- us_legislation.zip +3 -0
README.md
CHANGED
@@ -1,3 +1,105 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
annotations_creators:
|
3 |
+
- no-annotation
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
license:
|
9 |
+
- cc-by-nc-sa-4.0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 1M<n<10M
|
14 |
+
source_datasets:
|
15 |
+
- extended
|
16 |
+
task_categories:
|
17 |
+
- text-generation
|
18 |
+
- fill-mask
|
19 |
+
task_ids:
|
20 |
+
- language-modeling
|
21 |
+
- masked-language-modeling
|
22 |
+
pretty_name: LexFiles
|
23 |
+
configs:
|
24 |
+
- eu_legislation
|
25 |
+
- eu_court_cases
|
26 |
+
- uk_legislation
|
27 |
+
- uk_court_cases
|
28 |
+
- us_legislation
|
29 |
+
- us_court_cases
|
30 |
+
- us_contracts
|
31 |
+
- canadian_legislation
|
32 |
+
- canadian_court_cases
|
33 |
+
- indian_court_cases
|
34 |
---
|
35 |
+
|
36 |
+
|
37 |
+
# Dataset Card for "LexFiles"
|
38 |
+
|
39 |
+
## Table of Contents
|
40 |
+
- [Dataset Description](#dataset-description)
|
41 |
+
- [Dataset Summary](#dataset-summary)
|
42 |
+
- [Dataset Specifications](#supported-tasks-and-leaderboards)
|
43 |
+
|
44 |
+
## Dataset Description
|
45 |
+
|
46 |
+
- **Homepage:** https://github.com/coastalcph/lexlms
|
47 |
+
- **Repository:** https://github.com/coastalcph/lexlms
|
48 |
+
- **Paper:** https://arxiv.org/abs/xxx
|
49 |
+
- **Point of Contact:** [Ilias Chalkidis](mailto:[email protected])
|
50 |
+
|
51 |
+
### Dataset Summary
|
52 |
+
|
53 |
+
The LeXFiles is a new diverse English multinational legal corpus that we created including 11 distinct sub-corpora that cover legislation and case law from 6 primarily English-speaking legal systems (EU, CoE, Canada, US, UK, India).
|
54 |
+
The corpus contains approx. 19 billion tokens. In comparison, the "Pile of Law" corpus released by Hendersons et al. (2022) comprises 32 billion in total, where the majority (26/30) of sub-corpora come from the United States of America (USA), hence the corpus as a whole is biased towards the US legal system in general, and the federal or state jurisdiction in particular, to a significant extent.
|
55 |
+
|
56 |
+
|
57 |
+
### Dataset Specifications
|
58 |
+
|
59 |
+
| Corpus | Corpus alias | Documents | Tokens | Pct. | Sampl. (a=0.5) | Sampl. (a=0.2) |
|
60 |
+
|-----------------------------------|----------------------|-----------|--------|--------|----------------|----------------|
|
61 |
+
| EU Legislation | `eu-legislation` | 93.7K | 233.7M | 1.2% | 5.0% | 8.0% |
|
62 |
+
| EU Court Decisions | `eu-court-cases` | 29.8K | 178.5M | 0.9% | 4.3% | 7.6% |
|
63 |
+
| ECtHR Decisions | `ecthr-cases` | 12.5K | 78.5M | 0.4% | 2.9% | 6.5% |
|
64 |
+
| UK Legislation | `uk-legislation` | 52.5K | 143.6M | 0.7% | 3.9% | 7.3% |
|
65 |
+
| UK Court Decisions | `uk-court-cases` | 47K | 368.4M | 1.9% | 6.2% | 8.8% |
|
66 |
+
| Indian Court Decisions | `indian-court-cases` | 34.8K | 111.6M | 0.6% | 3.4% | 6.9% |
|
67 |
+
| Canadian Legislation | `canadian-legislation` | 6K | 33.5M | 0.2% | 1.9% | 5.5% |
|
68 |
+
| Canadian Court Decisions | `canadian-court-cases` | 11.3K | 33.1M | 0.2% | 1.8% | 5.4% |
|
69 |
+
| U.S. Court Decisions [1] | `court-listener` | 4.6M | 11.4B | 59.2% | 34.7% | 17.5% |
|
70 |
+
| U.S. Legislation | `us-legislation` | 518 | 1.4B | 7.4% | 12.3% | 11.5% |
|
71 |
+
| U.S. Contracts | `us-contracts` | 622K | 5.3B | 27.3% | 23.6% | 15.0% |
|
72 |
+
| Total | `lexlms/lexfiles` | 5.8M | 18.8B | 100% | 100% | 100% |
|
73 |
+
|
74 |
+
[1] We consider only U.S. Court Decisions from 1965 onwards (cf. post Civil Rights Act), as a hard threshold for cases relying on severely out-dated and in many cases harmful law standards. The rest of the corpora include more recent documents.
|
75 |
+
|
76 |
+
[2] Sampling (Sampl.) ratios are computed following the exponential sampling introduced by Lample et al. (2019).
|
77 |
+
|
78 |
+
Additional corpora not considered for pre-training, since they do not represent factual legal knowledge.
|
79 |
+
|
80 |
+
| Corpus | Corpus alias | Documents | Tokens |
|
81 |
+
|----------------------------------------|------------------------|-----------|--------|
|
82 |
+
| Legal web pages from C4 | `legal-c4` | 284K | 340M |
|
83 |
+
|
84 |
+
|
85 |
+
### Citation
|
86 |
+
|
87 |
+
[*Ilias Chalkidis\*, Nicolas Garneau\*, Catalina E.C. Goanta, Daniel Martin Katz, and Anders Søgaard.*
|
88 |
+
*LeXFiles and LegalLAMA: Facilitating English Multinational Legal Language Model Development.*
|
89 |
+
*2022. In the Proceedings of the 61th Annual Meeting of the Association for Computational Linguistics. Toronto, Canada.*](https://aclanthology.org/xxx/)
|
90 |
+
```
|
91 |
+
@inproceedings{chalkidis-garneau-etal-2023-lexlms,
|
92 |
+
title = {{LeXFiles and LegalLAMA: Facilitating English Multinational Legal Language Model Development}},
|
93 |
+
author = "Chalkidis*, Ilias and
|
94 |
+
Garneau*, Nicolas and
|
95 |
+
Goanta, Catalina and
|
96 |
+
Katz, Daniel Martin and
|
97 |
+
Søgaard, Anders",
|
98 |
+
booktitle = "Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics",
|
99 |
+
month = june,
|
100 |
+
year = "2023",
|
101 |
+
address = "Toronto, Canada",
|
102 |
+
publisher = "Association for Computational Linguistics",
|
103 |
+
url = "https://aclanthology.org/xxx",
|
104 |
+
}
|
105 |
+
```
|
canadian_court_cases.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fe03037a94fd07c27416ae4a6dcc8a3960a02f21a0f4e4a2b2571b3efbdc2587
|
3 |
+
size 62545014
|
canadian_legislation.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f2fe1850a5437c199c96872beedaf7db031b027ea27bb673b25cced38f364d3f
|
3 |
+
size 40960387
|
ecthr_cases.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9958548f40eb022c41ec4575eeb2b02cc18893d0816f1c357318e38ba0a4b499
|
3 |
+
size 137058760
|
eurlex.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6ea014f773c745955743bef761b97fafc764fd5be156c58769e648629b28c3b1
|
3 |
+
size 641368792
|
indian_courts_cases.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79a8679a5af09071d4a125ff1718546d5e9b72d6a75c91975f8c5a1285de217d
|
3 |
+
size 190546540
|
lexfiles.py
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
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 |
+
"""LexFiles: English Multinational Legal Corpora"""
|
17 |
+
|
18 |
+
import datasets
|
19 |
+
import json
|
20 |
+
import os
|
21 |
+
|
22 |
+
logger = datasets.logging.get_logger(__name__)
|
23 |
+
|
24 |
+
_DESCRIPTION = """LexFiles: English Multinational Legal Corpora"""
|
25 |
+
|
26 |
+
_HOMEPAGE = "https://huggingface.co/lexlms"
|
27 |
+
|
28 |
+
_VERSION = "1.0.0"
|
29 |
+
|
30 |
+
|
31 |
+
class LexFilesConfig(datasets.BuilderConfig):
|
32 |
+
"""BuilderConfig for LexFiles Corpora"""
|
33 |
+
def __init__(self, url, **kwargs):
|
34 |
+
super(LexFilesConfig, self).__init__(**kwargs)
|
35 |
+
self.url = url
|
36 |
+
|
37 |
+
|
38 |
+
class LexFiles(datasets.GeneratorBasedBuilder):
|
39 |
+
"""
|
40 |
+
The Legal Pile
|
41 |
+
"""
|
42 |
+
|
43 |
+
VERSION = datasets.Version(_VERSION)
|
44 |
+
BUILDER_CONFIG_CLASS = LexFilesConfig
|
45 |
+
BUILDER_CONFIGS = [
|
46 |
+
LexFilesConfig(
|
47 |
+
name="eu-legislation",
|
48 |
+
description="EU Legislation",
|
49 |
+
version=datasets.Version(_VERSION, ""),
|
50 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/eurlex.zip'
|
51 |
+
),
|
52 |
+
LexFilesConfig(
|
53 |
+
name="eu-court-cases",
|
54 |
+
description="EU Court cases",
|
55 |
+
version=datasets.Version(_VERSION, ""),
|
56 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/eurlex.zip'
|
57 |
+
),
|
58 |
+
LexFilesConfig(
|
59 |
+
name="legal-c4",
|
60 |
+
description="Legal webpages extracted from C4",
|
61 |
+
version=datasets.Version(_VERSION, ""),
|
62 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles4/resolve/main/legal_c4.zip'
|
63 |
+
),
|
64 |
+
LexFilesConfig(
|
65 |
+
name="ecthr-cases",
|
66 |
+
description="ECtHR cases",
|
67 |
+
version=datasets.Version(_VERSION, ""),
|
68 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/ecthr_cases.zip'
|
69 |
+
),
|
70 |
+
LexFilesConfig(
|
71 |
+
name="uk-legislation",
|
72 |
+
description="UK Legislation",
|
73 |
+
version=datasets.Version(_VERSION, ""),
|
74 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/uk_legislation.zip'
|
75 |
+
),
|
76 |
+
LexFilesConfig(
|
77 |
+
name="uk-court-cases",
|
78 |
+
description="UK Court cases",
|
79 |
+
version=datasets.Version(_VERSION, ""),
|
80 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/uk_courts_cases.zip'
|
81 |
+
),
|
82 |
+
LexFilesConfig(
|
83 |
+
name="indian-court-cases",
|
84 |
+
description="Indian Court cases",
|
85 |
+
version=datasets.Version(_VERSION, ""),
|
86 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/indian_courts_cases.zip'
|
87 |
+
),
|
88 |
+
LexFilesConfig(
|
89 |
+
name="us-contracts",
|
90 |
+
description="US Contracts",
|
91 |
+
version=datasets.Version(_VERSION, ""),
|
92 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/us_contracts.zip'
|
93 |
+
),
|
94 |
+
LexFilesConfig(
|
95 |
+
name="us-court-cases",
|
96 |
+
description="US Court cases",
|
97 |
+
version=datasets.Version(_VERSION, ""),
|
98 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/courtlistener.zip'
|
99 |
+
),
|
100 |
+
LexFilesConfig(
|
101 |
+
name="us-legislation",
|
102 |
+
description="US Legislation",
|
103 |
+
version=datasets.Version(_VERSION, ""),
|
104 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/us_legislation.zip'
|
105 |
+
),
|
106 |
+
LexFilesConfig(
|
107 |
+
name="canadian-legislation",
|
108 |
+
description="Canadian Legislation",
|
109 |
+
version=datasets.Version(_VERSION, ""),
|
110 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/canadian_legislation.zip'
|
111 |
+
),
|
112 |
+
LexFilesConfig(
|
113 |
+
name="canadian-court-cases",
|
114 |
+
description="Canadian Legislation",
|
115 |
+
version=datasets.Version(_VERSION, ""),
|
116 |
+
url='https://huggingface.co/datasets/lexlms/lexfiles/resolve/main/canadian_court_cases.zip'
|
117 |
+
),
|
118 |
+
]
|
119 |
+
|
120 |
+
def _info(self):
|
121 |
+
features = datasets.Features(
|
122 |
+
{
|
123 |
+
"text": datasets.Value("string")
|
124 |
+
}
|
125 |
+
)
|
126 |
+
return datasets.DatasetInfo(
|
127 |
+
description=_DESCRIPTION,
|
128 |
+
features=features,
|
129 |
+
supervised_keys=None,
|
130 |
+
homepage=_HOMEPAGE,
|
131 |
+
)
|
132 |
+
|
133 |
+
def _split_generators(self, dl_manager):
|
134 |
+
data_dir = dl_manager.download_and_extract(self.config.url)
|
135 |
+
|
136 |
+
return [
|
137 |
+
datasets.SplitGenerator(
|
138 |
+
name=datasets.Split.TRAIN,
|
139 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "train.jsonl"), "split": 'train'},
|
140 |
+
),
|
141 |
+
datasets.SplitGenerator(
|
142 |
+
name=datasets.Split.VALIDATION,
|
143 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "validation.jsonl"), "split": 'validation'},
|
144 |
+
),
|
145 |
+
datasets.SplitGenerator(
|
146 |
+
name=datasets.Split.TEST,
|
147 |
+
gen_kwargs={"filepath": os.path.join(data_dir, "test.jsonl"), "split": 'test'},
|
148 |
+
),
|
149 |
+
]
|
150 |
+
|
151 |
+
def _generate_examples(self, filepath, split):
|
152 |
+
"""
|
153 |
+
Reads line by line samples and generates examples.
|
154 |
+
:param filepath: Path to jsonl files with line by line examples.
|
155 |
+
"""
|
156 |
+
logger.info("⏳ Generating examples from = %s", filepath)
|
157 |
+
if self.config.name in ['eu-court-cases', 'eu-legislation']:
|
158 |
+
with open(filepath, encoding="utf-8") as f:
|
159 |
+
for idx, row in enumerate(f):
|
160 |
+
data = json.loads(row)
|
161 |
+
if (self.config.name == 'eu-court-cases' and data['sector'] == "6") or \
|
162 |
+
(self.config.name == 'eu-legislation' and data['sector'] != "6"):
|
163 |
+
yield data["id"], {
|
164 |
+
"text": data["text"]
|
165 |
+
}
|
166 |
+
else:
|
167 |
+
with open(filepath, encoding="utf-8") as f:
|
168 |
+
for idx, row in enumerate(f):
|
169 |
+
data = json.loads(row)
|
170 |
+
yield f'{self.config.name}-{split}-{idx}', {
|
171 |
+
"text": data["text"]
|
172 |
+
}
|
uk_courts_cases.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fae5cb016441995cdba7b97a79019f36972f969a493c56c10d70732c8d51fee2
|
3 |
+
size 664414879
|
uk_legislation.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0d629d2112af5c96b1b958cb93108e407267700d708d949a624ed15d5b21624a
|
3 |
+
size 188225643
|
us_contracts.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bf7cdfa11b1486172e414f6c67b96e6a3cb6ad0f007c22aa196f5410d6725fc1
|
3 |
+
size 9199749156
|
us_legislation.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1edaf954f8710a8f9968f77d893f4618bed7322ffb01e3a66b6a49ad977ada7c
|
3 |
+
size 2057666243
|