Sentiment Analysis of Comments on Peruvian Draft Laws Using Machine Learning and Deep Learning Techniques
摘要
Public trust in political and legal institutions is essential for the proper functioning of democracy. The legality and acceptability of the legislation and reforms enacted are significantly affected by the widespread mistrust of Peru’s political institutions, particularly the Congress of the Republic. This study explores the use of Machine Learning (ML) and Deep Learning (DL) techniques to analyze the sentiment of public comments on Peruvian bills. The proposed methodology consists of five phases: dataset collection; preprocessing; feature extraction (Tf-Idf, Bag of Words, and Word2Vec); model implementation (ML (LR, SVM, NB, and RF), DL (LSTM, CNN, BERTA, RoBERTa, and RNN)); and evaluation. The results of the transformer-based models, such as BERT and RoBERTa, achieved superior performance in validation with accuracy rates of 88.94% and 89.61%, respectively, indicating better generalization and handling of complex sentiment nuances. Overall, the study concludes that transformer-based models such as BERT and RoBERTa offer higher accuracy and better adaptability to complex sentiment contexts, especially in legal and political discourse.