Project image

AI Legal Text Processing

AI-powered system using LLMs to automate the consolidation of municipal regulations and their amendments into unified, error-free documents.

The Challenge

Municipal governments face a constant stream of regulatory amendments published in official gazettes. Manually incorporating these changes into consolidated regulation texts is a slow, error-prone process that requires careful legal interpretation and document management. Maintaining up-to-date, consolidated versions of municipal regulations is a significant administrative burden, hindering transparency and accessibility of current legal information for both staff and citizens.

The Technical Solution

A prototype system was developed to explore whether Large Language Models (LLMs) could automate the consolidation of regulations and their amendments, transforming an unstructured legal text processing task into a streamlined digital workflow.

  1. Intelligent Document Processing Pipeline: The system combines OCR technology to extract text from PDF documents with OpenAI models to analyze, structure, and generate updated consolidated texts. The modular architecture handles the complete workflow: content recognition, text extraction, amendment application, and results visualization.
  2. Hybrid Approach for Complex Documents: Regulations often contain complex tabular data (merged cells, multi-page tables). The system uses a combined approach: OCR for textual content and specialized LLM processing for tables, converting everything into a structured JSON format before final consolidation.
  3. Interactive Web Application: The prototype provides a browser-based interface requiring no technical expertise. Users can upload a regulation and its amendments, then view a side-by-side comparison of the original and updated versions, ensuring full transparency in how changes were applied.

Results and Impact

The project successfully demonstrated that LLM technology can transform municipal document management, delivering several concrete benefits:

  • Dramatically Faster Processing: Automated consolidation reduces processing time from hours or days to minutes, freeing administrative staff for higher-value work.
  • Improved Accuracy and Consistency: The system significantly reduces human error and ensures amendments are applied consistently across all sections of a regulation.
  • Enhanced Transparency: The side-by-side comparison view makes all changes immediately visible and verifiable, improving both internal review processes and public accessibility.

This project was developed as part of an EDIH Adria 'Test Before Invest' initiative to explore AI applications in public administration. For more details, you can read the official success story.