Transformer-Based Sentiment Analysis of Persian Tweets for Predicting the Iranian Presidential Election

Transformer-Based Sentiment Analysis of Persian Tweets for Predicting the Iranian Presidential Election

Ali Sheikhtaheri1 Zainabolhoda Heshmati2

1) University of Tehran, Iran.
2) University of Tehran, Iran. Email:

IOI Code : ABEB-ACAAAG
Publication : 4th International Conference on Recent Advances in Engineering, Innovation and Technology - Belgium(eitconf.com)
Abstract :
    Social media platforms have become a primary channel through which citizens express political opinions, offering a scalable alternative to conventional election polling, which is costly, slow, and often inaccurate. This paper presents a method for predicting the outcome of the 2021 Iranian presidential election by analyzing the sentiment of Persian-language tweets. Using a purpose-built web crawler based on the Twitter API, we collected 422,938 tweets mentioning seven presidential candidates between April and June 2021. After an extensive Persian-specific cleaning pipeline—including language filtering, duplicate and multi-candidate tweet removal, stop-word elimination, and lemmatization—each remaining tweet was scored on a five-level scale from −2 to +2 using ParsiNLU, a pre-trained Persian transformer model. A vote-inference rule then aggregated per-user scores across candidates to infer each user s vote, with abstention for negative-only or neutral users. The aggregated prediction correctly identified the election winner and the fourth-ranked candidate, with only a one-rank transposition between the second- and third-placed candidates; an independent graph-based analysis of user–candidate sentiment networks corroborated the ranking. The results demonstrate that transformer-based sentiment analysis of Persian social media can reliably forecast election outcomes.

Keywords : election forecasting graph analysis natural language processing sentiment analysis social media transformer models