Skip to content
An official website of the OECD. Find out more
Created by the Public Governance Directorate

This website was created by the OECD Observatory of Public Sector Innovation (OPSI), part of the OECD Public Governance Directorate (GOV).

How to validate authenticity

Validation that this is an official OECD website can be found on the Innovative Government page of the corporate OECD website.

Artificial Intelligence Applied to the Decoding of Law

Creation of a functional prototype of a system, using AI, that assists the citizen in identifying and solving issues related to consumer law and retirement status.

Innovation Summary

Innovation Overview

INCM edits electronically the Diário da República (DR), the official newspaper of the Portuguese Republic, which is exclusively available on the portal Diário da República Eletrónico (DRE) on DRE.PT as a public service of universal and free access.

Access to the DRE allows consultation of all Portuguese Legislation, but it still has great potential to evolve at the Citizen's Service level, particularly in services that allow the user to find the rules and procedures that relate to their particular need (the reason that led them to consult the legislation).

The rules associated with a given consultation (complaint, calculation of a pension, etc.) are enshrined in the body of law made available by the DRE. Often these rules require consultation of different pieces of legislation and present the need for a technical and detailed interpretation. For example, if a Consumer wants to complain about a particular purchase or service, which sector of activity or even the supervisory entity can he address? This, among other use cases are clarifiers of the existing potential around the evolution of services enabled by new technological trends.

The Project "Decoding the Legislation" results from partnerships between INCM and national scientific institutions and other governmental institutions, and intended to develop Artificial Intelligence tools for the DRE, facilitating consultation by citizens. Repositories were implemented with data sources and metadata from the DRE and, using natural language processing, the legal attributes are transformed into code language, and a web application was developed that allows intelligent queries to a given Law.

The case studies chosen to test the AI tools are the Consumer Rights Legislation and the Retirement Statute. A proof of concept was carried out, which will be refined in the future, in which the DRE will have an intelligent search mechanism in which Citizens can ask questions about these sets of legislation and get answers automatically.

As this is a pioneering project applying Artificial Intelligence techniques to the processing of a vast body of legislation, it is necessary to continue to focus on the processing and curation of the corpus of basic legislation for search engines and semantic treatment of the information.
On the other hand, it is fundamental to maintain the conditions for joint development with scientific institutions, both for the adoption of new advanced methods in the treatment of this information and for the training of resources and transfer of knowledge to the business world and the general public.

The continued commitment to the development of these techniques and solutions will be reinforced with training and refinement of the models developed, contributing to provide citizens with efficient services to exercise their rights and duties.

Innovation Description

What Makes Your Project Innovative?

The main innovation of the project is to make the legal rules consumable by digital systems, so they can be used by services and citizens. The instantiation of two concrete practical cases: the access to the Consumer Rights and the Retirement Statute, allows to give answers to questions that a normal citizen asks, without having great technical knowledge about the mentioned laws.
The adoption and availability of these new paradigms will be a key component in the digital transformation of governments, particularly as we seek to integrate service delivery, automate the exchange of information and decisions, ensuring government transparency, responsiveness and accountability.

What is the current status of your innovation?

The innovation is currently under implementation.

Innovation Development

Collaborations & Partnerships

The project was developed by a multidisciplinary team, including INCM researchers with extensive technical and business knowledge, researchers from INESC-ID and the Data Science Knowledge Center of the Nova School of Business & Economics, as well as the Directorate General of Consumer Affairs itself, ensuring unique technical and scientific skills for the project's success.

Users, Stakeholders & Beneficiaries

The main user and beneficiary of the project is the citizen himself, who has at his disposal an easy-to-use service that allows him to have answers to questions regarding Consumer Law, or the Statute of Retirement, through search algorithms and semantic treatment of the information contained in the Law.

It is also a project that contributes to the scientific advancement and knowledge creation of graduate students in the area of natural language processing.

Innovation Reflections

Results, Outcomes & Impacts

Regarding the functional prototype of the Retirement Laws, a conversation tool was developed that will incorporate the most relevant conversation flows in the selected context; the conversation flows according to the rules derived previously and the development of mechanism for detecting changes in legislation. It was concluded that the type of technology applied is adequate and has the potential to increase the tools available to access legislation, especially for non-legal professionals because it performs a semantic search.

Regarding the Consumer Law prototype, further testing demonstrated that the Legal Semantic Search Engine (LeSSE) can improve, even without available query examples, using a technique developed in the context of this project. With this technique, a semantic representation is automatically extracted from legal texts, and then used to automatically generate sets of semantic pairs (questions/answers) that will be used later.

Challenges and Failures

There were no significant deviations in the project, being part of the project's future plan, the training of the developed models to improve the possible search queries. Since this is an application of Artificial Intelligence techniques (Natural Language Processing), there is a need to integrate the largest number of query results and the respective annotations in the models, in order to robust the quality of the results obtained.

The results obtained are very promising and show that the use of semantic-based approaches has a strong potential to improve the retrieval and search systems for Portuguese law. The use of more advanced techniques and a broader training, with a larger corpus of legislation, may enable the increasing adoption of this new paradigm in the consultation of legal information, by citizens.

Conditions for Success

Citizens may have difficulty interpreting a given piece of legislation available to them. There are some approaches to meet this challenge; for example, the governments of Singapore and Israel or Stanford University and Aberdeen University (among others) and software companies are working on projects to turn legislation into reusable software code, empowering the delivery of digital services with the application of AI techniques.

There will have to be greater investment in the application of more advanced techniques. From experience with the project, success will be achieved with:

  • Investment in knowledge to find more efficient ways to analyze legislation and the complexity associated with capturing, the calculation rules of a given law;
  • Greater investment in computing infrastructure, given the technological complexity inherent to the massive treatment of data, cataloging and classification of the same;
  • Dissemination of the potential of these solutions."


The work done in the project has never been done before for legislative documents written in Portuguese, as far as our research allowed us to ascertain. However, being a project with a high innovation component, it also carries a high risk and it is not possible to guarantee that all objectives will be met in an entirely satisfactory manner.

A major challenge will correspond to the creation of a set of training texts corresponding to the required characteristics, starting from the body of legislation on consumer law and replicating it to other areas of law.

Replication for other areas of law can also be enhanced by the use of deep learning techniques, but these rely on large resources, such as large amounts of data and processing power.

Lessons Learned

The adoption of this type of technology in legal information search engines is pioneering, even at an international level, showing that technology can be used to assist citizens in common tasks of searching for information about their rights, even those with little digital literacy, as it abstracts the user from the advanced technologies that support their searches.

It should also be noted that the project had a high degree of dissemination, INCM having presented the project in two international conferences, namely the Digital Transformation in Migration EMN Annual Conference and the European Forum of Member State Official Journals and the EU Publications Office.

INCM is finalizing a White Paper that addresses how artificial intelligence and NLP techniques affect and improve the way the citizen interacts with the Electronic Official Gazette, as well as the impact on the quality of legal search engine results.

Year: 2022
Level of Government: National/Federal government


  • Implementation - making the innovation happen

Innovation provided by:

Date Published:

4 November 2022

Join our community:

It only takes a few minutes to complete the form and share your project.