Portuguese Legal Document PDF Metadata Extractor

by geek2geeks

249 downloads
Not rated
GitHub

About

MCP server for extracting metadata from Portuguese legal documents using advanced PDF processing and database architecture

Details

Author
geek2geeks
Downloads
249
Categories
Other

- High accuracy: 100% confidence, 96.84% exact match rate
- Two extractor variants: production-ready and robust core engine
- Works with or without ground truth data for confidence scoring
- Clear field classification: missing vs. legitimately empty fields
- Batch processing with detailed summaries and progress reporting
- Command line interface with flexible options and quiet mode

Install with Python 3.8+ and pip install pdfplumber. Use via the CLI: python production_extractor.py "pdfs/document.pdf" -o "results/" for single files, or python production_extractor.py "pdfs/" -g "ground_truth/ground_truth.json" -o "results/" for batch processing with ground truth validation. The PortugueseLegalPDFExtractor class also offers a programmatic API for single or batch extraction.

Portuguese Legal Document PDF Metadata Extractor

A robust Python tool for extracting structured metadata from Portuguese legal document PDFs, specifically designed for European Case Law Identifier (ECLI) formatted documents.

πŸš€ Features

- High Accuracy: 100% confidence score with 96.84% exact match rate
- Production Ready: Two extractor variants optimized for different use cases
- Robust Error Handling: Comprehensive validation and error recovery
- Flexible Confidence Scoring: Works with or without ground truth data
- User-Friendly Interface: Clear progress reporting and detailed feedback
- Field Classification: Distinguishes between missing and legitimately empty fields

πŸ“ Project Structure

β”œβ”€β”€ production_extractor.py    # Production-ready extractor with user-friendly interface
β”œβ”€β”€ robust_extractor.py        # Core robust extraction engine
β”œβ”€β”€ run_test1.py              # Test runner for batch processing
β”œβ”€β”€ ground_truth/             # Ground truth data for validation
β”‚   └── ground_truth.json
β”œβ”€β”€ pdfs/                     # Input PDF documents
β”‚   β”œβ”€β”€ test1/               # Test subset
β”‚   └── *.pdf                # Legal documents
β”œβ”€β”€ IMPROVEMENTS_SUMMARY.md   # Performance improvements documentation
└── README.md                # This file

πŸ”§ Installation

Prerequisites

- Python 3.8+
- Required packages:

pip install pdfplumber

Setup

1. Clone or download the project files
2. Install dependencies:

   pip install pdfplumber

3. Ensure your PDF files are in the pdfs/ directory

πŸ“– Usage

Basic Usage with Production Extractor

The PortugueseLegalPDFExtractor class provides a user-friendly, production-ready interface:

```python
from production_extractor import PortugueseLegalPDFExtractor

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.