Last active
April 12, 2023 13:49
-
-
Save sergiolucero/e3253ac0d5f16e309963194cc4ecb967 to your computer and use it in GitHub Desktop.
pdf legal conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, fitz, pandas as pd | |
files = glob.glob('folder/*.pdf') | |
texts = [' '.join([page.get_text() for page in fitz.open(fn)]) | |
for fn in files] | |
df = pd.DataFrame(dict(file=files, text=texts)) | |
df['cuerpo'] = df.text.apply(lambda t: remove_headandsentence) | |
df['fallo'] = df.text.apply(lambda t: extract_fallo) | |
df.to_csv('sentencias.csv', index=False) | |
print(sum(len(txt) for txt in texts)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pip install PyMuPDF