Skip to content

Sentiment Analysis Model to predict good or positive news from Headlines

License

Notifications You must be signed in to change notification settings

RashikaKarki/GoodNews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoodNews

Sentiment Analysis Model to predict good or positive news from Headlines.

Motivation

After the coronavirus pandemic started the news article had started being overwhelmingly negative with lots of news article covering the death tolls and economic crisis. If we look at the Google Trend on “Positive News” or “Good News” during the time when the Pandemic started, we can clearly see the need of a portal with just positive news.

image

Project Structure

│   .gitignore
│   LICENSE
│   README.md
│   requirements.txt
│
├───App
│   │   main.py
│   │
│   ├───Data
│   │       data.json
│   │
│   ├───Model
│   │       chi_selector.pkl
│   │       logistic_regression.pkl
│   │       vectorizer.pkl
│   │
│   ├───Script
│   │   │   preprocess_data.py
│   │   │   scrape.py
│   │   │   train.py
│   │   │   __init__.py
│
├───Data
│       Clean_data.csv
│       News.csv
│       README.md
│
└───Notebook
    │   Good News Classifying Model - Cleaning.ipynb
    │   Good News Classifying Model.ipynb
    │   replacement.json

Run the API

Make sure you have python3 and pip installed

Create and activate virtual environment using virtualenv

$ python -m venv python3-virtualenv
$ source python3-virtualenv/bin/activate

Use the package manager pip to install all dependencies

pip install -r requirements.txt

Usage

Start flask server

$ export FLASK_APP=main.py
$ flask run

How to call the Flask API?

Get Data

  • API Call: http://127.0.0.1:5000/get_data
  • Request Method: get
  • Returns: JSON
    {
    "Meeting Of Organising Committee Of CPN-UML 10th General Convention On June 30": "Negative",
    "Nepal In Desperate Need Of Life-Saving Vaccines": "Positive",
    "Nepal’S Foreign Policy Has Taken Concrete Shape, Says PM": "Positive",
    "PM Instructs For Prompt Disaster Response, Relief": "Negative"
    }

image

About

Sentiment Analysis Model to predict good or positive news from Headlines

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published