Skip to content

A Flask web app that analyzes sentiment in news articles and generates word clouds to visualize emotional trends in current events

License

Notifications You must be signed in to change notification settings

alexquilis1/news-sentiment-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 News Sentiment Analysis Web App

A Flask-powered web application that analyzes sentiment in news articles and generates beautiful word clouds to visualize emotional trends in current events.

Python Flask License

🎯 What it does

This web app takes any topic you're curious about and:

  • 🔍 Fetches the latest news articles from across the web
  • 🧠 Analyzes the emotional tone of each article
  • 📈 Shows you whether the coverage is positive, negative, or neutral
  • ☁️ Creates stunning word clouds to visualize the most common terms

Perfect for understanding public sentiment on current events, trending topics, or any subject you're researching!

✨ Features

  • 🔎 Smart Topic Search - Enter any keyword and get relevant news articles
  • 😊😐😞 Sentiment Classification - Automatic categorization into positive, negative, and neutral
  • 📊 Visual Analytics - Beautiful charts showing sentiment distribution
  • ☁️ Word Cloud Generation - Separate word clouds for each sentiment category
  • 🧹 Intelligent Text Processing - Removes noise, URLs, and irrelevant content
  • 🌐 Real-time Data - Fresh news articles from the News API

🛠️ Built With

  • Flask - Lightweight Python web framework
  • News API - Real-time news data source
  • NLTK - Natural language processing toolkit
  • VADER Sentiment - Lexicon-based sentiment analysis
  • WordCloud - Word cloud generation
  • Pandas - Data manipulation and analysis

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/alexquilis1/news-sentiment-analyzer.git
    cd news-sentiment-analyzer
  2. Install dependencies

    pip install -r requirements.txt
  3. Set up your API key

    Create a config.py file in the project root:

    API_KEY = "your_news_api_key_here"
  4. Download NLTK data (first time only)

    import nltk
    nltk.download('punkt')
    nltk.download('stopwords')
    nltk.download('wordnet')

Usage

  1. Start the application

    python app.py
  2. Open your browser and navigate to http://localhost:5000

  3. Enter a topic (e.g., "climate change", "artificial intelligence", "olympics")

  4. Explore the results - View sentiment distribution and word clouds!

🎓 What I Learned

This was one of my early Python projects where I explored:

  • Web development with Flask
  • Natural language processing techniques
  • Data visualization and web scraping
  • API integration and data manipulation
  • Text preprocessing and sentiment analysis algorithms

🤝 Contributing

Feel free to dive in! Open an issue or submit a pull request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

Alex Quilis - Initial work - alexquilis1


Enjoyed this project? Give it a star to show your support!

About

A Flask web app that analyzes sentiment in news articles and generates word clouds to visualize emotional trends in current events

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published