EXPLORING THE CAPABILITIES OF AUTOMATED TEXT SENTIMENT ANALYSIS USING MODERN LARGE LANGUAGE MODELS
DOI:
https://doi.org/10.32689/maup.it.2025.1.20Keywords:
Text classification, large language models (LLM), sentiment analysis, prompt engineering, Telegram API, user bot, automation of moderation, web development, few-shot learningAbstract
The objective of the study. This article explores the possibilities of automated analysis of political comments using modern large language models (LLM). The aim is to develop a software solution that classifies textual comments into two levels: by emotional tone (positive, negative, neutral) and by the target object of the reaction (event, author, publication style, community). The effectiveness of using LLM for sentiment analysis of political comments based on data from Telegram channels is evaluated. Methodology. To achieve the goal, a software prototype was developed that performs automatic text analysis. The prototype uses two classification dimensions: emotional tone and target object of reaction, taking into account the specifics of the political context. The input data consists of textual posts from Telegram channels and corresponding user comments, and the classification results are achieved using LLM with a few-shot learning approach. Scientific novelty. The developed prototype allows for multidimensional classification of texts, which is an uncommon approach in the study of political discourse, where it is important not only to determine the overall tone of the comment but also to identify who or what the reaction is directed towards. The research also offers strategies to improve classification results, including the integration of dynamic instructions and localization of training on Ukrainian-language data, which could be an important step in enhancing the effectiveness of using LLM for political content in Ukraine. Conclusions. The results of the research showed that LLMs have significant potential for performing multidimensional classification of political comments. However, limitations were identified, particularly in detecting sarcasm and irony, as well as in working with local specific contexts. Proposed improvement strategies, such as adapting the model to Ukrainian-language data and using dynamic prompts, allow for improved accuracy of results. The research highlights the need to adapt LLMs to the political context, especially for content moderation and sociological research. Future research should focus on collecting larger and more balanced datasets for more relevant and generalized results in the operation of the developed software.
References
Київський міжнародний інститут соціології. Results of the all-Ukrainian survey for the European Union Advisory Mission in Ukraine. 2023. URL: https://kiis.com.ua/?lang=ukr&cat=reports&id=1307&page=1 (Дата звернення: 8 листопада 2024).
Павлюк Д. І., Байбуз О. Г. Ресурси збору даних для навчання з учителем для прогнозування суспільних настроїв. У: Кісельова О. М., ред. Математичне та програмне забезпечення інтелектуальних систем (МПЗІС-2024): Тези доповідей ХХІІ Міжнародної науково-практичної конференції. Дніпровський національний університет імені Олеся Гончара. 2024. URL: https://ir.lib.vntu.edu.ua/bitstream/handle/123456789/43697/167315.pdf
Bojic L., Zagovora O., Zelenkauskaite A., Vukovic V., Cabarkapa M., Veseljević Jerkovic S., Jovančevic A. Evaluating large language models against human annotators in latent content analysis: Sentiment, political leaning, emotional intensity, and sarcasm. 2025. URL: https://doi.org/10.48550/arxiv.2501.02532 (Дата звернення: 23 березня 2025).
Feigel L. The Murder of Rosa Luxemburg review – tragedy and farce. The Guardian. 2019. URL: https://www.theguardian.com/books/2019/jan/09/the-murder-of-rosa-luxemburg-by-klaus-gietinger-review (Дата звернення: 21 квітня 2025).
Gole M., Nwadiugwu W.-P., Miranskyy A. On sarcasm detection with OpenAI GPT-based models. 2023. URL: https://doi.org/10.48550/arXiv.2312.04642 (Дата звернення: 23 березня 2025).
Matloga P., Marivate V., Olaleye K. Sentiment analysis using unsupervised learning for local government elections in South Africa. JeDEM – eJournal of eDemocracy and Open Government. 2025. Vol. 17, No. 1. P. 144–169. DOI: https://doi.org/10.29379/jedem.v17i1.945 (Дата звернення: 30 березня 2025).
OpenAI. API pricing. URL: https://openai.com/api/pricing/ (Дата звернення: 10 квітня 2025).
OpenAI. Introducing OpenAI o3 and o4-mini. 2025. URL: https://openai.com/index/introducing-o3-and-o4-mini/(Дата звернення: 10 квітня 2025).
OpenAI. Structured outputs. URL: https://platform.openai.com/docs/guides/structured-outputs (Дата звернення: 10 квітня 2025).
Ornstein J. B., Blasingame A., Truscott J. B. How to Train Your Stochastic Parrot: Large Language Models for Political Texts. 2022. URL: https://joeornstein.github.io/publications/ornstein-blasingame-truscott.pdf (Дата звернення: 23 березня 2025).
Telegram Messenger Inc. Telegram Database Library (TDLib). URL: https://core.telegram.org/tdlib (Дата звернення: 8 листопада 2024).
wiz0u. WTelegramClient[Source code]. 2025. URL: https://github.com/wiz0u/WTelegramClient (Дата звернення: 30 березня 2025).