joelniklaus commited on
Commit
2f86af0
1 Parent(s): 773047d

updated legal mc4 dataset

Browse files
Files changed (2) hide show
  1. Multi_Legal_Pile.py +40 -14
  2. README.md +4 -4
Multi_Legal_Pile.py CHANGED
@@ -29,7 +29,7 @@ CASELAW = "caselaw"
29
  LEGISLATION = "legislation"
30
  CONTRACTS = "contracts"
31
  OTHER = "other"
32
- MC4_LEGAL = "mc4-legal"
33
 
34
  # Native MultiLegalPile
35
  _DATA_NAME = {
@@ -319,13 +319,40 @@ _PILE_OF_LAW_NAMES = {
319
  "validation": ["validation.doj_guidance"]
320
  }
321
  },
322
- MC4_LEGAL: {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
324
 
325
  _LANGUAGES = ["bg", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "ga", "hr",
326
  "hu", "it", "lt", "lv", "mt", "nl", "pl", "pt", "ro", "sk", "sl", "sv"]
327
 
328
- _TYPES = [CASELAW, CONTRACTS, LEGISLATION, OTHER, MC4_LEGAL]
329
 
330
  _JURISDICTIONS = ["Austria", "Belgium", "Brazil", "Bulgaria", "Croatia", "Czechia", "Denmark", "Estonia", "Finland",
331
  "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg",
@@ -341,7 +368,7 @@ class MultiLegalPileConfig(datasets.BuilderConfig):
341
  Args:
342
  name: combination of language and type with _
343
  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
344
- type: One of caselaw,contracts,legislation,other,mc4_legal or all
345
  **kwargs: keyword arguments forwarded to super.
346
  """
347
  super(MultiLegalPileConfig, self).__init__(**kwargs)
@@ -411,18 +438,17 @@ class MultiLegalPile(datasets.GeneratorBasedBuilder):
411
  info["filepath"] = download_url("joelito/eurlex_resources", f"{language}/intagr")
412
  data_infos.append(info.copy())
413
 
414
- # add mc4_legal data
415
- if type == 'mc4_legal':
416
  info["jurisdiction"] = "N/A"
417
- if language in ["de", "en", "es"]: # here we need to chunk because the files are too large
418
- for idx in [0, 1]:
419
- info["filepath"] = download_url("joelito/mc4_legal", f"{language}_{idx}")
420
- data_infos.append(info.copy())
421
- elif language in ["hr"]:
422
- pass # nothing there for Croatian
423
  else:
424
- info["filepath"] = download_url("joelito/mc4_legal", f"{language}")
425
- data_infos.append(info.copy())
 
 
 
426
 
427
  # add pile-of-law data
428
  if language == 'en':
 
29
  LEGISLATION = "legislation"
30
  CONTRACTS = "contracts"
31
  OTHER = "other"
32
+ LEGAL_MC4 = "legal-mc4"
33
 
34
  # Native MultiLegalPile
35
  _DATA_NAME = {
 
319
  "validation": ["validation.doj_guidance"]
320
  }
321
  },
322
+ LEGAL_MC4: {}
323
+ }
324
+
325
+ _LEGAL_MC4_SHARDS = {
326
+ "bg": 0,
327
+ "cs": 2,
328
+ "da": 0,
329
+ "de": 8,
330
+ "el": 0,
331
+ "en": 1,
332
+ "es": 9,
333
+ "et": 1,
334
+ "fi": 0,
335
+ "fr": 2,
336
+ "ga": 0,
337
+ # "hr", # hr is not present in mc4
338
+ "hu": 0,
339
+ "it": 3,
340
+ "lt": 0,
341
+ "lv": 0,
342
+ "mt": 0,
343
+ "nl": 0,
344
+ "pl": 2,
345
+ "pt": 1,
346
+ "ro": 0,
347
+ "sk": 0,
348
+ "sl": 0,
349
+ "sv": 0,
350
  }
351
 
352
  _LANGUAGES = ["bg", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "ga", "hr",
353
  "hu", "it", "lt", "lv", "mt", "nl", "pl", "pt", "ro", "sk", "sl", "sv"]
354
 
355
+ _TYPES = [CASELAW, CONTRACTS, LEGISLATION, OTHER, LEGAL_MC4]
356
 
357
  _JURISDICTIONS = ["Austria", "Belgium", "Brazil", "Bulgaria", "Croatia", "Czechia", "Denmark", "Estonia", "Finland",
358
  "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg",
 
368
  Args:
369
  name: combination of language and type with _
370
  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
371
+ type: One of caselaw,contracts,legislation,other,legal-mc4 or all
372
  **kwargs: keyword arguments forwarded to super.
373
  """
374
  super(MultiLegalPileConfig, self).__init__(**kwargs)
 
438
  info["filepath"] = download_url("joelito/eurlex_resources", f"{language}/intagr")
439
  data_infos.append(info.copy())
440
 
441
+ # add legal-mc4 data
442
+ if type == LEGAL_MC4:
443
  info["jurisdiction"] = "N/A"
444
+ if language == "hr":
445
+ pass
 
 
 
 
446
  else:
447
+ for split in ["train", "validation"]:
448
+ shards = range(_LEGAL_MC4_SHARDS[language] + 1) if split == "train" else [0]
449
+ for shard in shards:
450
+ info["filepath"] = download_url("joelito/legal-mc4", f"{language}.{split}.{shard}")
451
+ data_infos.append(info.copy())
452
 
453
  # add pile-of-law data
454
  if language == 'en':
README.md CHANGED
@@ -126,11 +126,11 @@ all_legislation').
126
 
127
  The file format is jsonl.xz and there is one split available ("train").
128
 
129
- The complete dataset (716GB) consists of four large subsets:
130
 
131
  - Native Multi Legal Pile (112GB)
132
  - Eurlex Resources (179GB)
133
- - MC4 Legal (133GB)
134
  - Pile of Law (292GB)
135
 
136
  #### Native Multilingual Legal Pile data
@@ -172,9 +172,9 @@ The complete dataset (716GB) consists of four large subsets:
172
 
173
  See [Eurlex Resources](https://huggingface.co/datasets/joelito/eurlex_resources#data-instances) for more information.
174
 
175
- #### MC4 Legal
176
 
177
- See [MC4 Legal](https://huggingface.co/datasets/joelito/mc4_legal#data-instances) for more information.
178
 
179
  #### Pile-of-Law
180
 
 
126
 
127
  The file format is jsonl.xz and there is one split available ("train").
128
 
129
+ The complete dataset (689GB) consists of four large subsets:
130
 
131
  - Native Multi Legal Pile (112GB)
132
  - Eurlex Resources (179GB)
133
+ - Legal MC4 (106GB)
134
  - Pile of Law (292GB)
135
 
136
  #### Native Multilingual Legal Pile data
 
172
 
173
  See [Eurlex Resources](https://huggingface.co/datasets/joelito/eurlex_resources#data-instances) for more information.
174
 
175
+ #### Legal-MC4
176
 
177
+ See [Legal-MC4](https://huggingface.co/datasets/joelito/legal-mc4#data-instances) for more information.
178
 
179
  #### Pile-of-Law
180