Pre processing tools for documents with legal content.
Project description
Legal Pre-processing
Pre processing tools for documents with legal content. Authors: Daniel Henrique Arruda Boeing and Israel Oliveira.
Usage:
Donwload the JSON files that could be used as examples.
$ mkdir -p data_dicts && cd data_dicts
$ wget https://gitlab.com/israel.oliveira.softplan/legal-pre-processing/-/raw/master/data/LegalRegExPatterns.json
$ wget https://gitlab.com/israel.oliveira.softplan/legal-pre-processing/-/raw/master/data/LegalStopwords.json
$ wget https://gitlab.com/israel.oliveira.softplan/legal-pre-processing/-/raw/master/data/TesauroRevisado.json
Load helper class and laod dictionaries.
>>> from legal_pre_processing.load_data import LoadDicts
>>>
>>> dicts = LoadDicts('legal_dicts/')
>>> dicts.List
['LegalRegExPatterns', 'TesauroRevisado', 'LegalStopwords']
Load the class LegalPreprocess and and instantiate it.
>>> from legal_pre_processing.legal_pre_processing import LegalPreprocess
>>>
>>> model = LegalPreprocess(domain_stopwords=dicts.LegalStopwords, tesauro=dicts.TesauroRevisado, regex_pattern=dicts.LegalRegExPatterns)
Load a PDF file with PyMuPDF (or other extractor) and do some tests:
>>> import fitz
>>>
>>> doc = fitz.open('some_pdf_file_with_legal_content.pdf')
>>> page = doc[page_number-1].get_text()
>>> print(page)
"...Com a concordância das partes foi utilizada prova emprestada em relação aos depoimentos de algumas testemunhas de defesa (decisões de 28/10/2016, 07/11/2016, de 10/11/2016 e de 09/02/2017, nos eventos 114, 175 e 199, e depoimentos nos eventos 187, 200, 287 e 513)...."
>>> page_preprocess = model.ProcessText(page)
>>> print(page_preprocess)
"concordancia utilizada PROVA_EMPRESTADA relacao depoimentos algumas testemunhas defesa decisoes eventos depoimentos eventos"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for legal-pre-processing-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523b33a57415b4faefb9a5b92a6ad643169558d3fcb810d3102c5f393545d555 |
|
MD5 | 30f86cd31146d23a7b8a0de6be5bd3b7 |
|
BLAKE2b-256 | 6b71decda99739b682dd4ebe2e15e7558993d0f03ee224c71e3a7ff82008ea1b |
Close
Hashes for legal_pre_processing-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3595173e5effda6c5dfa7ad2439736ded34ead2d51510ded257d73e100117d88 |
|
MD5 | aead56435210069a17bc3894a3259647 |
|
BLAKE2b-256 | 293acc9d122fb3f9d1d27a3ea0eb6aeb3f09a5aee0cadff3dde585ba2f3d9be1 |