Sentiment Analysis Model to predict good or positive news from Headlines.
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.
│ .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
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
Start flask server
$ export FLASK_APP=main.py
$ flask run
- 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"
}