Categories: Articles, News

by Ardiana Spahija


Categories: Articles, News

by Ardiana Spahija


How did Sweden’s politicians communicate prior to the election? Who was the most negative in their posts? Who tweeted the most about foreign policy, and who was by far the most active on Twitter? Politweet is a tool developed by Softhouse using AI to analyse the Twitter posts of Sweden’s politicians during the year prior to the election.

After election results are determined, there is a period when parties, media, and others do their post-election analyses. What strategies did the winning parties use? And how have the party leaders communicated? Politweet, originally a student project at Softhouse, analyses and visualises all the party leaders’ tweets in 2022.

Analysing tweets with AI was easier than we thought. I have worked with machine learning for many years and have seen the work usually required to get decent accuracy. Here we quickly got very far by building on the rapid development of recent years, says Kerstin Johnsson, Machine Learning Engineer at Softhouse.

The analyses show both expected patterns and some surprises. Magdalena Andersson’s tweets were mainly positive in tone and dominated by foreign policy. By far, the most active in the number of tweets was Annie Lööf.

The AI engine performing the analysis classifies the Twitter posts in three perspectives: in subject categories, by sentiment, i.e., whether they are positive, negative, or neutral, and by what partisan political target they have. The visualisation is done in an interactive app that is open and accessible to everyone. Try it yourself!

Politweet consists partly of a Twitter-scraper and partly of an AI module built on powerful language analysis models, so-called Large Language Models (LLM), which form the basis of the analysis itself. The AI module is made up of two parts: a custom-written call to the GPT-3 language model and a custom-built classifier that takes the right specific class from GPT-3 into one of a predetermined number of classes.

Politweet was created with the help of students during a summer project with guidance from our AI consultants. We have released the source code as Open Source to be accessible for anyone to build on.


Do you want to know more about how we at Softhouse work with AI? Contact our expert:

Kerstin Johnson

AI and Machine Learning Engineer

+46 73- 912 30 47

Related Posts


Subscribe to our newsletter.