Giter Site home page Giter Site logo

newsml's Introduction

The Echo Chamber

Welcome to The Echo Chamber, a platform designed to offer a multifaceted perspective on current events by diversifying your news feed and challenging your views with a spectrum of viewpoints. Here, critical thinking is ignited, and informed decisions are made. Listen, learn, and engage in dynamic conversations.

Features

  • News Fetching: Retrieve news articles based on search queries or categories using the NewsAPI.
  • Sentiment Analysis: Analyze the sentiment of news articles to understand the overall tone.
  • Recommendation System: Get recommendations for similar news articles based on content similarity.

Installation

Prerequisites

  • Python 3.7 or higher
  • Virtual Environment (optional but recommended)

Setup

  1. Clone the repository:

    git clone https://github.com/krsnathkr/NewsML.git
    cd NewsML
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Set up environment variables: Create a .env file in the root directory and add your NewsAPI key:

    API_KEY=your_newsapi_key_here

Usage

Running the Application

Start the Streamlit application by running:

streamlit run app.py

Functionality

  1. Search for News:

    • Enter a search query to fetch relevant news articles.
    • The articles will be displayed along with their sentiment analysis.
    • Select an article to get recommendations for similar articles.
  2. Category News:

    • Select a news category from the sidebar to fetch top headlines in that category.
    • The articles will be displayed along with their sentiment analysis.
    • Select an article to get recommendations for similar articles.

Code Overview

api.py

Handles fetching news articles from the NewsAPI based on query or category.

def fetch_news(query):
    # Fetches news articles based on a search query.

def fetch_news_by_category(category):
    # Fetches top headlines based on a category.

sentiment.py

Performs sentiment analysis on the fetched news articles.

def analyze_sentiment(articles):
    # Analyzes the sentiment of the provided articles.

model.py

Prepares and operates the recommendation system for suggesting similar news articles.

def prepare_recommendation_system(df):
    # Prepares the recommendation system based on article content.

app.py

The main application script that integrates the news fetching, sentiment analysis, and recommendation features using Streamlit for the user interface.

Contributing

We welcome contributions to enhance The Echo Chamber. Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.