IDEAS home Printed from https://ideas.repec.org/a/spr/jcsosc/v8y2025i4d10.1007_s42001-025-00431-6.html
   My bibliography  Save this article

Analyzing public sentiment in Iranian presidential elections on Twitter using large language models

Author

Listed:
  • Mojgan Askarizade

    (Ardakan University)

  • Ensieh Davoodijam

    (Arak University)

Abstract

This study investigates the dynamics of public sentiment surrounding the 2024 Iranian presidential election by analyzing Persian-language tweets. We introduce the IranElectionTweet dataset, a comprehensive collection of 111,386 election-related tweets enriched with textual content, user metadata, and engagement indicators. Due to the sensitive political context and privacy considerations, the full dataset is not publicly released; instead, we provide a manually annotated subset of 500 tweets (Tweet IDs and dates) for benchmarking, along with reconstruction instructions and analysis code. To conduct sentiment analysis, we fine-tuned GPT-4 on a publicly available Persian sentiment dataset, adapting it to the linguistic and cultural nuances of Persian political discourse. In parallel, we evaluated three cutting-edge large language models, Claude Sonnet 3.7, DeepSeek-V3, and Grok-4, using a few-shot learning framework due to the unavailability of fine-tuning access at the time of experimentation. All models were benchmarked on a manually annotated subset of 500 tweets. DeepSeek-V3 attained the highest weighted F1-score and overall accuracy, indicating stronger performance on the majority classes and was selected as the primary model for sentiment classification. The final sentiment analysis was applied to the full dataset, capturing hourly and daily variations in sentiment and candidate mentions throughout the election period. The results reveal distinct patterns in public opinion corresponding to key political events, offering valuable insights into the real-time evolution of electoral sentiment on social media. This research highlights the effectiveness of advanced multilingual language models in low-resource settings and contributes to the broader understanding of political behavior in digital environments.

Suggested Citation

  • Mojgan Askarizade & Ensieh Davoodijam, 2025. "Analyzing public sentiment in Iranian presidential elections on Twitter using large language models," Journal of Computational Social Science, Springer, vol. 8(4), pages 1-31, November.
  • Handle: RePEc:spr:jcsosc:v:8:y:2025:i:4:d:10.1007_s42001-025-00431-6
    DOI: 10.1007/s42001-025-00431-6
    as

    Download full text from publisher

    File URL: http://link.springer.com/10.1007/s42001-025-00431-6
    File Function: Abstract
    Download Restriction: Access to the full text of the articles in this series is restricted.

    File URL: https://libkey.io/10.1007/s42001-025-00431-6?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to

    for a different version of it.

    More about this item

    Keywords

    ;
    ;
    ;
    ;
    ;

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:spr:jcsosc:v:8:y:2025:i:4:d:10.1007_s42001-025-00431-6. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.springer.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.