Skip to content
/ Buzz Public

AI model for summarizing and categorizing news articles

License

Notifications You must be signed in to change notification settings

YamanSD/Buzz

Repository files navigation

Buzz 📰

Flask Kaggle Matplotlib Pandas Python scikit-learn

main

Project Overview & Technologies

  • This project aims to predict the topic of a given news article using Latent Semantic Analysis (LSA) and Latent Dirichlet Allocation (LDA).
  • It also compares the performance of both algorithms using t-Distributed Stochastic Neighbor Embedding (TSNE) to plot the clusters.
  • The project leverages the Newspaper3K library to fetch news articles, Flask for the web interface, and FinBERT for financial sentiment analysis.
  • To ensure efficiency, multiprocessing is used to run each model as a separate process.
  • The ABC "A Million News Headlines" dataset is used to train the models.

Features

  • Topic Prediction: Predicts the topic of a given news article using LSA and LDA by spitting out predicted keywords.
  • Web Interface: Intuitive web interface to interact with the Flask server.
  • Multiprocessing: Runs each model as a separate process to enhance efficiency.
  • Sentiment Analysis: Uses FinBERT API to predict the sentiment of the news article.
  • Automatic Data Fetching: Uses Kaggle's CroissantML format to automatically download and store the data in parquet format.

Installation

  1. Create a config.json file in the root directory of the project. The structure of the file must match that of example_config.json.
  2. [Optional] Create a virtual python environment and initialize it.
  3. Install the project requirements by running the following command pip install -r requirements.txt.
    • Note that this project requires Python 3.11.8 and on some systems you must run pip3 install -r requirements.txt.

t-SNE Results

Bokeh was used to generate the following plots:

lsa

lda

Unsurprisingly, LDA does a better job at separating the articles into clusters.

Usage

  1. Change into the project directory and start the server by python . or python3 .
  2. Access the web interface at http://127.0.0.1:{PORT FROM config.json}.

Examples

  • This example uses the following link:

ex0

  • This example uses the following link, which blocks the download:

ex0

  • This example uses the following link:

ex0

License

MIT License

Copyright (c) 2024

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.