This study provides an insightful analysis of Peruvian political approval rating sentiment, using Twitter data and applying various ranking algorithms. Despite the challenging context of political instability, the research achieved a high degree of accuracy, with Linear SVC classification leading the way. The detailed breakdown of the results and the evident correlation between tweet sentiment and real-world events provide compelling validation of the chosen methods. The authors’ exploration of various machine learning techniques amplifies the relevance of the study. The research collected 8274 tweets from the @presidenciaperu account, employing API v2 during the month of April 2023, regarding the government’s political approval rating, with the objective of identifying the accuracy of Machine Learning algorithms NB multinomial, NB Bernoulli, Support Vector linear classifier, Logistic regression classifier and KNeighbors classifier from the sentiment analysis of Tweets in Spanish language. Tweets were processed using PLN, words were vectorized with the bag of words algorithm, allowing to build a vocabulary of 5773 tweets with negative (0) and positive (1) polarity in tweets with the support of Python and BETO. Five machine learning sentiment analysis techniques were compared, resulting in an accuracy of 96.3636% (F1Score = 0.98) for the linear SVC, an accuracy of 95.3246% (F1Score = 0.98) for the KNeighbors classifier, an accuracy of 95.2380% (F1Score = 0.98) for the logistic regression classifier, and a tie in accuracy of 94.8051% for NB multinomial and NB Bernoulli. The results indicate that the optimal algorithm was the Support Vector linear classifier with 96.3636% accuracy applied in a Peruvian political approval index environment. © The Author(s), under exclusive license to Springer Nature Switzerland AG 2024.
Author Keywords
Index Keywords