Commenced in January 2007
Frequency: Monthly
Edition: International
Paper Count: 32586
Real Time Classification of Political Tendency of Twitter Spanish Users based on Sentiment Analysis

Authors: Marc Solé, Francesc Giné, Magda Valls, Nina Bijedic


What people say on social media has turned into a rich source of information to understand social behavior. Specifically, the growing use of Twitter social media for political communication has arisen high opportunities to know the opinion of large numbers of politically active individuals in real time and predict the global political tendencies of a specific country. It has led to an increasing body of research on this topic. The majority of these studies have been focused on polarized political contexts characterized by only two alternatives. Unlike them, this paper tackles the challenge of forecasting Spanish political trends, characterized by multiple political parties, by means of analyzing the Twitters Users political tendency. According to this, a new strategy, named Tweets Analysis Strategy (TAS), is proposed. This is based on analyzing the users tweets by means of discovering its sentiment (positive, negative or neutral) and classifying them according to the political party they support. From this individual political tendency, the global political prediction for each political party is calculated. In order to do this, two different strategies for analyzing the sentiment analysis are proposed: one is based on Positive and Negative words Matching (PNM) and the second one is based on a Neural Networks Strategy (NNS). The complete TAS strategy has been performed in a Big-Data environment. The experimental results presented in this paper reveal that NNS strategy performs much better than PNM strategy to analyze the tweet sentiment. In addition, this research analyzes the viability of the TAS strategy to obtain the global trend in a political context make up by multiple parties with an error lower than 23%.

Keywords: Political tendency, prediction, sentiment analysis, Twitter.

Digital Object Identifier (DOI):

Procedia APA BibTeX Chicago EndNote Harvard JSON MLA RIS XML ISO 690 PDF Downloads 727


[1] M. Cmara, G. Cumbreras, V. Romn, and G. Morera, ”TASS 2015 The Evolution of the Spanish Opinion Mining Systems” Procesamiento del Lenguaje Natural, vol.56, 2016.
[2] J. Schmidhuber. 2015. Deep learning in neural networks. Neural Netw. 61, C (January 2015), 85-117. DOI=
[3] B. Wellman, A. Quan Haase, J. Witte and K. Hampton. ”Does the Internet Increase, Decrease, or Supplement Social Capital?: Social Networks, Participation, and Community Commitment”, American Behavioral Scientist, vol.45, n3, 2014, pp.436–455.
[4] Statista. ”Number of monthly Active Twitter Users Worldwide from 1st quarter 2010 to 3rd quarter 2017 (in millions)”, users/, Date accessed: 01/12/2017.
[5] K. Lee, D. Palsetia, R. Narayanan, Md. Mostofa Ali Patwary, A. Agrawal and A. Choudhary. ”Twitter Trending Topic Classification”. In Proceedings of the IEEE 11th International Conference on Data Mining Workshops (ICDMW ’11). IEEE Computer Society, 2011 pp.251–258.
[6] Beevolve. ”An Exhaustive Study of Twitter Users Across the World”,, 2012, Date accessed: 01/12/2017.
[7] M.M. Uddin, M. Imran and H. Sajjad. ”Understanding Types of Users on Twitter”, ArXiv e-prints, abs/1406.1335, 2014.
[8] L. De Silva and E. Riloff. ”User Type Classification of tweets with Implications for Event Recognition”. Proceedings of the Joint Workshop on Social Dynamics and Personal Attributes in Social Media, 2014, pp.98–108.
[9] N. Mangal, R. Niyogi and A. Milani. ”Analysis of Users’ Interest Based on tweets”, 16th International Conference on Computational Science and Its Applications (ICCSA), 2016.
[10] M. Pennacchiotti and A. Popescu. ”A Machine Learning Approach to Twitter User Classification”, A Machine Learning Approach to Twitter User Classification, 2011, pp.281–288.
[11] EJ. Lee, SY. Shin. ”Are They Talking to Me? Cognitive and Affective Effects of Interactivity in Politicians’ Twitter Communication”, Cyberpsychology, behavior and social networking, vol.15, n.10, 2012, pp.515–520.
[12] DS. Hillygus. The Evolution of Election Polling in the United States, The Public Opinion Quarterly, vol.75, n.5, 2011, pp. 962-981.
[13] La Vanguardia. ”Bad Results in the Forecast of the Elections”, 38/sondeos-elecciones-generales-26j-fallo.html , June 27, 2016, Date accessed: 01/12/2017 (Spanish version).
[14] W. Wanga, D. Rothschil, S. Goel, A. Gelman. ”Forecasting Elections with Non-representative Polls”, International Journal of Forecasting, Vol.31, Issue 3, 2015, pp. 980-991.
[15] D. Preotiuc-Pietro, Y. Liu, D. Hopkins, L. Ungar. ”Beyond Binary Labels: political Ideology Prediction of Twitter Users”, Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, 2017, pp.729–740.
[16] A. Tumasjan, T. Sprenger, P. Sandner, and I. Welpe. ”Predicting Elections with Twitter: What 140 Characters Reveal about political Sentiment”, International AAAI Conference on Weblog and Social Media, 2010, pp.178–185.
[17] Preotiuc-Pietro, D.; Volkova, S.; Lampos, V.; Bachrach, Y. and Aletras, N. Studying User Income through Language, Behaviour and Affect in Social Media. PLoS ONE,10(9), 2015.
[18] K. Sylwester and M. Purver. ”Twitter Language Use Reflects Psychological Differences between Democrats and Republicans”, PLoS ONE, vol.10, n.9, 2015.
[19] MD. Conover, B. Gonalves, J. Ratkiewicz, A. Flammini and F. Menczer. ”Predicting the political Alignment of Twitter Users”, IEEE Third International Conference on Social Computing (SocialCom), 2011, pp:192–199.
[20] Twitter Developers. ”Twitter API”,, Date accessed: 01/12/2017.
[21] L. Jiang, M. Yu, M. Zhou, X. Liu and T. Zhao. ”Target-dependent Twitter sentiment classification”, In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, 2011, pp.151–160.
[22] Y. Wang, Y. Rao, X. Zhan, H. Chen, M. Luo and J. Yin. ”Sentiment and Emotion Classification over Noisy Labels”, Know.-Based Syst., 2016, pp.207–216.
[23] W. Medhat, A.Hassan and H. Korashy. ”Sentiment Analysis Algorithms and Applications: A survey”, In Ain Shams Engineering Journal, Vol.5, Issue 4, 2014, pp.1093–1113.
[24] A. Agarwal, B. Xie, I. Vovsha, O. Rambow and R. Passonneau. ”Sentiment Analysis of Twitter Data”, In Proceedings of the Workshop on Languages in Social Media (LSM ’11), 2011, pp.30–38.
[25] D. Grattarola. ”Twitter Sentiment Classification”,, Date accessed: 1/12/2017.
[26] Hunspell. Hunspell is the spell checker,, 2017, Date accessed: 14/12/2017.
[27] TensorFlow. TensorFlow is an open source software library for numerical computation using data flow graphs,, 2017, Date accessed: 14/12/2017.
[28] Apache Storm. Apache Storm is a free and open source distributed realtime computation system,, 2017, Date accessed: 14/12/2017.
[29] OpenNebula. OpenNebula is a cloud computing platform for managing heterogeneous distributed data center infrastructures,, 2017, Date accessed: 14/12/2017.