joelniklaus commited on
Commit
9b90a85
1 Parent(s): f5a601e

added dataset card, creation script and data loader

Browse files
Files changed (3) hide show
  1. MultiLegalPileWikipediaFiltered.py +156 -0
  2. README.md +592 -0
  3. prepare_legal_data.py +195 -0
MultiLegalPileWikipediaFiltered.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """MultiLegalPileWikipediaFiltered"""
2
+
3
+ import json
4
+
5
+ import datasets
6
+ from huggingface_hub.file_download import hf_hub_url
7
+
8
+ try:
9
+ import lzma as xz
10
+ except ImportError:
11
+ import pylzma as xz
12
+
13
+ datasets.logging.set_verbosity_info()
14
+ logger = datasets.logging.get_logger(__name__)
15
+
16
+ _CITATION = """
17
+ """
18
+
19
+ _DESCRIPTION = """
20
+ A filtered version of the MultiLegalPile dataset, together with wikipedia articles.
21
+ """
22
+
23
+ _REPO_ID = "joelito/MultiLegalPileWikipediaFiltered"
24
+ _URL = f"https://huggingface.co/datasets/{_REPO_ID}"
25
+
26
+ _LANGUAGES = ["bg", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "ga", "hr",
27
+ "hu", "it", "lt", "lv", "mt", "nl", "pl", "pt", "ro", "sk", "sl", "sv"]
28
+
29
+ CASELAW = "caselaw"
30
+ CONTRACTS = "contracts"
31
+ LEGISLATION = "legislation"
32
+ OTHER = "other"
33
+ WIKIPEDIA = "wikipedia"
34
+ _TYPES = [CASELAW, CONTRACTS, LEGISLATION, OTHER, WIKIPEDIA]
35
+
36
+ _JURISDICTONS = ["Austria", "Belgium", "Bulgaria", "Croatia", "Czechia", "Denmark", "Estonia", "Finland",
37
+ "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg",
38
+ "Malta", "Netherlands", "Poland", "Portugal", "Romania", "Slovakia", "Slovenia", "Spain", "Sweden",
39
+ "EU", "Switzerland", "UK", "US", "Canada", "N/A"]
40
+
41
+ # 1 is standard for most languages, types
42
+ NUMBER_OF_SHARDS = {lang: {type: 1 for type in _TYPES} for lang in _LANGUAGES}
43
+ for lang in _LANGUAGES:
44
+ NUMBER_OF_SHARDS[lang][OTHER] = 0 # no other data for most languages
45
+ NUMBER_OF_SHARDS["en"][OTHER] = 15 # 15 other files for English
46
+
47
+ NUMBER_OF_SHARDS["cs"][CASELAW] = 2
48
+ NUMBER_OF_SHARDS["da"][LEGISLATION] = 2
49
+ NUMBER_OF_SHARDS["de"][CASELAW] = 5
50
+ NUMBER_OF_SHARDS["de"][LEGISLATION] = 2
51
+ NUMBER_OF_SHARDS["de"][WIKIPEDIA] = 5
52
+ NUMBER_OF_SHARDS["el"][LEGISLATION] = 2
53
+ NUMBER_OF_SHARDS["en"][CASELAW] = 66
54
+ NUMBER_OF_SHARDS["en"][CONTRACTS] = 16
55
+ NUMBER_OF_SHARDS["en"][LEGISLATION] = 5
56
+ NUMBER_OF_SHARDS["en"][WIKIPEDIA] = 11
57
+ NUMBER_OF_SHARDS["es"][WIKIPEDIA] = 3
58
+ NUMBER_OF_SHARDS["fr"][CASELAW] = 3
59
+ NUMBER_OF_SHARDS["fr"][LEGISLATION] = 2
60
+ NUMBER_OF_SHARDS["fr"][WIKIPEDIA] = 4
61
+ NUMBER_OF_SHARDS["ga"][CASELAW] = 0
62
+ NUMBER_OF_SHARDS["ga"][CONTRACTS] = 0
63
+ NUMBER_OF_SHARDS["it"][LEGISLATION] = 2
64
+ NUMBER_OF_SHARDS["it"][WIKIPEDIA] = 3
65
+ NUMBER_OF_SHARDS["nl"][LEGISLATION] = 2
66
+ NUMBER_OF_SHARDS["nl"][WIKIPEDIA] = 2
67
+ NUMBER_OF_SHARDS["pl"][WIKIPEDIA] = 2
68
+ NUMBER_OF_SHARDS["pt"][CASELAW] = 24
69
+ NUMBER_OF_SHARDS["pt"][WIKIPEDIA] = 2
70
+ NUMBER_OF_SHARDS["ro"][LEGISLATION] = 2
71
+
72
+
73
+ class MultiLegalPileWikipediaFilteredConfig(datasets.BuilderConfig):
74
+ """BuilderConfig for MultiLegalPileWikipediaFiltered."""
75
+
76
+ def __init__(self, name: str, **kwargs):
77
+ """BuilderConfig for MultiLegalPileWikipediaFiltered.
78
+ Args:
79
+ name: combination of language and type with _
80
+ language: One of bg,cs,da,de,el,en,es,et,fi,fr,ga,hr,hu,it,lt,lv,mt,nl,pl,pt,ro,sk,sl,sv or all
81
+ type: One of caselaw,contracts,legislation,other,wikipedia or all
82
+ **kwargs: keyword arguments forwarded to super.
83
+ """
84
+ super(MultiLegalPileWikipediaFilteredConfig, self).__init__(**kwargs)
85
+ self.name = name
86
+ self.language = name.split("_")[0]
87
+ self.type = name.split("_")[1]
88
+
89
+
90
+ class MultiLegalPileWikipediaFiltered(datasets.GeneratorBasedBuilder):
91
+ """
92
+ MultiLegalPileWikipediaFiltered:
93
+ A filtered dataset of multilingual legal data and wikipedias in the EU languages
94
+ """
95
+ BUILDER_CONFIG_CLASS = MultiLegalPileWikipediaFilteredConfig
96
+
97
+ BUILDER_CONFIGS = [MultiLegalPileWikipediaFilteredConfig(f"{language}_{type}")
98
+ for type in _TYPES + ["all"]
99
+ for language in _LANGUAGES + ["all"]]
100
+
101
+ def _info(self):
102
+ return datasets.DatasetInfo(
103
+ description=_DESCRIPTION,
104
+ features=datasets.Features(
105
+ {
106
+ "language": datasets.Value("string"), # one of _LANGUAGES
107
+ "type": datasets.Value("string"), # one of _TYPES
108
+ "jurisdiction": datasets.Value("string"), # one of _JURISDICTONS
109
+ "text": datasets.Value("string"),
110
+ }
111
+ ),
112
+ supervised_keys=None,
113
+ homepage=_URL,
114
+ citation=_CITATION,
115
+ )
116
+
117
+ def _split_generators(self, dl_manager):
118
+ def download_url(file_name):
119
+ url = hf_hub_url(repo_id=_REPO_ID, filename=f"data/{file_name}.jsonl.xz", repo_type="dataset")
120
+ return dl_manager.download(url)
121
+
122
+ languages = _LANGUAGES if self.config.language == "all" else [self.config.language]
123
+ types = _TYPES if self.config.type == "all" else [self.config.type]
124
+
125
+ split_generators = []
126
+ for split in [datasets.Split.TRAIN, datasets.Split.VALIDATION]:
127
+ filepaths = []
128
+ for language in languages:
129
+ for type in types:
130
+ max_num_shards = NUMBER_OF_SHARDS[language][type] if split == datasets.Split.TRAIN else 1
131
+ for shard in range(max_num_shards):
132
+ try:
133
+ url = download_url(f"{language}_{type}_{split}.{shard}")
134
+ filepaths.append(url)
135
+ except Exception:
136
+ logger.exception(f"Error while processing url {url}")
137
+ split_generators.append(
138
+ datasets.SplitGenerator(name=split, gen_kwargs={"filepaths": filepaths})
139
+ )
140
+ return split_generators
141
+
142
+ def _generate_examples(self, filepaths):
143
+ """This function returns the examples in the raw (text) form by iterating on all the files."""
144
+ id_ = 0
145
+ for filepath in filepaths:
146
+ logger.info(f"Generating examples from = {filepath}", )
147
+ try:
148
+ with xz.open(open(filepath, "rb"), "rt", encoding="utf-8") as f:
149
+ for line in f:
150
+ if line:
151
+ example = json.loads(line)
152
+ if example is not None and isinstance(example, dict):
153
+ yield id_, example
154
+ id_ += 1
155
+ except Exception:
156
+ logger.exception(f"Error while processing file {filepath}")
README.md ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - other
4
+ language_creators:
5
+ - found
6
+ language:
7
+ - bg
8
+ - cs
9
+ - da
10
+ - de
11
+ - el
12
+ - en
13
+ - es
14
+ - et
15
+ - fi
16
+ - fr
17
+ - ga
18
+ - hr
19
+ - hu
20
+ - it
21
+ - lt
22
+ - lv
23
+ - mt
24
+ - nl
25
+ - pl
26
+ - pt
27
+ - ro
28
+ - sk
29
+ - sl
30
+ - sv
31
+ license:
32
+ - cc-by-4.0
33
+ multilinguality:
34
+ - multilingual
35
+ paperswithcode_id: null
36
+ pretty_name: "MultiLegalPileWikipediaFiltered: A filtered version of the MultiLegalPile dataset, together with wikipedia articles."
37
+ size_categories:
38
+ - 10M<n<100M
39
+ source_datasets:
40
+ - original
41
+ task_categories:
42
+ - fill-mask
43
+
44
+ ---
45
+
46
+ # Dataset Card for MultiLegalPileWikipediaFiltered: A filtered version of the MultiLegalPile dataset, together with wikipedia articles
47
+
48
+ ## Table of Contents
49
+
50
+ - [Table of Contents](#table-of-contents)
51
+ - [Dataset Description](#dataset-description)
52
+ - [Dataset Summary](#dataset-summary)
53
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
54
+ - [Languages](#languages)
55
+ - [Dataset Structure](#dataset-structure)
56
+ - [Data Instances](#data-instances)
57
+ - [Data Fields](#data-fields)
58
+ - [Data Splits](#data-splits)
59
+ - [Dataset Creation](#dataset-creation)
60
+ - [Curation Rationale](#curation-rationale)
61
+ - [Source Data](#source-data)
62
+ - [Annotations](#annotations)
63
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
64
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
65
+ - [Social Impact of Dataset](#social-impact-of-dataset)
66
+ - [Discussion of Biases](#discussion-of-biases)
67
+ - [Other Known Limitations](#other-known-limitations)
68
+ - [Additional Information](#additional-information)
69
+ - [Dataset Curators](#dataset-curators)
70
+ - [Licensing Information](#licensing-information)
71
+ - [Citation Information](#citation-information)
72
+ - [Contributions](#contributions)
73
+
74
+ ## Dataset Description
75
+
76
+ - **Homepage:**
77
+ - **Repository:**
78
+ - **Paper:**
79
+ - **Leaderboard:**
80
+ - **Point of Contact:** [Joel Niklaus](mailto:joel.niklaus.2@bfh.ch)
81
+
82
+ ### Dataset Summary
83
+
84
+ The Multi_Legal_Pile is a large-scale multilingual legal dataset suited for pretraining language models.
85
+ It spans over 24 languages and four legal text types.
86
+
87
+ ### Supported Tasks and Leaderboards
88
+
89
+ The dataset supports the tasks of fill-mask.
90
+
91
+ ### Languages
92
+
93
+ The following languages are supported:
94
+ bg, cs, da, de, el, en, es, et, fi, fr, ga, hr, hu, it, lt, lv, mt, nl, pl, pt, ro, sk, sl, sv
95
+
96
+ ## Dataset Structure
97
+
98
+ It is structured in the following format: {language}_{text_type}_{shard}.jsonl.xz
99
+
100
+ text_type is one of the following:
101
+
102
+ - caselaw
103
+ - contracts
104
+ - legislation
105
+ - other
106
+ - wikipedia
107
+
108
+
109
+ Use the dataset like this:
110
+ ```python
111
+ from datasets import load_dataset
112
+
113
+ config = 'en_contracts' # {language}_{text_type}
114
+ dataset = load_dataset('joelito/Multi_Legal_Pile', config, split='train', streaming=True)
115
+ ```
116
+
117
+ 'config' is a combination of language and text_type, e.g. 'en_contracts' or 'de_caselaw'.
118
+ To load all the languages or all the text_types, use 'all' instead of the language or text_type (e.g., '
119
+ all_legislation').
120
+
121
+ ### Data Instances
122
+
123
+ The file format is jsonl.xz and there is a `train` and `validation` split available.
124
+ Since some configurations are very small or non-existent, they might not contain a train split or not be present at all.
125
+
126
+ The complete dataset consists of five large subsets:
127
+ - [Native Multi Legal Pile](https://huggingface.co/datasets/joelito/Multi_Legal_Pile)
128
+ - [Eurlex Resources](https://huggingface.co/datasets/joelito/eurlex_resources)
129
+ - [MC4 Legal](https://huggingface.co/datasets/joelito/mc4_legal)
130
+ - [Pile of Law](https://huggingface.co/datasets/pile-of-law/pile-of-law)
131
+ - [EU Wikipedias](https://huggingface.co/datasets/joelito/EU_Wikipedias)
132
+
133
+ ### Data Fields
134
+
135
+ [More Information Needed]
136
+
137
+ ### Data Splits
138
+
139
+ There are two splits: train and validation. The validation split contains 1000 examples and the training split contains the rest of the data.
140
+
141
+ #### Data Size
142
+
143
+ ```bash
144
+ $ xz --list data/*.xz
145
+ Strms Blocks Compressed Uncompressed Ratio Check Filename
146
+ 1 1 167.6 MiB 3’276.3 MiB 0.051 CRC64 data/bg_caselaw_train.0.jsonl.xz
147
+ 1 1 502.3 KiB 9’398.0 KiB 0.053 CRC64 data/bg_caselaw_validation.0.jsonl.xz
148
+ 1 1 33.4 MiB 700.3 MiB 0.048 CRC64 data/bg_contracts_train.0.jsonl.xz
149
+ 1 1 5’989.6 KiB 123.0 MiB 0.048 CRC64 data/bg_contracts_validation.0.jsonl.xz
150
+ 1 1 418.5 MiB 8’931.0 MiB 0.047 CRC64 data/bg_legislation_train.0.jsonl.xz
151
+ 1 1 5’029.4 KiB 103.1 MiB 0.048 CRC64 data/bg_legislation_validation.0.jsonl.xz
152
+ 1 0 32 B 0 B --- CRC64 data/bg_other_validation.0.jsonl.xz
153
+ 1 1 192.2 MiB 2’488.6 MiB 0.077 CRC64 data/bg_wikipedia_train.0.jsonl.xz
154
+ 1 1 1’757.8 KiB 22.9 MiB 0.075 CRC64 data/bg_wikipedia_validation.0.jsonl.xz
155
+ 1 1 476.9 MiB 4’126.1 MiB 0.116 CRC64 data/cs_caselaw_train.0.jsonl.xz
156
+ 1 1 259.8 MiB 2’556.9 MiB 0.102 CRC64 data/cs_caselaw_train.1.jsonl.xz
157
+ 1 1 420.1 KiB 3’370.3 KiB 0.125 CRC64 data/cs_caselaw_validation.0.jsonl.xz
158
+ 1 1 24.9 MiB 237.9 MiB 0.105 CRC64 data/cs_contracts_train.0.jsonl.xz
159
+ 1 1 4’412.1 KiB 41.7 MiB 0.103 CRC64 data/cs_contracts_validation.0.jsonl.xz
160
+ 1 1 361.2 MiB 3’488.9 MiB 0.104 CRC64 data/cs_legislation_train.0.jsonl.xz
161
+ 1 1 10.3 MiB 91.6 MiB 0.112 CRC64 data/cs_legislation_validation.0.jsonl.xz
162
+ 1 0 32 B 0 B --- CRC64 data/cs_other_validation.0.jsonl.xz
163
+ 1 1 390.6 MiB 1’939.4 MiB 0.201 CRC64 data/cs_wikipedia_train.0.jsonl.xz
164
+ 1 1 2’604.7 KiB 12.2 MiB 0.209 CRC64 data/cs_wikipedia_validation.0.jsonl.xz
165
+ 1 1 252.5 MiB 1’529.7 MiB 0.165 CRC64 data/da_caselaw_train.0.jsonl.xz
166
+ 1 1 555.9 KiB 3’227.1 KiB 0.172 CRC64 data/da_caselaw_validation.0.jsonl.xz
167
+ 1 1 30.1 MiB 233.9 MiB 0.129 CRC64 data/da_contracts_train.0.jsonl.xz
168
+ 1 1 2’897.6 KiB 23.6 MiB 0.120 CRC64 data/da_contracts_validation.0.jsonl.xz
169
+ 1 1 476.9 MiB 3’325.8 MiB 0.143 CRC64 data/da_legislation_train.0.jsonl.xz
170
+ 1 1 237.3 MiB 1’444.5 MiB 0.164 CRC64 data/da_legislation_train.1.jsonl.xz
171
+ 1 1 3’232.5 KiB 60.6 MiB 0.052 CRC64 data/da_legislation_validation.0.jsonl.xz
172
+ 1 0 32 B 0 B --- CRC64 data/da_other_validation.0.jsonl.xz
173
+ 1 1 128.8 MiB 512.1 MiB 0.252 CRC64 data/da_wikipedia_train.0.jsonl.xz
174
+ 1 1 1’514.1 KiB 5’476.3 KiB 0.276 CRC64 data/da_wikipedia_validation.0.jsonl.xz
175
+ 1 1 476.9 MiB 2’803.8 MiB 0.170 CRC64 data/de_caselaw_train.0.jsonl.xz
176
+ 1 1 476.9 MiB 2’821.4 MiB 0.169 CRC64 data/de_caselaw_train.1.jsonl.xz
177
+ 1 1 476.9 MiB 2’720.2 MiB 0.175 CRC64 data/de_caselaw_train.2.jsonl.xz
178
+ 1 1 476.9 MiB 2’704.1 MiB 0.176 CRC64 data/de_caselaw_train.3.jsonl.xz
179
+ 1 1 460.5 MiB 2’504.5 MiB 0.184 CRC64 data/de_caselaw_train.4.jsonl.xz
180
+ 1 1 594.0 KiB 3’416.4 KiB 0.174 CRC64 data/de_caselaw_validation.0.jsonl.xz
181
+ 1 1 32.0 MiB 255.8 MiB 0.125 CRC64 data/de_contracts_train.0.jsonl.xz
182
+ 1 1 3’037.7 KiB 24.7 MiB 0.120 CRC64 data/de_contracts_validation.0.jsonl.xz
183
+ 1 1 476.9 MiB 3’386.0 MiB 0.141 CRC64 data/de_legislation_train.0.jsonl.xz
184
+ 1 1 93.3 MiB 592.3 MiB 0.158 CRC64 data/de_legislation_train.1.jsonl.xz
185
+ 1 1 3’265.9 KiB 20.5 MiB 0.156 CRC64 data/de_legislation_validation.0.jsonl.xz
186
+ 1 0 32 B 0 B --- CRC64 data/de_other_validation.0.jsonl.xz
187
+ 1 1 476.9 MiB 1’883.7 MiB 0.253 CRC64 data/de_wikipedia_train.0.jsonl.xz
188
+ 1 1 476.9 MiB 1’891.6 MiB 0.252 CRC64 data/de_wikipedia_train.1.jsonl.xz
189
+ 1 1 476.9 MiB 1’893.7 MiB 0.252 CRC64 data/de_wikipedia_train.2.jsonl.xz
190
+ 1 1 476.9 MiB 1’894.1 MiB 0.252 CRC64 data/de_wikipedia_train.3.jsonl.xz
191
+ 1 1 407.9 MiB 1’622.0 MiB 0.251 CRC64 data/de_wikipedia_train.4.jsonl.xz
192
+ 1 1 1’172.5 KiB 4’210.2 KiB 0.278 CRC64 data/de_wikipedia_validation.0.jsonl.xz
193
+ 1 1 344.7 MiB 6’908.3 MiB 0.050 CRC64 data/el_caselaw_train.0.jsonl.xz
194
+ 1 1 870.4 KiB 14.3 MiB 0.060 CRC64 data/el_caselaw_validation.0.jsonl.xz
195
+ 1 1 49.7 MiB 1’083.8 MiB 0.046 CRC64 data/el_contracts_train.0.jsonl.xz
196
+ 1 1 4’701.3 KiB 101.6 MiB 0.045 CRC64 data/el_contracts_validation.0.jsonl.xz
197
+ 1 1 476.9 MiB 10.2 GiB 0.046 CRC64 data/el_legislation_train.0.jsonl.xz
198
+ 1 1 203.0 MiB 3’994.0 MiB 0.051 CRC64 data/el_legislation_train.1.jsonl.xz
199
+ 1 1 9’744.3 KiB 186.6 MiB 0.051 CRC64 data/el_legislation_validation.0.jsonl.xz
200
+ 1 0 32 B 0 B --- CRC64 data/el_other_validation.0.jsonl.xz
201
+ 1 1 246.4 MiB 3’465.7 MiB 0.071 CRC64 data/el_wikipedia_train.0.jsonl.xz
202
+ 1 1 2’591.7 KiB 35.6 MiB 0.071 CRC64 data/el_wikipedia_validation.0.jsonl.xz
203
+ 1 1 476.9 MiB 2’188.6 MiB 0.218 CRC64 data/en_caselaw_train.0.jsonl.xz
204
+ 1 1 476.9 MiB 2’416.1 MiB 0.197 CRC64 data/en_caselaw_train.10.jsonl.xz
205
+ 1 1 477.2 MiB 2’688.1 MiB 0.178 CRC64 data/en_caselaw_train.11.jsonl.xz
206
+ 1 1 476.9 MiB 2’865.9 MiB 0.166 CRC64 data/en_caselaw_train.12.jsonl.xz
207
+ 1 1 476.9 MiB 2’494.1 MiB 0.191 CRC64 data/en_caselaw_train.13.jsonl.xz
208
+ 1 1 476.9 MiB 2’126.6 MiB 0.224 CRC64 data/en_caselaw_train.14.jsonl.xz
209
+ 1 1 476.9 MiB 2’440.9 MiB 0.195 CRC64 data/en_caselaw_train.15.jsonl.xz
210
+ 1 1 476.9 MiB 3���822.2 MiB 0.125 CRC64 data/en_caselaw_train.16.jsonl.xz
211
+ 1 1 476.9 MiB 3’831.4 MiB 0.124 CRC64 data/en_caselaw_train.17.jsonl.xz
212
+ 1 1 476.9 MiB 3’812.2 MiB 0.125 CRC64 data/en_caselaw_train.18.jsonl.xz
213
+ 1 1 476.9 MiB 2’233.5 MiB 0.214 CRC64 data/en_caselaw_train.19.jsonl.xz
214
+ 1 1 476.9 MiB 2’195.9 MiB 0.217 CRC64 data/en_caselaw_train.1.jsonl.xz
215
+ 1 1 476.9 MiB 2’185.8 MiB 0.218 CRC64 data/en_caselaw_train.20.jsonl.xz
216
+ 1 1 476.9 MiB 2’634.9 MiB 0.181 CRC64 data/en_caselaw_train.21.jsonl.xz
217
+ 1 1 476.9 MiB 2’670.8 MiB 0.179 CRC64 data/en_caselaw_train.22.jsonl.xz
218
+ 1 1 476.9 MiB 2’762.0 MiB 0.173 CRC64 data/en_caselaw_train.23.jsonl.xz
219
+ 1 1 476.9 MiB 2’153.6 MiB 0.221 CRC64 data/en_caselaw_train.24.jsonl.xz
220
+ 1 1 476.9 MiB 2’152.0 MiB 0.222 CRC64 data/en_caselaw_train.25.jsonl.xz
221
+ 1 1 476.9 MiB 2’205.0 MiB 0.216 CRC64 data/en_caselaw_train.26.jsonl.xz
222
+ 1 1 476.9 MiB 2’141.0 MiB 0.223 CRC64 data/en_caselaw_train.27.jsonl.xz
223
+ 1 1 476.9 MiB 2’145.1 MiB 0.222 CRC64 data/en_caselaw_train.28.jsonl.xz
224
+ 1 1 476.9 MiB 2’137.9 MiB 0.223 CRC64 data/en_caselaw_train.29.jsonl.xz
225
+ 1 1 476.9 MiB 2’189.0 MiB 0.218 CRC64 data/en_caselaw_train.2.jsonl.xz
226
+ 1 1 476.9 MiB 2’150.9 MiB 0.222 CRC64 data/en_caselaw_train.30.jsonl.xz
227
+ 1 1 476.9 MiB 2’142.7 MiB 0.223 CRC64 data/en_caselaw_train.31.jsonl.xz
228
+ 1 1 476.9 MiB 2’203.4 MiB 0.216 CRC64 data/en_caselaw_train.32.jsonl.xz
229
+ 1 1 476.9 MiB 2’205.4 MiB 0.216 CRC64 data/en_caselaw_train.33.jsonl.xz
230
+ 1 1 476.9 MiB 2’206.0 MiB 0.216 CRC64 data/en_caselaw_train.34.jsonl.xz
231
+ 1 1 476.9 MiB 2’164.9 MiB 0.220 CRC64 data/en_caselaw_train.35.jsonl.xz
232
+ 1 1 476.9 MiB 2’810.3 MiB 0.170 CRC64 data/en_caselaw_train.36.jsonl.xz
233
+ 1 1 476.9 MiB 2’854.1 MiB 0.167 CRC64 data/en_caselaw_train.37.jsonl.xz
234
+ 1 1 476.9 MiB 3’109.2 MiB 0.153 CRC64 data/en_caselaw_train.38.jsonl.xz
235
+ 1 1 476.9 MiB 3’323.6 MiB 0.143 CRC64 data/en_caselaw_train.39.jsonl.xz
236
+ 1 1 476.9 MiB 2’155.3 MiB 0.221 CRC64 data/en_caselaw_train.3.jsonl.xz
237
+ 1 1 476.9 MiB 2’881.5 MiB 0.165 CRC64 data/en_caselaw_train.40.jsonl.xz
238
+ 1 1 476.9 MiB 2’157.1 MiB 0.221 CRC64 data/en_caselaw_train.41.jsonl.xz
239
+ 1 1 477.0 MiB 2’530.2 MiB 0.189 CRC64 data/en_caselaw_train.42.jsonl.xz
240
+ 1 1 476.8 MiB 2’540.1 MiB 0.188 CRC64 data/en_caselaw_train.43.jsonl.xz
241
+ 1 1 476.9 MiB 2’182.2 MiB 0.219 CRC64 data/en_caselaw_train.44.jsonl.xz
242
+ 1 1 476.9 MiB 2’163.2 MiB 0.220 CRC64 data/en_caselaw_train.45.jsonl.xz
243
+ 1 1 476.9 MiB 2’213.3 MiB 0.215 CRC64 data/en_caselaw_train.46.jsonl.xz
244
+ 1 1 476.9 MiB 2’241.5 MiB 0.213 CRC64 data/en_caselaw_train.47.jsonl.xz
245
+ 1 1 476.9 MiB 2’203.6 MiB 0.216 CRC64 data/en_caselaw_train.48.jsonl.xz
246
+ 1 1 476.9 MiB 2’480.6 MiB 0.192 CRC64 data/en_caselaw_train.49.jsonl.xz
247
+ 1 1 476.9 MiB 2’176.7 MiB 0.219 CRC64 data/en_caselaw_train.4.jsonl.xz
248
+ 1 1 476.9 MiB 2’214.7 MiB 0.215 CRC64 data/en_caselaw_train.50.jsonl.xz
249
+ 1 1 476.9 MiB 2’128.0 MiB 0.224 CRC64 data/en_caselaw_train.51.jsonl.xz
250
+ 1 1 476.9 MiB 2’151.0 MiB 0.222 CRC64 data/en_caselaw_train.52.jsonl.xz
251
+ 1 1 476.9 MiB 2’173.6 MiB 0.219 CRC64 data/en_caselaw_train.53.jsonl.xz
252
+ 1 1 476.9 MiB 2’773.8 MiB 0.172 CRC64 data/en_caselaw_train.54.jsonl.xz
253
+ 1 1 476.9 MiB 2’806.2 MiB 0.170 CRC64 data/en_caselaw_train.55.jsonl.xz
254
+ 1 1 476.9 MiB 3’920.9 MiB 0.122 CRC64 data/en_caselaw_train.56.jsonl.xz
255
+ 1 1 476.9 MiB 2’517.2 MiB 0.189 CRC64 data/en_caselaw_train.57.jsonl.xz
256
+ 1 1 477.5 MiB 2’844.0 MiB 0.168 CRC64 data/en_caselaw_train.58.jsonl.xz
257
+ 1 1 476.9 MiB 2’810.7 MiB 0.170 CRC64 data/en_caselaw_train.59.jsonl.xz
258
+ 1 1 476.9 MiB 2’160.4 MiB 0.221 CRC64 data/en_caselaw_train.5.jsonl.xz
259
+ 1 1 476.9 MiB 3’033.0 MiB 0.157 CRC64 data/en_caselaw_train.60.jsonl.xz
260
+ 1 1 476.9 MiB 2’255.1 MiB 0.211 CRC64 data/en_caselaw_train.61.jsonl.xz
261
+ 1 1 476.9 MiB 2’110.1 MiB 0.226 CRC64 data/en_caselaw_train.62.jsonl.xz
262
+ 1 1 476.9 MiB 2’130.3 MiB 0.224 CRC64 data/en_caselaw_train.63.jsonl.xz
263
+ 1 1 476.9 MiB 2’133.2 MiB 0.224 CRC64 data/en_caselaw_train.64.jsonl.xz
264
+ 1 1 44.8 MiB 199.6 MiB 0.225 CRC64 data/en_caselaw_train.65.jsonl.xz
265
+ 1 1 476.9 MiB 2’153.3 MiB 0.221 CRC64 data/en_caselaw_train.6.jsonl.xz
266
+ 1 1 476.9 MiB 2’130.8 MiB 0.224 CRC64 data/en_caselaw_train.7.jsonl.xz
267
+ 1 1 476.9 MiB 2’152.2 MiB 0.222 CRC64 data/en_caselaw_train.8.jsonl.xz
268
+ 1 1 476.9 MiB 2’173.3 MiB 0.219 CRC64 data/en_caselaw_train.9.jsonl.xz
269
+ 1 1 2’977.4 KiB 12.9 MiB 0.226 CRC64 data/en_caselaw_validation.0.jsonl.xz
270
+ 1 1 476.9 MiB 3’016.6 MiB 0.158 CRC64 data/en_contracts_train.0.jsonl.xz
271
+ 1 1 476.9 MiB 3’015.3 MiB 0.158 CRC64 data/en_contracts_train.10.jsonl.xz
272
+ 1 1 476.9 MiB 3’012.5 MiB 0.158 CRC64 data/en_contracts_train.11.jsonl.xz
273
+ 1 1 477.0 MiB 3’002.5 MiB 0.159 CRC64 data/en_contracts_train.12.jsonl.xz
274
+ 1 1 476.9 MiB 2’962.4 MiB 0.161 CRC64 data/en_contracts_train.13.jsonl.xz
275
+ 1 1 476.9 MiB 3’019.4 MiB 0.158 CRC64 data/en_contracts_train.14.jsonl.xz
276
+ 1 1 124.1 MiB 781.2 MiB 0.159 CRC64 data/en_contracts_train.15.jsonl.xz
277
+ 1 1 476.9 MiB 2’994.0 MiB 0.159 CRC64 data/en_contracts_train.1.jsonl.xz
278
+ 1 1 476.8 MiB 3’084.9 MiB 0.155 CRC64 data/en_contracts_train.2.jsonl.xz
279
+ 1 1 476.9 MiB 3’123.4 MiB 0.153 CRC64 data/en_contracts_train.3.jsonl.xz
280
+ 1 1 476.9 MiB 3’120.7 MiB 0.153 CRC64 data/en_contracts_train.4.jsonl.xz
281
+ 1 1 477.0 MiB 3’094.2 MiB 0.154 CRC64 data/en_contracts_train.5.jsonl.xz
282
+ 1 1 476.9 MiB 3’010.9 MiB 0.158 CRC64 data/en_contracts_train.6.jsonl.xz
283
+ 1 1 476.9 MiB 3’015.0 MiB 0.158 CRC64 data/en_contracts_train.7.jsonl.xz
284
+ 1 1 476.9 MiB 2’995.7 MiB 0.159 CRC64 data/en_contracts_train.8.jsonl.xz
285
+ 1 1 476.9 MiB 3’017.9 MiB 0.158 CRC64 data/en_contracts_train.9.jsonl.xz
286
+ 1 1 9’980.4 KiB 63.7 MiB 0.153 CRC64 data/en_contracts_validation.0.jsonl.xz
287
+ 1 1 476.9 MiB 3’040.8 MiB 0.157 CRC64 data/en_legislation_train.0.jsonl.xz
288
+ 1 1 476.9 MiB 3’047.3 MiB 0.156 CRC64 data/en_legislation_train.1.jsonl.xz
289
+ 1 1 476.9 MiB 3’351.5 MiB 0.142 CRC64 data/en_legislation_train.2.jsonl.xz
290
+ 1 1 478.7 MiB 3’408.4 MiB 0.140 CRC64 data/en_legislation_train.3.jsonl.xz
291
+ 1 1 372.5 MiB 2’620.0 MiB 0.142 CRC64 data/en_legislation_train.4.jsonl.xz
292
+ 1 1 2’733.5 KiB 13.8 MiB 0.193 CRC64 data/en_legislation_validation.0.jsonl.xz
293
+ 1 1 476.9 MiB 4’782.4 MiB 0.100 CRC64 data/en_other_train.0.jsonl.xz
294
+ 1 1 476.9 MiB 4’347.1 MiB 0.110 CRC64 data/en_other_train.10.jsonl.xz
295
+ 1 1 477.1 MiB 3’044.6 MiB 0.157 CRC64 data/en_other_train.11.jsonl.xz
296
+ 1 1 477.1 MiB 2’147.8 MiB 0.222 CRC64 data/en_other_train.12.jsonl.xz
297
+ 1 1 477.0 MiB 2’182.8 MiB 0.219 CRC64 data/en_other_train.13.jsonl.xz
298
+ 1 1 33.3 MiB 151.7 MiB 0.219 CRC64 data/en_other_train.14.jsonl.xz
299
+ 1 1 476.9 MiB 4’883.8 MiB 0.098 CRC64 data/en_other_train.1.jsonl.xz
300
+ 1 1 476.9 MiB 4’646.7 MiB 0.103 CRC64 data/en_other_train.2.jsonl.xz
301
+ 1 1 476.9 MiB 4’542.8 MiB 0.105 CRC64 data/en_other_train.3.jsonl.xz
302
+ 1 1 476.9 MiB 4’574.8 MiB 0.104 CRC64 data/en_other_train.4.jsonl.xz
303
+ 1 1 476.9 MiB 4’622.5 MiB 0.103 CRC64 data/en_other_train.5.jsonl.xz
304
+ 1 1 476.9 MiB 4’520.7 MiB 0.105 CRC64 data/en_other_train.6.jsonl.xz
305
+ 1 1 476.9 MiB 2’942.4 MiB 0.162 CRC64 data/en_other_train.7.jsonl.xz
306
+ 1 1 476.9 MiB 2’544.0 MiB 0.187 CRC64 data/en_other_train.8.jsonl.xz
307
+ 1 1 476.9 MiB 4’515.4 MiB 0.106 CRC64 data/en_other_train.9.jsonl.xz
308
+ 1 1 2’165.8 KiB 19.6 MiB 0.108 CRC64 data/en_other_validation.0.jsonl.xz
309
+ 1 1 476.9 MiB 1’803.2 MiB 0.264 CRC64 data/en_wikipedia_train.0.jsonl.xz
310
+ 1 1 441.1 MiB 1’670.5 MiB 0.264 CRC64 data/en_wikipedia_train.10.jsonl.xz
311
+ 1 1 476.9 MiB 1’803.6 MiB 0.264 CRC64 data/en_wikipedia_train.1.jsonl.xz
312
+ 1 1 476.9 MiB 1’802.5 MiB 0.265 CRC64 data/en_wikipedia_train.2.jsonl.xz
313
+ 1 1 476.9 MiB 1’805.0 MiB 0.264 CRC64 data/en_wikipedia_train.3.jsonl.xz
314
+ 1 1 476.9 MiB 1’804.3 MiB 0.264 CRC64 data/en_wikipedia_train.4.jsonl.xz
315
+ 1 1 476.9 MiB 1’804.0 MiB 0.264 CRC64 data/en_wikipedia_train.5.jsonl.xz
316
+ 1 1 476.9 MiB 1’804.1 MiB 0.264 CRC64 data/en_wikipedia_train.6.jsonl.xz
317
+ 1 1 476.9 MiB 1’803.6 MiB 0.264 CRC64 data/en_wikipedia_train.7.jsonl.xz
318
+ 1 1 476.9 MiB 1’805.2 MiB 0.264 CRC64 data/en_wikipedia_train.8.jsonl.xz
319
+ 1 1 476.9 MiB 1’804.3 MiB 0.264 CRC64 data/en_wikipedia_train.9.jsonl.xz
320
+ 1 1 1’004.9 KiB 3’492.7 KiB 0.288 CRC64 data/en_wikipedia_validation.0.jsonl.xz
321
+ 1 1 216.4 MiB 1’458.0 MiB 0.148 CRC64 data/es_caselaw_train.0.jsonl.xz
322
+ 1 1 586.4 KiB 3’537.8 KiB 0.166 CRC64 data/es_caselaw_validation.0.jsonl.xz
323
+ 1 1 29.0 MiB 244.0 MiB 0.119 CRC64 data/es_contracts_train.0.jsonl.xz
324
+ 1 1 3’826.2 KiB 31.2 MiB 0.120 CRC64 data/es_contracts_validation.0.jsonl.xz
325
+ 1 1 401.8 MiB 3’054.9 MiB 0.132 CRC64 data/es_legislation_train.0.jsonl.xz
326
+ 1 1 8’217.6 KiB 56.6 MiB 0.142 CRC64 data/es_legislation_validation.0.jsonl.xz
327
+ 1 0 32 B 0 B --- CRC64 data/es_other_validation.0.jsonl.xz
328
+ 1 1 476.9 MiB 2’017.9 MiB 0.236 CRC64 data/es_wikipedia_train.0.jsonl.xz
329
+ 1 1 476.9 MiB 2’025.0 MiB 0.235 CRC64 data/es_wikipedia_train.1.jsonl.xz
330
+ 1 1 308.8 MiB 1’305.6 MiB 0.237 CRC64 data/es_wikipedia_train.2.jsonl.xz
331
+ 1 1 1’339.7 KiB 5’265.5 KiB 0.254 CRC64 data/es_wikipedia_validation.0.jsonl.xz
332
+ 1 1 132.5 MiB 831.3 MiB 0.159 CRC64 data/et_caselaw_train.0.jsonl.xz
333
+ 1 1 387.2 KiB 2’310.9 KiB 0.168 CRC64 data/et_caselaw_validation.0.jsonl.xz
334
+ 1 1 22.9 MiB 179.6 MiB 0.128 CRC64 data/et_contracts_train.0.jsonl.xz
335
+ 1 1 3’164.3 KiB 26.8 MiB 0.115 CRC64 data/et_contracts_validation.0.jsonl.xz
336
+ 1 1 255.2 MiB 1’908.2 MiB 0.134 CRC64 data/et_legislation_train.0.jsonl.xz
337
+ 1 1 9’239.2 KiB 64.7 MiB 0.140 CRC64 data/et_legislation_validation.0.jsonl.xz
338
+ 1 0 32 B 0 B --- CRC64 data/et_other_validation.0.jsonl.xz
339
+ 1 1 100.5 MiB 408.8 MiB 0.246 CRC64 data/et_wikipedia_train.0.jsonl.xz
340
+ 1 1 1’352.2 KiB 4’921.0 KiB 0.275 CRC64 data/et_wikipedia_validation.0.jsonl.xz
341
+ 1 1 194.5 MiB 1’359.0 MiB 0.143 CRC64 data/fi_caselaw_train.0.jsonl.xz
342
+ 1 1 604.1 KiB 3’656.1 KiB 0.165 CRC64 data/fi_caselaw_validation.0.jsonl.xz
343
+ 1 1 26.0 MiB 219.8 MiB 0.118 CRC64 data/fi_contracts_train.0.jsonl.xz
344
+ 1 1 2’971.2 KiB 27.4 MiB 0.106 CRC64 data/fi_contracts_validation.0.jsonl.xz
345
+ 1 1 334.7 MiB 2’599.3 MiB 0.129 CRC64 data/fi_legislation_train.0.jsonl.xz
346
+ 1 1 7’476.3 KiB 53.9 MiB 0.136 CRC64 data/fi_legislation_validation.0.jsonl.xz
347
+ 1 0 32 B 0 B --- CRC64 data/fi_other_validation.0.jsonl.xz
348
+ 1 1 255.6 MiB 1’118.0 MiB 0.229 CRC64 data/fi_wikipedia_train.0.jsonl.xz
349
+ 1 1 2’464.2 KiB 9.9 MiB 0.242 CRC64 data/fi_wikipedia_validation.0.jsonl.xz
350
+ 1 1 476.9 MiB 3’128.1 MiB 0.152 CRC64 data/fr_caselaw_train.0.jsonl.xz
351
+ 1 1 476.9 MiB 3’104.4 MiB 0.154 CRC64 data/fr_caselaw_train.1.jsonl.xz
352
+ 1 1 350.2 MiB 2’194.9 MiB 0.160 CRC64 data/fr_caselaw_train.2.jsonl.xz
353
+ 1 1 603.0 KiB 3’778.7 KiB 0.160 CRC64 data/fr_caselaw_validation.0.jsonl.xz
354
+ 1 1 31.9 MiB 278.3 MiB 0.115 CRC64 data/fr_contracts_train.0.jsonl.xz
355
+ 1 1 3’034.4 KiB 26.6 MiB 0.111 CRC64 data/fr_contracts_validation.0.jsonl.xz
356
+ 1 1 477.0 MiB 3’721.8 MiB 0.128 CRC64 data/fr_legislation_train.0.jsonl.xz
357
+ 1 1 89.3 MiB 670.9 MiB 0.133 CRC64 data/fr_legislation_train.1.jsonl.xz
358
+ 1 1 3’185.5 KiB 22.6 MiB 0.138 CRC64 data/fr_legislation_validation.0.jsonl.xz
359
+ 1 0 32 B 0 B --- CRC64 data/fr_other_validation.0.jsonl.xz
360
+ 1 1 476.9 MiB 2’150.5 MiB 0.222 CRC64 data/fr_wikipedia_train.0.jsonl.xz
361
+ 1 1 476.9 MiB 2’151.4 MiB 0.222 CRC64 data/fr_wikipedia_train.1.jsonl.xz
362
+ 1 1 476.9 MiB 2’151.2 MiB 0.222 CRC64 data/fr_wikipedia_train.2.jsonl.xz
363
+ 1 1 384.8 MiB 1’736.1 MiB 0.222 CRC64 data/fr_wikipedia_train.3.jsonl.xz
364
+ 1 1 937.8 KiB 3’777.6 KiB 0.248 CRC64 data/fr_wikipedia_validation.0.jsonl.xz
365
+ 1 1 721.9 KiB 5’663.9 KiB 0.127 CRC64 data/ga_caselaw_validation.0.jsonl.xz
366
+ 1 1 1’246.1 KiB 15.6 MiB 0.078 CRC64 data/ga_contracts_validation.0.jsonl.xz
367
+ 1 1 41.2 MiB 419.0 MiB 0.098 CRC64 data/ga_legislation_train.0.jsonl.xz
368
+ 1 1 14.9 MiB 123.2 MiB 0.121 CRC64 data/ga_legislation_validation.0.jsonl.xz
369
+ 1 0 32 B 0 B --- CRC64 data/ga_other_validation.0.jsonl.xz
370
+ 1 1 11.0 MiB 52.9 MiB 0.207 CRC64 data/ga_wikipedia_train.0.jsonl.xz
371
+ 1 1 782.4 KiB 3’438.9 KiB 0.228 CRC64 data/ga_wikipedia_validation.0.jsonl.xz
372
+ 1 1 72.7 MiB 460.3 MiB 0.158 CRC64 data/hr_caselaw_train.0.jsonl.xz
373
+ 1 1 359.9 KiB 2’214.8 KiB 0.162 CRC64 data/hr_caselaw_validation.0.jsonl.xz
374
+ 1 1 21.2 MiB 158.3 MiB 0.134 CRC64 data/hr_contracts_train.0.jsonl.xz
375
+ 1 1 3’785.9 KiB 26.6 MiB 0.139 CRC64 data/hr_contracts_validation.0.jsonl.xz
376
+ 1 1 160.6 MiB 1’258.7 MiB 0.128 CRC64 data/hr_legislation_train.0.jsonl.xz
377
+ 1 1 11.2 MiB 86.1 MiB 0.130 CRC64 data/hr_legislation_validation.0.jsonl.xz
378
+ 1 0 32 B 0 B --- CRC64 data/hr_other_validation.0.jsonl.xz
379
+ 1 1 110.3 MiB 425.5 MiB 0.259 CRC64 data/hr_wikipedia_train.0.jsonl.xz
380
+ 1 1 1’743.8 KiB 6’170.1 KiB 0.283 CRC64 data/hr_wikipedia_validation.0.jsonl.xz
381
+ 1 1 150.6 MiB 1’320.5 MiB 0.114 CRC64 data/hu_caselaw_train.0.jsonl.xz
382
+ 1 1 423.8 KiB 3’496.6 KiB 0.121 CRC64 data/hu_caselaw_validation.0.jsonl.xz
383
+ 1 1 26.9 MiB 266.0 MiB 0.101 CRC64 data/hu_contracts_train.0.jsonl.xz
384
+ 1 1 3’532.6 KiB 36.1 MiB 0.096 CRC64 data/hu_contracts_validation.0.jsonl.xz
385
+ 1 1 337.6 MiB 3’129.4 MiB 0.108 CRC64 data/hu_legislation_train.0.jsonl.xz
386
+ 1 1 3’913.7 KiB 94.8 MiB 0.040 CRC64 data/hu_legislation_validation.0.jsonl.xz
387
+ 1 0 32 B 0 B --- CRC64 data/hu_other_validation.0.jsonl.xz
388
+ 1 1 364.2 MiB 1’835.0 MiB 0.198 CRC64 data/hu_wikipedia_train.0.jsonl.xz
389
+ 1 1 1’719.5 KiB 8’000.8 KiB 0.215 CRC64 data/hu_wikipedia_validation.0.jsonl.xz
390
+ 1 1 459.8 MiB 2’742.8 MiB 0.168 CRC64 data/it_caselaw_train.0.jsonl.xz
391
+ 1 1 577.8 KiB 3’194.2 KiB 0.181 CRC64 data/it_caselaw_validation.0.jsonl.xz
392
+ 1 1 31.2 MiB 240.4 MiB 0.130 CRC64 data/it_contracts_train.0.jsonl.xz
393
+ 1 1 3’068.9 KiB 24.0 MiB 0.125 CRC64 data/it_contracts_validation.0.jsonl.xz
394
+ 1 1 476.9 MiB 3’362.3 MiB 0.142 CRC64 data/it_legislation_train.0.jsonl.xz
395
+ 1 1 38.9 MiB 238.7 MiB 0.163 CRC64 data/it_legislation_train.1.jsonl.xz
396
+ 1 1 3’211.3 KiB 25.3 MiB 0.124 CRC64 data/it_legislation_validation.0.jsonl.xz
397
+ 1 0 32 B 0 B --- CRC64 data/it_other_validation.0.jsonl.xz
398
+ 1 1 476.9 MiB 1’864.5 MiB 0.256 CRC64 data/it_wikipedia_train.0.jsonl.xz
399
+ 1 1 476.9 MiB 1’864.8 MiB 0.256 CRC64 data/it_wikipedia_train.1.jsonl.xz
400
+ 1 1 184.6 MiB 726.2 MiB 0.254 CRC64 data/it_wikipedia_train.2.jsonl.xz
401
+ 1 1 1’334.0 KiB 4’843.5 KiB 0.275 CRC64 data/it_wikipedia_validation.0.jsonl.xz
402
+ 1 1 136.6 MiB 975.7 MiB 0.140 CRC64 data/lt_caselaw_train.0.jsonl.xz
403
+ 1 1 397.0 KiB 2’660.9 KiB 0.149 CRC64 data/lt_caselaw_validation.0.jsonl.xz
404
+ 1 1 24.9 MiB 211.8 MiB 0.118 CRC64 data/lt_contracts_train.0.jsonl.xz
405
+ 1 1 3’275.5 KiB 26.1 MiB 0.123 CRC64 data/lt_contracts_validation.0.jsonl.xz
406
+ 1 1 274.0 MiB 2’174.1 MiB 0.126 CRC64 data/lt_legislation_train.0.jsonl.xz
407
+ 1 1 9’780.7 KiB 73.4 MiB 0.130 CRC64 data/lt_legislation_validation.0.jsonl.xz
408
+ 1 0 32 B 0 B --- CRC64 data/lt_other_validation.0.jsonl.xz
409
+ 1 1 72.6 MiB 349.5 MiB 0.208 CRC64 data/lt_wikipedia_train.0.jsonl.xz
410
+ 1 1 1’251.2 KiB 5’369.5 KiB 0.233 CRC64 data/lt_wikipedia_validation.0.jsonl.xz
411
+ 1 1 141.0 MiB 1’106.7 MiB 0.127 CRC64 data/lv_caselaw_train.0.jsonl.xz
412
+ 1 1 410.3 KiB 3’004.0 KiB 0.137 CRC64 data/lv_caselaw_validation.0.jsonl.xz
413
+ 1 1 24.9 MiB 224.5 MiB 0.111 CRC64 data/lv_contracts_train.0.jsonl.xz
414
+ 1 1 3’629.0 KiB 33.6 MiB 0.106 CRC64 data/lv_contracts_validation.0.jsonl.xz
415
+ 1 1 271.5 MiB 2’377.4 MiB 0.114 CRC64 data/lv_legislation_train.0.jsonl.xz
416
+ 1 1 10.5 MiB 87.5 MiB 0.120 CRC64 data/lv_legislation_validation.0.jsonl.xz
417
+ 1 0 32 B 0 B --- CRC64 data/lv_other_validation.0.jsonl.xz
418
+ 1 1 47.5 MiB 254.7 MiB 0.186 CRC64 data/lv_wikipedia_train.0.jsonl.xz
419
+ 1 1 984.1 KiB 4’559.4 KiB 0.216 CRC64 data/lv_wikipedia_validation.0.jsonl.xz
420
+ 1 1 132.2 MiB 956.6 MiB 0.138 CRC64 data/mt_caselaw_train.0.jsonl.xz
421
+ 1 1 396.1 KiB 2’680.0 KiB 0.148 CRC64 data/mt_caselaw_validation.0.jsonl.xz
422
+ 1 1 25.6 MiB 201.0 MiB 0.127 CRC64 data/mt_contracts_train.0.jsonl.xz
423
+ 1 1 4’178.4 KiB 34.0 MiB 0.120 CRC64 data/mt_contracts_validation.0.jsonl.xz
424
+ 1 1 270.7 MiB 2’121.7 MiB 0.128 CRC64 data/mt_legislation_train.0.jsonl.xz
425
+ 1 1 11.4 MiB 84.2 MiB 0.135 CRC64 data/mt_legislation_validation.0.jsonl.xz
426
+ 1 0 32 B 0 B --- CRC64 data/mt_other_validation.0.jsonl.xz
427
+ 1 1 4’608.3 KiB 19.5 MiB 0.231 CRC64 data/mt_wikipedia_train.0.jsonl.xz
428
+ 1 1 1’405.0 KiB 5’754.4 KiB 0.244 CRC64 data/mt_wikipedia_validation.0.jsonl.xz
429
+ 1 1 223.1 MiB 1’338.9 MiB 0.167 CRC64 data/nl_caselaw_train.0.jsonl.xz
430
+ 1 1 566.0 KiB 3’152.2 KiB 0.180 CRC64 data/nl_caselaw_validation.0.jsonl.xz
431
+ 1 1 31.6 MiB 242.3 MiB 0.130 CRC64 data/nl_contracts_train.0.jsonl.xz
432
+ 1 1 2’663.9 KiB 22.4 MiB 0.116 CRC64 data/nl_contracts_validation.0.jsonl.xz
433
+ 1 1 476.9 MiB 3’311.9 MiB 0.144 CRC64 data/nl_legislation_train.0.jsonl.xz
434
+ 1 1 41.1 MiB 268.7 MiB 0.153 CRC64 data/nl_legislation_train.1.jsonl.xz
435
+ 1 1 3’678.8 KiB 72.9 MiB 0.049 CRC64 data/nl_legislation_validation.0.jsonl.xz
436
+ 1 0 32 B 0 B --- CRC64 data/nl_other_validation.0.jsonl.xz
437
+ 1 1 476.9 MiB 1’856.9 MiB 0.257 CRC64 data/nl_wikipedia_train.0.jsonl.xz
438
+ 1 1 59.9 MiB 236.4 MiB 0.253 CRC64 data/nl_wikipedia_train.1.jsonl.xz
439
+ 1 1 979.4 KiB 3’414.8 KiB 0.287 CRC64 data/nl_wikipedia_validation.0.jsonl.xz
440
+ 1 1 147.9 MiB 1’034.1 MiB 0.143 CRC64 data/pl_caselaw_train.0.jsonl.xz
441
+ 1 1 416.2 KiB 2’737.2 KiB 0.152 CRC64 data/pl_caselaw_validation.0.jsonl.xz
442
+ 1 1 24.8 MiB 208.9 MiB 0.119 CRC64 data/pl_contracts_train.0.jsonl.xz
443
+ 1 1 4’241.9 KiB 34.6 MiB 0.120 CRC64 data/pl_contracts_validation.0.jsonl.xz
444
+ 1 1 325.0 MiB 2’646.2 MiB 0.123 CRC64 data/pl_legislation_train.0.jsonl.xz
445
+ 1 1 3’593.0 KiB 29.0 MiB 0.121 CRC64 data/pl_legislation_validation.0.jsonl.xz
446
+ 1 0 32 B 0 B --- CRC64 data/pl_other_validation.0.jsonl.xz
447
+ 1 1 476.9 MiB 2’144.7 MiB 0.222 CRC64 data/pl_wikipedia_train.0.jsonl.xz
448
+ 1 1 189.5 MiB 864.0 MiB 0.219 CRC64 data/pl_wikipedia_train.1.jsonl.xz
449
+ 1 1 1’233.2 KiB 4’965.9 KiB 0.248 CRC64 data/pl_wikipedia_validation.0.jsonl.xz
450
+ 1 1 476.9 MiB 3’494.2 MiB 0.136 CRC64 data/pt_caselaw_train.0.jsonl.xz
451
+ 1 1 476.9 MiB 3’392.1 MiB 0.141 CRC64 data/pt_caselaw_train.10.jsonl.xz
452
+ 1 1 476.9 MiB 3’505.3 MiB 0.136 CRC64 data/pt_caselaw_train.11.jsonl.xz
453
+ 1 1 476.9 MiB 3’524.1 MiB 0.135 CRC64 data/pt_caselaw_train.12.jsonl.xz
454
+ 1 1 476.9 MiB 3’458.4 MiB 0.138 CRC64 data/pt_caselaw_train.13.jsonl.xz
455
+ 1 1 476.9 MiB 3’602.9 MiB 0.132 CRC64 data/pt_caselaw_train.14.jsonl.xz
456
+ 1 1 476.9 MiB 4’923.4 MiB 0.097 CRC64 data/pt_caselaw_train.15.jsonl.xz
457
+ 1 1 476.9 MiB 6’648.8 MiB 0.072 CRC64 data/pt_caselaw_train.16.jsonl.xz
458
+ 1 1 476.9 MiB 7’461.0 MiB 0.064 CRC64 data/pt_caselaw_train.17.jsonl.xz
459
+ 1 1 476.9 MiB 6’866.4 MiB 0.069 CRC64 data/pt_caselaw_train.18.jsonl.xz
460
+ 1 1 476.9 MiB 3’455.7 MiB 0.138 CRC64 data/pt_caselaw_train.19.jsonl.xz
461
+ 1 1 476.9 MiB 3’513.7 MiB 0.136 CRC64 data/pt_caselaw_train.1.jsonl.xz
462
+ 1 1 476.9 MiB 3’477.3 MiB 0.137 CRC64 data/pt_caselaw_train.20.jsonl.xz
463
+ 1 1 476.9 MiB 3’492.8 MiB 0.137 CRC64 data/pt_caselaw_train.21.jsonl.xz
464
+ 1 1 476.9 MiB 3’528.6 MiB 0.135 CRC64 data/pt_caselaw_train.22.jsonl.xz
465
+ 1 1 94.1 MiB 694.3 MiB 0.135 CRC64 data/pt_caselaw_train.23.jsonl.xz
466
+ 1 1 476.9 MiB 3’436.5 MiB 0.139 CRC64 data/pt_caselaw_train.2.jsonl.xz
467
+ 1 1 476.9 MiB 3’527.9 MiB 0.135 CRC64 data/pt_caselaw_train.3.jsonl.xz
468
+ 1 1 476.9 MiB 3’492.2 MiB 0.137 CRC64 data/pt_caselaw_train.4.jsonl.xz
469
+ 1 1 476.9 MiB 3’554.8 MiB 0.134 CRC64 data/pt_caselaw_train.5.jsonl.xz
470
+ 1 1 476.9 MiB 3’494.7 MiB 0.136 CRC64 data/pt_caselaw_train.6.jsonl.xz
471
+ 1 1 476.9 MiB 3’439.1 MiB 0.139 CRC64 data/pt_caselaw_train.7.jsonl.xz
472
+ 1 1 476.9 MiB 3’625.6 MiB 0.132 CRC64 data/pt_caselaw_train.8.jsonl.xz
473
+ 1 1 476.9 MiB 3’726.4 MiB 0.128 CRC64 data/pt_caselaw_train.9.jsonl.xz
474
+ 1 1 798.9 KiB 4’820.6 KiB 0.166 CRC64 data/pt_caselaw_validation.0.jsonl.xz
475
+ 1 1 28.4 MiB 243.2 MiB 0.117 CRC64 data/pt_contracts_train.0.jsonl.xz
476
+ 1 1 3’899.7 KiB 32.6 MiB 0.117 CRC64 data/pt_contracts_validation.0.jsonl.xz
477
+ 1 1 406.2 MiB 3’217.5 MiB 0.126 CRC64 data/pt_legislation_train.0.jsonl.xz
478
+ 1 1 8’350.4 KiB 58.4 MiB 0.140 CRC64 data/pt_legislation_validation.0.jsonl.xz
479
+ 1 0 32 B 0 B --- CRC64 data/pt_other_validation.0.jsonl.xz
480
+ 1 1 476.9 MiB 2’050.4 MiB 0.233 CRC64 data/pt_wikipedia_train.0.jsonl.xz
481
+ 1 1 140.6 MiB 617.4 MiB 0.228 CRC64 data/pt_wikipedia_train.1.jsonl.xz
482
+ 1 1 1’480.0 KiB 6’344.8 KiB 0.233 CRC64 data/pt_wikipedia_validation.0.jsonl.xz
483
+ 1 1 124.9 MiB 956.9 MiB 0.131 CRC64 data/ro_caselaw_train.0.jsonl.xz
484
+ 1 1 400.4 KiB 2’785.0 KiB 0.144 CRC64 data/ro_caselaw_validation.0.jsonl.xz
485
+ 1 1 24.6 MiB 210.5 MiB 0.117 CRC64 data/ro_contracts_train.0.jsonl.xz
486
+ 1 1 3’886.3 KiB 34.3 MiB 0.111 CRC64 data/ro_contracts_validation.0.jsonl.xz
487
+ 1 1 476.9 MiB 4’496.4 MiB 0.106 CRC64 data/ro_legislation_train.0.jsonl.xz
488
+ 1 1 97.6 MiB 1’053.6 MiB 0.093 CRC64 data/ro_legislation_train.1.jsonl.xz
489
+ 1 1 3’691.3 KiB 33.4 MiB 0.108 CRC64 data/ro_legislation_validation.0.jsonl.xz
490
+ 1 0 32 B 0 B --- CRC64 data/ro_other_validation.0.jsonl.xz
491
+ 1 1 179.7 MiB 833.0 MiB 0.216 CRC64 data/ro_wikipedia_train.0.jsonl.xz
492
+ 1 1 2’089.4 KiB 9’053.5 KiB 0.231 CRC64 data/ro_wikipedia_validation.0.jsonl.xz
493
+ 1 1 143.6 MiB 1’094.2 MiB 0.131 CRC64 data/sk_caselaw_train.0.jsonl.xz
494
+ 1 1 415.8 KiB 3’012.4 KiB 0.138 CRC64 data/sk_caselaw_validation.0.jsonl.xz
495
+ 1 1 25.9 MiB 226.7 MiB 0.114 CRC64 data/sk_contracts_train.0.jsonl.xz
496
+ 1 1 3’933.6 KiB 35.2 MiB 0.109 CRC64 data/sk_contracts_validation.0.jsonl.xz
497
+ 1 1 322.4 MiB 2’745.5 MiB 0.117 CRC64 data/sk_legislation_train.0.jsonl.xz
498
+ 1 1 3’735.8 KiB 31.7 MiB 0.115 CRC64 data/sk_legislation_validation.0.jsonl.xz
499
+ 1 0 32 B 0 B --- CRC64 data/sk_other_validation.0.jsonl.xz
500
+ 1 1 91.2 MiB 435.3 MiB 0.210 CRC64 data/sk_wikipedia_train.0.jsonl.xz
501
+ 1 1 1’724.4 KiB 7’568.3 KiB 0.228 CRC64 data/sk_wikipedia_validation.0.jsonl.xz
502
+ 1 1 131.9 MiB 815.8 MiB 0.162 CRC64 data/sl_caselaw_train.0.jsonl.xz
503
+ 1 1 392.8 KiB 2’328.2 KiB 0.169 CRC64 data/sl_caselaw_validation.0.jsonl.xz
504
+ 1 1 22.9 MiB 172.4 MiB 0.133 CRC64 data/sl_contracts_train.0.jsonl.xz
505
+ 1 1 3’493.7 KiB 27.2 MiB 0.125 CRC64 data/sl_contracts_validation.0.jsonl.xz
506
+ 1 1 388.1 MiB 2’732.3 MiB 0.142 CRC64 data/sl_legislation_train.0.jsonl.xz
507
+ 1 1 3’429.8 KiB 24.3 MiB 0.138 CRC64 data/sl_legislation_validation.0.jsonl.xz
508
+ 1 0 32 B 0 B --- CRC64 data/sl_other_validation.0.jsonl.xz
509
+ 1 1 104.6 MiB 425.6 MiB 0.246 CRC64 data/sl_wikipedia_train.0.jsonl.xz
510
+ 1 1 1’392.8 KiB 5’004.9 KiB 0.278 CRC64 data/sl_wikipedia_validation.0.jsonl.xz
511
+ 1 1 189.5 MiB 1’325.4 MiB 0.143 CRC64 data/sv_caselaw_train.0.jsonl.xz
512
+ 1 1 581.2 KiB 3’566.7 KiB 0.163 CRC64 data/sv_caselaw_validation.0.jsonl.xz
513
+ 1 1 25.3 MiB 211.7 MiB 0.119 CRC64 data/sv_contracts_train.0.jsonl.xz
514
+ 1 1 2’890.6 KiB 26.0 MiB 0.108 CRC64 data/sv_contracts_validation.0.jsonl.xz
515
+ 1 1 324.5 MiB 2’570.4 MiB 0.126 CRC64 data/sv_legislation_train.0.jsonl.xz
516
+ 1 1 6’984.8 KiB 50.1 MiB 0.136 CRC64 data/sv_legislation_validation.0.jsonl.xz
517
+ 1 0 32 B 0 B --- CRC64 data/sv_other_validation.0.jsonl.xz
518
+ 1 1 333.4 MiB 1’668.1 MiB 0.200 CRC64 data/sv_wikipedia_train.0.jsonl.xz
519
+ 1 1 1’088.6 KiB 4’372.9 KiB 0.249 CRC64 data/sv_wikipedia_validation.0.jsonl.xz
520
+ -------------------------------------------------------------------------------
521
+ 374 351 90.1 GiB 579.9 GiB 0.155 CRC64 374 files
522
+ ```
523
+
524
+ ## Dataset Creation
525
+
526
+ This dataset has been created by combining the following datasets:
527
+ Native Multi Legal Pile, Eurlex Resources, MC4 Legal, Pile of Law, EU Wikipedias.
528
+ It has been filtered to remove short documents (less than 64 whitespace-separated tokens) and
529
+ documents with more than 30% punctuation or numbers (see prepare_legal_data.py for more details).
530
+
531
+ ### Curation Rationale
532
+
533
+ [More Information Needed]
534
+
535
+ ### Source Data
536
+
537
+ #### Initial Data Collection and Normalization
538
+
539
+ [More Information Needed]
540
+
541
+ #### Who are the source language producers?
542
+
543
+ [More Information Needed]
544
+
545
+
546
+ ### Annotations
547
+
548
+ #### Annotation process
549
+
550
+ [More Information Needed]
551
+
552
+ #### Who are the annotators?
553
+
554
+ [More Information Needed]
555
+
556
+ ### Personal and Sensitive Information
557
+
558
+ [More Information Needed]
559
+
560
+ ## Considerations for Using the Data
561
+
562
+ ### Social Impact of Dataset
563
+
564
+ [More Information Needed]
565
+
566
+ ### Discussion of Biases
567
+
568
+ [More Information Needed]
569
+
570
+ ### Other Known Limitations
571
+
572
+ [More Information Needed]
573
+
574
+ ## Additional Information
575
+
576
+ ### Dataset Curators
577
+
578
+ [More Information Needed]
579
+
580
+ ### Licensing Information
581
+
582
+ [More Information Needed]
583
+
584
+ ### Citation Information
585
+
586
+ ```
587
+ TODO add citation
588
+ ```
589
+
590
+ ### Contributions
591
+
592
+ Thanks to [@JoelNiklaus](https://github.com/joelniklaus) for adding this dataset.
prepare_legal_data.py ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # No chunks, one doc per line
2
+
3
+ # remove new lines, etc.
4
+ # create a corpus of min 200-400 GB ==> ~100B tokens
5
+ # max file size: 4GB because of huggingface
6
+ # validation set: ~100M tokens ==> 200-400MB
7
+
8
+ import json
9
+ import logging
10
+ import multiprocessing
11
+ import sys
12
+
13
+ import tqdm
14
+ import os
15
+ import re
16
+ from multiprocessing import Pool
17
+
18
+ from datasets import load_dataset
19
+ from tokenizers import normalizers
20
+
21
+ try:
22
+ import lzma as xz
23
+ except ImportError:
24
+ import pylzma as xz
25
+
26
+ root = logging.getLogger()
27
+ root.setLevel(logging.INFO)
28
+
29
+ handler = logging.StreamHandler(sys.stdout)
30
+ handler.setLevel(logging.INFO)
31
+ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
32
+ handler.setFormatter(formatter)
33
+ root.addHandler(handler)
34
+ logger = logging.getLogger(__name__)
35
+
36
+ _LANGUAGES = ['bg', 'cs', 'da', 'de', 'el', 'en', 'es', 'et', 'fi', 'fr', 'ga', 'hr',
37
+ 'hu', 'it', 'lt', 'lv', 'mt', 'nl', 'pl', 'pt', 'ro', 'sk', 'sl', 'sv']
38
+ _DOMAIN_TYPES = ['legislation', 'caselaw', 'contracts', 'other', 'mc4-legal' 'wikipedia']
39
+
40
+ custom_normalizer = normalizers.NFKD()
41
+
42
+ VALIDATION_SIZE = 1_000 # ~1MB per configuration ==> some low-resource configs will only have a validation file
43
+ MAX_FILE_SIZE = int(5e8) # 500 MB per train file
44
+
45
+ data_dir = 'data'
46
+ os.makedirs(data_dir, exist_ok=True)
47
+
48
+
49
+ def preprocess_dataset(languages=None, domain_types=None):
50
+ lang_type_datasets = []
51
+ # set defaults if they are not set
52
+ if languages is None:
53
+ languages = _LANGUAGES
54
+ if domain_types is None:
55
+ domain_types = _DOMAIN_TYPES
56
+
57
+ for LANG in languages:
58
+ for DOMAIN_TYPE in domain_types:
59
+ try:
60
+ if DOMAIN_TYPE == 'wikipedia':
61
+ # get from EU_Wikipedias
62
+ dataset = load_dataset("joelito/EU_Wikipedias", date="20221120", language=LANG,
63
+ split='train', streaming=True, use_auth_token=True)
64
+ else:
65
+ # get from Multi_Legal_Pile
66
+ dataset = load_dataset("joelito/Multi_Legal_Pile", f'{LANG}_{DOMAIN_TYPE}',
67
+ split='train', streaming=True, use_auth_token=True)
68
+ dataset = dataset.shuffle(seed=42, buffer_size=10_000)
69
+ logger.info(f'Found data for `{DOMAIN_TYPE}` in language `{LANG}`.')
70
+ except:
71
+ logger.info(f'There is no data for `{DOMAIN_TYPE}` in language `{LANG}`.')
72
+ continue
73
+ lang_type_datasets.append(dataset)
74
+ return lang_type_datasets
75
+
76
+
77
+ def write_samples(dataset_number):
78
+ dataset, dataset_name = dataset_number
79
+ if len(dataset_name.split('_')) == 1: # wikipedia
80
+ language = dataset_name.split('.')[1]
81
+ domain_type = "wikipedia"
82
+ dataset_name = f"{language}_{domain_type}" # reformat the config name so that we have wikipedia in the name
83
+ else:
84
+ language, domain_type = dataset_name.split('_')
85
+ total_count, temp_count, all_samples, file_number = 0, 0, 0, 0
86
+ filepath = get_filepath(dataset_name, 'validation', file_number) # we save the first examples to the validation set
87
+ out_file = open_file(filepath)
88
+ logger.info(f'Processing for dataset {dataset_name} started!')
89
+ # Read each document
90
+ for sample in tqdm.tqdm(dataset):
91
+ try:
92
+ if "validation" in filepath and temp_count >= VALIDATION_SIZE:
93
+ # if we are saving to eval, and we have enough samples in the eval set, switch to train
94
+ logger.info(
95
+ f'Processing validation split in dataset {dataset_name} finished with {temp_count}/{all_samples}!')
96
+ out_file.close()
97
+ temp_count = 0
98
+ filepath = get_filepath(dataset_name, 'train', file_number)
99
+ out_file = open_file(filepath)
100
+ if "train" in filepath and os.path.getsize(filepath) > MAX_FILE_SIZE:
101
+ # if we are saving to train, and we reached the max size per file, switch to the next file
102
+ logger.info(
103
+ f'Processing file {file_number} of train split in dataset {dataset_name} finished with {temp_count}/{all_samples}!')
104
+ out_file.close()
105
+ file_number += 1
106
+ temp_count = 0
107
+ filepath = get_filepath(dataset_name, 'train', file_number)
108
+ out_file = open_file(filepath)
109
+
110
+ text = normalize_text(sample['text'])
111
+ # if the text is usable for pretraining, save it
112
+ if is_text_usable(text):
113
+ jurisdiction = sample.get('jurisdiction', "N/A") # set defaults for wikipedia
114
+ type = sample.get("type", "wikipedia") # set defaults for wikipedia
115
+ entry = {"language": sample["language"], "type": type, "jurisdiction": jurisdiction, "text": text}
116
+ out_file.write(json.dumps(entry) + '\n')
117
+ total_count += 1
118
+ temp_count += 1
119
+ all_samples += 1
120
+ except:
121
+ continue
122
+
123
+ try:
124
+ out_file.close()
125
+ except:
126
+ pass
127
+
128
+ logger.info(f'Processing for dataset {dataset_name} finished with {total_count}/{all_samples}!')
129
+ return
130
+
131
+
132
+ def is_text_usable(text):
133
+ # Compute percentage of alphabetical characters in relation to full sequence length
134
+ punctuation = '!\"#$%&\'()*+,\-\./:;<=>?@\[\\\]\^_`{\|}~'
135
+ alpha_text = re.sub(rf'[{punctuation}\d]', '', text) # remove numbers and punctuation
136
+ alpha_percent = len(alpha_text) / len(text)
137
+ # Compute total chunk length
138
+ text_length = len(text.split())
139
+ # Ignore sequences with more than 30% numbers or short sequences (less than 64 tokens)
140
+ return alpha_percent > 0.7 and text_length > 64
141
+
142
+
143
+ def normalize_text(text):
144
+ # Normalize the document
145
+ text = custom_normalizer.normalize_str(text)
146
+ # Replace multiple newline and whitespaces
147
+ return re.sub(r'(\n )+', r'\n ', re.sub(r'( *[\n\r]+ *)+', r'\n ', re.sub(r'[\t ]+', r' ', text)))
148
+
149
+
150
+ def open_file(filepath):
151
+ logger.info(f'Writing to file {filepath}')
152
+ return xz.open(filepath, 'wt')
153
+
154
+
155
+ def get_filepath(dataset_name, split, file_number):
156
+ return os.path.join(data_dir, f'{dataset_name}_{split}.{file_number}.jsonl.xz')
157
+
158
+
159
+ def clean_and_filter_documents(languages=None, domain_types=None):
160
+ # Load all datasets across languages and types
161
+ lang_type_datasets = preprocess_dataset(languages=languages, domain_types=domain_types)
162
+ # also pass in dataset_name
163
+ lang_type_datasets = [(dataset, dataset.config_name) for dataset in lang_type_datasets]
164
+ logger.info(lang_type_datasets)
165
+
166
+ # Launch pool to preprocess datasets in parallel
167
+ max_num_processes = min(multiprocessing.cpu_count() - 4, len(lang_type_datasets))
168
+ num_processes = max(max_num_processes, 1)
169
+ logger.info(f'Launching a Pool with maximum {num_processes} processes...')
170
+ with Pool(num_processes) as pool:
171
+ pool.map(write_samples, lang_type_datasets)
172
+
173
+ logger.info(f"Finished preparing legal data")
174
+
175
+
176
+ if __name__ == '__main__':
177
+ # CURRENTLY RUNNING ON DGX STATION BFH
178
+ """
179
+ Run with
180
+ export PYTHONPATH=. && python prepare_legal_data.py | tee prepare_legal_data.log
181
+ """
182
+ # clean_and_filter_documents(["mt"], ["caselaw"]) # for testing
183
+ domains = ['legislation', 'caselaw', 'contracts', 'other', 'wikipedia'] # 'mc4-legal' is not ready yet
184
+ clean_and_filter_documents(languages=None, domain_types=domains)
185
+
186
+ # Get locally
187
+ # def get_file(LANG, DOMAIN_TYPE, split, number):
188
+ # base_folder = "data/mlm_dataset/chunks_512"
189
+ # return f'{base_folder}/{LANG}_{DOMAIN_TYPE}_{split}_{number}.jsonl.xz'
190
+
191
+ # files = [get_file(LANG, DOMAIN_TYPE, 'train', i) for i in range(1, 5)]
192
+ # files = [f for f in files if os.path.exists(f)] # make sure the file actually exists
193
+ # dataset = load_dataset("json", data_files={'train': files}, split='train', streaming=True)
194
+
195
+ # TODO write dataset cards for chunked, eu wikipedia and filtered dataset