Skip to content

Analysing the sentiment of news headlines over time using Python.

Notifications You must be signed in to change notification settings

phoenixpereira/News-Sentiment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News Sentiment Analysis

This project analyses the evolution of sentiment in news headlines over time, utilising Python and Pandas for data manipulation, and Hugging Face Transformers models for sentiment analysis, emotion analysis, and keyword analysis. For more details, you can view the Project Proposal, Final Presentation, and Final Report.

Data Sources

The dataset comprises of news headlines spanning from 2007 to 2021, sourced from Kaggle:

Usage

Step 1 - Filtering Data

  1. Run python filterGBandUS.py to filter data specific to the United Kingdom and the United States.
  2. Run python filterAll.py to filter data in the whole dataset.

Step 2 - Sentiment Analysis

  1. Run python sentiment/analysis.py for sentiment analysis.
  2. Run python sentiment/graph.py to generate visualisations based on the sentiment data.

Sentiment

Step 3 - Emotion Analysis

  1. Run python emotion/analysis.py for emotion analysis.
  2. Run python emotion/graph.py to visualise the emotion analysis results.

Emotion

Step 4 - Keywords Analysis

  1. Run python keywords/analysis.py, python keywords/analysis2.py, and python keywords/combine.py for keyword analysis.
  2. Run python keywords/graph.py to visualise the keyword analysis results.

Keywords