Public Sentiment Analysis
Executive Summary
We supported an academic research team by developing a machine learning pipeline to analyze Twitter sentiment around the UK's National Food Strategy. The system classified over 1,200 tweets by sentiment and stakeholder type, uncovering how different groups responded to proposed food system reforms. The findings were published and presented across university platforms and conferences.
Case Study: AI-Powered Sentiment Analysis in Food Policy Research
Client
A university research team exploring public and media responses to the UK National Food Strategy (NFS).
Engagement Overview
We were brought in to support a cross-institutional research project analyzing how social media users reacted to a major UK government policy proposal. Our role was to design and implement a machine learning solution that could classify tweets by sentiment and stakeholder type, helping the researchers build a clearer picture of how the NFS was received in public discourse.
The results were included in a peer-reviewed publication and featured on academic platforms including the University of Edinburgh and the Royal Veterinary College.
Objective: Understanding Public Opinion Through Twitter
The research aimed to complement a media framing analysis with sentiment analysis of Twitter data. By analyzing tweets referencing food policy, Brexit, and agricultural trade, the team hoped to uncover the emotional responses and framing patterns that traditional media coverage often overlooks.
Custom Sentiment Analysis Pipeline
- Data Size: Over 1,200 relevant tweets collected from a one-year period surrounding the NFS publication.
- Classification: Tweets were categorized by sentiment (positive, neutral, negative) and tagged with stakeholder types (e.g., general public, academics).
- Methodology:
- Tweets were first filtered using a support vector machine (SVM) classifier trained on a manually labeled subset.
- Sentiment was analyzed using a bi-directional LSTM model for improved nuance.
- Preprocessing included emoji normalization, slang handling, and filtering for non-retweets in English from Great Britain.
Key Challenges
- Emoji & Slang: Informal language required special handling to preserve sentiment cues.
- Sarcasm Detection: Subtle tone shifts were common in politically charged content.
- Stakeholder Classification: Mapping user metadata to stakeholder types involved manual rule definition and iterative validation.
- To improve model reliability, we used consensus-based training labels from three researchers, accepting only data where all agreed on classification.
Outcomes & Impact
- A predominance of negative sentiment across tweets (nearly 70%)
- Public concern over animal welfare, supply chains, trade deals, and Brexit-related policy
- Disparity between traditional media narratives and grassroots public sentiment
- These insights contributed to the broader academic framing analysis and were published as part of a mixed-methods study.
Technologies Used
Python (scikit-learn, StatsModels, TensorFlow), Twitter API v2 (academic access), custom data preprocessing scripts.
Collaboration Style
We worked closely with lead researchers at both the Royal Veterinary College and University of Edinburgh, aligning our work with academic standards and publication requirements. The project was collaborative, iterative, and focused on transparency and reproducibility.