Comparative Analysis of BERT and ChatGPT in the Recognition of Named Entities in the Legal Domain

Authors

DOI:

https://doi.org/10.5753/reic.2025.3903

Keywords:

Artificial intelligence, NER, Bert, GPT model, ChatGPT

Abstract

This work presents a comparative analysis of two pre-trained language models, BERT and ChatGPT, for named entity recognition in legal texts. The objective is to evaluate the performance of these models in an essential task for extracting relevant and specific information from unstructured legal documents. The BERT model is trained with the LENER-BR dataset, which contains legal texts annotated with the following categories of entities: Jurisprudence, Legislation, Location, Organization, Person and Time. The ChatGPT model is used without additional training, taking advantage of its prior knowledge of natural language. The metrics used for evaluation are accuracy, precision, recall and F1-score. The results show that the BERT model outperforms the ChatGPT model in NER on the LENER-BR dataset in all metrics. The work contributes to the NLP community by providing an analysis of the models and their limitations, as well as suggestions for future work.

Downloads

Download data is not yet available.

References

Albuquerque, H. O., Costa, R., Silvestre, G., Souza, E., da Silva, N. F. F., Vitório, D., Moriyama, G., Martins, L., Soezima, L., Nunes, A., Siqueira, F., Tarrega, J. P., Beinotti, J. V., Dias, M., Silva, M., Gardini, M., Silva, V., de Carvalho, A. C. P. L. F., and Oliveira, A. L. I. (2022). UlyssesNER-Br: A Corpus of Brazilian Legislative Documents for Named Entity Recognition. In Computational Processing of the Portuguese Language, pages 3–14, Cham. Springer. DOI: 10.1007/978-3-030-98305-5_1.

Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. (2020). Language Models are Few-Shot Learners. Disponível em [link].

Chaves, L. S. (2021). Utilizando um modelo transformer no processo de identificação de entidades nomeadas em textos criminais. Trabalho de Conclusão de Curso Graduação em Ciência da Computação, Universidade Federal do Ceará, Campus de Quixadá, Quixadá. Disponível em [link].

Che, W., Wang, M., Manning, C. D., and Liu, T. (2013). Named entity recognition with bilingual constraints. In Vanderwende, L., Daumé III, H., and Kirchhoff, K., editors, Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 52–62, Atlanta, Georgia. Association for Computational Linguistics. Disponível em [link].

Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. (2019). Bert: Pre-training of deep bidirectional transformers for language understanding. Disponível em [link].

Faceli, K., Lorena, A. C., Gama, J., Almeida, T. A. d., and de Carvalho, A. C. P. d. L. F. (2021). Inteligência Artificial: Uma Abordagem de Aprendizado de Máquina. LTC. Disponível em [link].

Garcia, G. C. (2021). Reconhecimento de Entidades Nomeadas na base de notificações de eventos adversos e queixas técnicas de dispositivos médicos no Brasil. Dissertação de Mestrado em Profissional em Computação Aplicada, Universidade de Brasília, Brasília. Disponível em [link].

Gutterres, E. D. (2022). Definição de modelo de reconhecimento de entidade nomeada para detecção automática de tópicos de aplicativos em português. Trabalho de Conclusão de Curso Graduação em Ciências da Computação, Universidade Federal de Santa Catarina, Florianópolis. Disponível em [link].

Lara, J. and Lobo, G. (2021). Busca semântica em documentos da área biomédica relacionados com COVID-19. Trabalho de Conclusão de Curso Graduação em Sistemas de Informação, Ânima Educação, Brasil. Disponível em [link].

Luz de Araujo, P. H., de Campos, T. E., de Oliveira, R. R., Stauffer, M., Couto, S., and Bermejo, P. (2018). LeNER-Br: a dataset for named entity recognition in Brazilian legal text. In Computational Processing of the Portuguese Language: 13th International Conference, PROPOR 2018, Canela, Brazil, September 24–26, 2018, Proceedings 13, pages 313–323. Springer. DOI: 10.1007/978-3-319-99722-3_32.

Mauricio, A., Pinheiro, V., Furtado, V., Neto, J. A. M., Bomfim, F. d. C. J., da Costa, A. C. F., Silveira, R., and Aragão, N. (2023). Cdjur-br–a golden collection of legal document from brazilian justice with fine-grained named entities. arXiv preprint arXiv:2305.18315. Disponível em [link].

Môro, D. K. (2018). Reconhecimento de Entidades Nomeadas em Documentos de Língua Portuguesa. Trabalho de Conclusão de Curso Graduação em Tecnologias da Informação e Comunicação, Universidade Federal de Santa Catarina, Florianópolis. Disponível em [link].

Ratinov, L. and Roth, D. (2009). Design challenges and misconceptions in named entity recognition. In Stevenson, S. and Carreras, X., editors, Proceedings of the Thirteenth Conference on Computational Natural Language Learning (CoNLL-2009), pages 147–155, Boulder, Colorado. Association for Computational Linguistics. Disponível em [link].

Sarrion, E. (2023). What Is ChatGPT? In Proceedings of the Conference on Exploring the Power of ChatGPT. Apress, Berkeley, CA. DOI: 10.1007/978-1-4842-9529-8_1.

Silva, A. V. e. and Lopes, M. (2023). Um modelo híbrido para o Reconhecimento de Entidades Nomeadas em português. Estudos Linguísticos (São Paulo. 1978), 51(3):1317–1335. DOI: 10.21165/el.v51i3.3271.

Silva, P. R. (2020). Promptify: Prompt engineering for named entity recognition (ner). Disponível em [link].

Silveira, R., Ponte, C., Almeida, V., Pinheiro, V., and Furtado, V. (2023). Legalbert-pt: A pretrained language model for the brazilian portuguese legal domain. In Brazilian Conference on Intelligent Systems, pages 268–282. Springer. DOI: 10.1007/978-3-031-45392-2_18.

Sousa, E. B. G. and Mello, R. F. (2022). Aplicação de Reconhecimento de Entidades Nomeadas para Análise Automática de Textos Narrativos em Produções Textuais do Ensino Fundamental. In Anais Estendidos do XI Congresso Brasileiro de Informática na Educação. SBC. DOI: 10.5753/cbie_estendido.2022.226747.

Strubell, E., Verga, P., Andor, D., Weiss, D., and McCallum, A. (2018). Linguistically-informed self-attention for semantic role labeling. Disponível em [link].

Wu, e. a. (2019). Bert for named entity recognition. arXiv preprint. Disponível em [link].

Xavier, N. P. (2022). Modelagem e análise de base de conhecimento para um chatbot. Disponível em [link].

Yan, H., Deng, B., Li, X., and Qiu, X. (2019). Tener: Adapting transformer encoder for named entity recognition. Disponível em [link].

Zhong, Q., Ding, L., Liu, J., Du, B., and Tao, D. (2023). Can chatgpt understand too? a comparative study on chatgpt and fine-tuned bert. Disponível em [link].

Published

2025-05-30

How to Cite

Araujo, G., & Silveira, R. (2025). Comparative Analysis of BERT and ChatGPT in the Recognition of Named Entities in the Legal Domain. Electronic Journal of Undergraduate Research on Computing, 23(1), 63–68. https://doi.org/10.5753/reic.2025.3903

Issue

Section

Full Papers