## 1 Introduction  
The Internet generates a massive amount of data daily, much of which is textual information ranging from formal, partially structured content found in news articles and informative blogs to the informal, subjective, ironic, and sarcastic text common on social media platforms. Analyzing this type of data is challenging even for humans, as it heavily depends on context. Businesses receive substantial information from social media and their applications, such as customer feedback and reviews, although managing this overwhelming volume can be difficult and may compromise the quality of the service provided. In the restaurant industry, for instance, popular reservation and online ordering platforms such as Zomato allow customers to leave reviews and ratings, enabling restaurant owners to extract valuable insights to assess whether their products and services meet customer expectations. A sentiment is a feeling, emotion, or opinion expressed through thoughts, words, or actions. Sentiment analysis (SA) is a subfield of natural language processing (NLP) in active development that focuses on automating the extraction and classification of opinions and primarily centers on the valence of emotions, categorizing them as positive, negative, or neutral. It deals with the challenge of understanding the literal meaning of words, their contextual and semantic roles, and the author's intentions to classify the sentiments expressed. Deep learning (DL) models constitute the current state of the art for solving complex natural language tasks by extracting patterns from processed text [1; 2; 3]. Today, large language models (LLMs) trained on vast non-domain-specific datasets allow enterprises to perform natural language tasks with some ease. However, the resulting models are usually large and considerably resource-demanding, becoming difficult to run locally and highly costly to train on graphics processing units (GPUs) [4]. Hence, it is relevant to develop models prepared for specific tasks to optimize their performance and reduce hardware requirements, providing advantages in terms of data safety, enhanced interpretability, and ownership of the model. This study investigates the document-level SA using Portuguese data and proposes a model based on recurrent mechanisms and self-attention mechanisms to represent text data and extract contextual information. Despite Portuguese being among the top five most spoken languages in the world, with approximately 171 million Internet users (representing 3.7% of all users) [5], limited research has been conducted on this language. Nevertheless, in recent years, there has been an increased number of publications addressing NLP problems in the Portuguese language, primarily focusing on Brazilian Portuguese, and to a lesser extent European Portuguese. The lack of linguistic resources is the main reason for this, leading to most studies focusing on providing resources. The most relevant surveys in the literature regarding broad NLP applications were published by [PERSON] and [PERSON] [6] in 2020, [PERSON] et al. [7] in 2021, [PERSON] et al. [3] in 2022, and [PERSON] et al. [8] in 2024. They compared various DL models and provided a walk-through of their evolution, overviewing their architectures and describing current state-of-the-art trends and challenges. Furthermore, [PERSON] [9] performed an extensive survey of multiple approaches to sentiment analysis tasks in Portuguese, including rule-based, conventional machine learning, and deep learning. A main gap that was identified is that most approaches started with English and then adapted to Portuguese, instead of having a model that was developed and optimized in Portuguese from the start. Such was the main goal of this work, where we intended to develop a model in Portuguese text, optimized by a genetic algorithm (GA). [PERSON] et al.