With the introduction of the General Data Protection Regulation, many organizations
were left with a large amount of documents containing public information
that should have been private. Given that we are talking about quite large quantities
of documents, it would be a waste of resources to edit them manually. The
objective of this dissertation is the development of an autonomous system for the
anonymization of sensitive information in contracts written in Portuguese.
This system uses Google Cloud Vision, an API to apply the OCR tecnology, to
extract any text present in a document. As there is a possibility that these documents
are poorly readable, an image pre-processing is done using the OpenCV
library to increase the readability of the text present in the images. Among others,
the application of binarization, skew correction and noise removal algorithms were
explored.
Once the text has been extracted, it will be interpreted by an NLP library. In this
project we chose to use spaCy, which contains a Portuguese pipeline trained with
the WikiNer and UD Portuguese Bosque datasets. This library not only allows a
very complete identification of the part of speech, but also contains four different
categories of named entity recognition in its model. In addition to the processing
carried out using the spaCy library, and since the Portuguese language does not
have a great support, some rule-based algorithms were implemented in order to
identify other types of more specific information such as identification number and
postal codes. In the end, the information considered confidential is covered by
a black rectangle drawn by OpenCV through the coordinates returned by Google
Cloud Vision OCR and a new PDF is generated.Com a introdução do Regulamento Geral de Proteção de Dados, muitas organizações
ficaram com uma grande quantidade de documentos contendo informações
públicas que deveriam ser privadas. Dado que estamos a falar de quantidades
bastante elevadas de documentos, seria um desperdício de recursos editá-los manualmente.
O objetivo desta dissertação é o desenvovimento de um sistema autónomo
de anonimização de informação sensível em contratos escritos na língua
Portuguesa.
Este sistema utiliza a Google Cloud Vision, uma API de OCR, para extrair qualquer
texto presente num documento. Como existe a possibilidade desses documentos
serem pouco legíveis, é feito um pré-processamento de imagem através da biblioteca
OpenCV para aumentar a legibilidade do texto presente nas imagens. Entre
outros, foi explorada a aplicação de algoritmos de binarização, correção da inclinação
e remoção de ruído.
Uma vez extraído o texto, este será interpretado por uma biblioteca de nlp, neste
projeto optou-se pelo uso do spaCy, que contém um pipeline português treinado
com os conjuntos de dados WikiNer e UD Portuguese Bosque. Esta biblioteca
não permite apenas uma identificação bastante completa da parte do discurso,
mas também contém quatro categorias diferentes de reconhecimento de entidade
nomeada no seu modelo. Para além do processamento efetuado com o recurso à
biblioteca de spaCy, e uma vez que a língua portuguesa não tem um grande suporte,
foram implementados alguns algoritmos baseados em regras de modo a identificar
outros tipos de informação mais especifica como número de identificação e códigos
postais. No final, as informações consideradas confidenciais são cobertas por um
retângulo preto desenhado pelo OpenCV através das coordenadas retornadas pelo
OCR do Google Cloud Vision e será gerado um novo PDF.Mestrado em Engenharia de Computadores e Telemátic