Nate Chambers, Department of Computer Science, US Naval Academy
To the right is a visualization of how one country (e.g., the USA) views the rest of the world...measured automatically from social media posts. We completed a two year study of Twitter users across the world to measure the sentiment that they express toward other nations. This brief page provides a summary of the work, a visualization to navigate the data, and raw data for download.
This study tracked the sentiment (emotion) of Twitter users when they write about nation states. When a Twitter user mentions a country by name (the 'target'), we apply what is called contextual sentiment analysis to automatically identify the user's emotional state toward the mentioned country. Given a user's profile information, we can also infer their country of origin (the 'source'), and sometimes GPS coordinates from mobile devices provide an even more precise location. Each tweet potentially results in a source/target country pair and an emotion (positive, negative, or objective) that was expressed toward the target. By summing all such pairs and emotions across all country pairs, we can develop a picture of how a nation views its neighbors. The map on the right shows the sentiment of USA users, but we can visualize most major nations. Click on the map to play with the tool.
The dataset is a random sample of Twitter users who mention one of the world's ~200 countries by name. We use the Twitter API with keyword search on English forms of the names. Each day returned between 3-6 million tweets, and with almost 2 years of data, we processed around 3 billion tweets.
Sentiment detection was not quite sufficient. Given the diversity of topics on social media, several filters were machine learned to focus on actual opinions toward nations (e.g., our program learned to filter out tweets about food and sporting events). The national sentiment of a country toward another is measured as the ratio between the number of positive tweets and negative tweets over a given time period.
Details about the approach are published in the Proceedings for Empirical Methods in Natural Language Processing (2015): Identifying Political Sentiment between Nation States with Social Media.
The publication below contains full details. One of the clearest results shows that our sentiment ratios are strongly correlated with human public opinion polls. High precision is also found when comparing to countries with a recent history of conflicts.
Nathanael Chambers, Victor Bowen, Ethan Genco, Xisen Tian, Eric Young, Ganesh Harihara, Eugene Yang.
Identifying Political Sentiment between Nation States with Social Media.
In Proceedings of Empirical Methods in Natural Language Processing. Lisbon, Portugal. September, 2015.
Download the PDF
Aggregate counts (all country pairs)
Line format: <target-nation> <average-ratio-over-all-nations> <nation1> <ratio-toward-nation1> <positive-count-nation1> <negative-count-nation1> <objective-count-nation1> <nation2> ...
Two-week sentiment ratio sums (all country pairs)
First line: nation-pair <week1-end-date> <week2-end-date> ... <weekN-end-date>
All other lines: <nation-pair> <total-count-between-pair> <week1-sentiment-ratio> <week2-sentiment-ratio> ... <weekN-sentiment-ratio>
Per-day sentiment ratio sums (all country pairs)