Datasets:

Languages:
Portuguese
Size Categories:
10M<n<100M
ArXiv:
Tags:
legal
LegalPT_dedup / README.md
eduagarcia's picture
Update README.md
faf40c8 verified
---
language:
- pt
size_categories:
- 10M<n<100M
pretty_name: LegalPT (deduplicated)
dataset_info:
- config_name: all
features:
- name: id
dtype: int64
- name: source
dtype: string
- name: orig_id
dtype: int64
- name: text
dtype: string
splits:
- name: train
num_bytes: 85489203570
num_examples: 11946015
download_size: 44555786476
dataset_size: 85489203570
- config_name: acordaos_tcu
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 2543994549.48221
num_examples: 462031
download_size: 1566036137
dataset_size: 2543994549.48221
- config_name: datastf
features:
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
- name: id
dtype: int64
splits:
- name: train
num_bytes: 1555024472.2888384
num_examples: 310119
download_size: 853863429
dataset_size: 1555024472.2888384
- config_name: iudicium_textum
features:
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
- name: id
dtype: int64
splits:
- name: train
num_bytes: 692805629.2689289
num_examples: 153373
download_size: 372281973
dataset_size: 692805629.2689289
- config_name: mlp_pt_BRCAD-5
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 3523570990.7531776
num_examples: 542680
download_size: 1883985787
dataset_size: 3523570990.7531776
- config_name: mlp_pt_CJPG
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 28122511051.563988
num_examples: 6260096
download_size: 19944599978
dataset_size: 28122511051.563988
- config_name: mlp_pt_eurlex-caselaw
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 1134175020.033026
num_examples: 78893
download_size: 609610934
dataset_size: 1134175020.033026
- config_name: mlp_pt_eurlex-contracts
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 343350961.1607806
num_examples: 8511
download_size: 99128584
dataset_size: 343350961.1607806
- config_name: mlp_pt_eurlex-legislation
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 2316503707.9080825
num_examples: 95024
download_size: 1051142246
dataset_size: 2316503707.9080825
- config_name: mlp_pt_legal-mc4
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 4400930935.870118
num_examples: 187637
download_size: 2206590934
dataset_size: 4400930935.870118
- config_name: parlamento-pt
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 2265120232.5456176
num_examples: 2109931
download_size: 1189159296
dataset_size: 2265120232.5456176
- config_name: tesemo_v2
features:
- name: id
dtype: int64
- name: text
dtype: string
- name: meta
struct:
- name: dedup
struct:
- name: exact_norm
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: exact_hash_idx
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash
struct:
- name: cluster_main_idx
dtype: int64
- name: cluster_size
dtype: int64
- name: is_duplicate
dtype: bool
- name: minhash_idx
dtype: int64
splits:
- name: train
num_bytes: 27248474341
num_examples: 1737720
download_size: 12906298228
dataset_size: 27248474341
configs:
- config_name: all
data_files:
- split: train
path: all/train-*
- config_name: acordaos_tcu
data_files:
- split: train
path: acordaos_tcu/train-*
- config_name: datastf
data_files:
- split: train
path: datastf/train-*
- config_name: iudicium_textum
data_files:
- split: train
path: iudicium_textum/train-*
- config_name: mlp_pt_BRCAD-5
data_files:
- split: train
path: mlp_pt_BRCAD-5/train-*
- config_name: mlp_pt_CJPG
data_files:
- split: train
path: mlp_pt_CJPG/train-*
- config_name: mlp_pt_eurlex-caselaw
data_files:
- split: train
path: mlp_pt_eurlex-caselaw/train-*
- config_name: mlp_pt_eurlex-contracts
data_files:
- split: train
path: mlp_pt_eurlex-contracts/train-*
- config_name: mlp_pt_eurlex-legislation
data_files:
- split: train
path: mlp_pt_eurlex-legislation/train-*
- config_name: mlp_pt_legal-mc4
data_files:
- split: train
path: mlp_pt_legal-mc4/train-*
- config_name: parlamento-pt
data_files:
- split: train
path: parlamento-pt/train-*
- config_name: tesemo_v2
data_files:
- split: train
path: tesemo_v2/train-*
tags:
- legal
---
# LegalPT (deduplicated)
LegalPT aggregates the maximum amount of publicly available legal data in Portuguese, drawing from varied sources including legislation, jurisprudence, legal articles, and government documents.
This version is deduplicated using [MinHash algorithm](https://dl.acm.org/doi/abs/10.5555/647819.736184) and [Locality Sensitive Hashing](https://dspace.mit.edu/bitstream/handle/1721.1/134231/v008a014.pdf?sequence=2&isAllowed=y), following the approach of [Lee et al. (2022)](http://arxiv.org/abs/2107.06499).
The raw version is also available [here](https://huggingface.co/datasets/eduagarcia/LegalPT).
## Dataset Details
Dataset is composed by six corpora:
[Ulysses-Tesemõ](https://github.com/ulysses-camara/ulysses-tesemo), [MultiLegalPile (PT)](https://arxiv.org/abs/2306.02069v2), [ParlamentoPT](http://arxiv.org/abs/2305.06721),
[Iudicium Textum](https://www.inf.ufpr.br/didonet/articles/2019_dsw_Iudicium_Textum_Dataset.pdf), [Acordãos TCU](https://link.springer.com/chapter/10.1007/978-3-030-61377-8_46), and
[DataSTF](https://legalhackersnatal.wordpress.com/2019/05/09/mais-dados-juridicos/).
- [**MultiLegalPile**](https://huggingface.co/datasets/joelniklaus/Multi_Legal_Pile) ([Paper](https://arxiv.org/abs/2306.02069v2)): a multilingual corpus of legal texts
comprising 689 GiB of data, covering 24 languages in 17 jurisdictions. The corpus is separated by language, and the subset in Portuguese contains 92GiB of data,
containing 13.76 billion words. This subset includes the jurisprudence of the Court of Justice of São Paulo (CJPG), appeals from the
[5th Regional Federal Court (BRCAD-5)](https://www.kaggle.com/datasets/eliasjacob/brcad5), the Portuguese subset of
legal documents from the European Union, known as [EUR-Lex](https://huggingface.co/datasetsjoelniklaus/eurlex_resources), and a filter for legal documents from
[MC4](http://arxiv.org/abs/2010.11934).
- [**Ulysses-Tesemõ**](https://github.com/ulysses-camara/ulysses-tesemo): a legal corpus in Brazilian Portuguese, composed of 2.2 million documents, totaling about 26GiB of text obtained from 96 different data sources. These sources encompass legal, legislative, academic papers, news, and related comments. The data was collected through web scraping of government websites.
- [**ParlamentoPT**](PORTULAN/parlamento-pt) ([Paper](http://arxiv.org/abs/2305.06721)): a corpus for training language models in European Portuguese. The data was collected from the Portuguese government portal and consists of 2.6 million documents of transcriptions of debates in the Portuguese Parliament.
- [**Iudicium Textum**](https://dadosabertos.c3sl.ufpr.br/acordaos/) ([Paper](https://www.inf.ufpr.br/didonet/articles/2019_dsw_Iudicium_Textum_Dataset.pdf)): consists of rulings, votes, and reports from the Supreme Federal Court (STF) of Brazil, published between 2010 and 2018. The dataset contains 1GiB of data extracted from PDFs.
- [**Acordãos TCU**](https://www.kaggle.com/datasets/ferraz/acordaos-tcu) ([Paper](https://link.springer.com/chapter/10.1007/978-3-030-61377-8_46)): an open dataset from the Tribunal de Contas da União (Brazilian Federal Court of Accounts), containing 600,000 documents obtained by web scraping government websites. The documents span from 1992 to 2019.
- [**DataSTF**](https://legalhackersnatal.wordpress.com/2019/05/09/mais-dados-juridicos/)): a dataset of monocratic decisions from the Superior Court of Justice (STJ) in Brazil, containing 700,000 documents (5GiB of data).
### Dataset Description
- **Language(s) (NLP):** Portuguese (pt-BR and pt-PT)
- **Repository:** https://github.com/eduagarcia/roberta-legal-portuguese
- **Paper:** https://aclanthology.org/2024.propor-1.38/
## Data Collection and Processing
LegalPT is deduplicated using [MinHash algorithm](https://dl.acm.org/doi/abs/10.5555/647819.736184) and [Locality Sensitive Hashing](https://dspace.mit.edu/bitstream/handle/1721.1/134231/v008a014.pdf?sequence=2&isAllowed=y), following the approach of [Lee et al. (2022)](http://arxiv.org/abs/2107.06499).
We used 5-grams and a signature of size 256, considering two documents to be identical if their Jaccard Similarity exceeded 0.7.
Duplicate rate found by the Minhash-LSH algorithm for the LegalPT corpus:
| **Corpus** | **Documents** | **Docs. after deduplication** | **Duplicates (%)** |
|--------------------------|:--------------:|:-----------------------------:|:------------------:|
| Ulysses-Tesemõ | 2,216,656 | 1,737,720 | 21.61 |
| MultiLegalPile (PT) | | | |
| CJPG | 14,068,634 | 6,260,096 | 55.50 |
| BRCAD-5 | 3,128,292 | 542,680 | 82.65 |
| EUR-Lex (Caselaw) | 104,312 | 78,893 | 24.37 |
| EUR-Lex (Contracts) | 11,581 | 8,511 | 26.51 |
| EUR-Lex (Legislation) | 232,556 | 95,024 | 59.14 |
| Legal MC4 | 191,174 | 187,637 | 1.85 |
| ParlamentoPT | 2,670,846 | 2,109,931 | 21.00 |
| Iudicium Textum | 198,387 | 153,373 | 22.69 |
| Acordãos TCU | 634,711 | 462,031 | 27.21 |
| DataSTF | 737,769 | 310,119 | 57.97 |
| **Total (LegalPT)** | **24,194,918** | **11,946,015** | **50.63** |
## Citation
```bibtex
@inproceedings{garcia-etal-2024-robertalexpt,
title = "{R}o{BERT}a{L}ex{PT}: A Legal {R}o{BERT}a Model pretrained with deduplication for {P}ortuguese",
author = "Garcia, Eduardo A. S. and
Silva, Nadia F. F. and
Siqueira, Felipe and
Albuquerque, Hidelberg O. and
Gomes, Juliana R. S. and
Souza, Ellen and
Lima, Eliomar A.",
editor = "Gamallo, Pablo and
Claro, Daniela and
Teixeira, Ant{\'o}nio and
Real, Livy and
Garcia, Marcos and
Oliveira, Hugo Gon{\c{c}}alo and
Amaro, Raquel",
booktitle = "Proceedings of the 16th International Conference on Computational Processing of Portuguese",
month = mar,
year = "2024",
address = "Santiago de Compostela, Galicia/Spain",
publisher = "Association for Computational Lingustics",
url = "https://aclanthology.org/2024.propor-1.38",
pages = "374--383",
}
```
## Acknowledgment
This work has been supported by the AI Center of Excellence (Centro de Excelência em Inteligência Artificial – CEIA) of the Institute of Informatics at the Federal University of Goiás (INF-UFG).