News Article Classification NLP
2024CompletedNLP

News Article Classification NLP

News Article Classification NLP project cover

Metrics & Visuals

0.65
HOT Threshold
24 hours
Scrape Window
5
Pipeline Steps
CSV
Export Format
3
Models Used
Diagram
Pipeline overview

Pipeline overview. App screenshots coming soon.

Overview

An end-to-end NLP pipeline that scrapes Malay Mail news articles, summarizes them with PEGASUS, generates headlines with T5, classifies sentiment using DistilBERT, and evaluates with ROUGE — all driven by a Streamlit dashboard. The pipeline automates the full lifecycle from raw news to structured, labelled, and summarized data ready for analytics.

Key Features

  • Scrapy spider for Malay Mail news — scrapes last 24 hours of articles
  • AWS S3 integration for raw data storage and final results output
  • PEGASUS (google/pegasus-cnn_dailymail) for abstractive summarization of full articles
  • T5 (JulesBelveze/t5-small-headline-generator) for generating new context-aware headlines
  • DistilBERT multilingual sentiment classifier — labels each article as HOT or NOT HOT
  • Configurable HOT threshold (default 0.65 confidence)
  • ROUGE evaluation: ROUGE-1 (unigram), ROUGE-2 (bigram), ROUGE-L (LCS) with F1/Precision/Recall
  • Step-by-step Streamlit UI — run each stage individually or all at once
  • CSV export of classified results directly from the browser

How It Works

  1. 1Scrapy spider scrapes Malay Mail → raw CSV pushed to AWS S3
  2. 2Pipeline orchestrator pulls raw CSV → text_cleaner preprocessing
  3. 3PEGASUS model generates abstractive summary for each article
  4. 4T5 model generates new headline from article body
  5. 5DistilBERT classifies sentiment → HOT or NOT HOT label
  6. 6ROUGE evaluator scores headline quality → final CSV pushed to S3
  7. 7Streamlit dashboard displays results at each step with CSV download

System Architecture

Data Collection
Scrapy Spider
Malay Mail news
AWS S3
Raw CSV storage
Preprocessing
text_cleaner.py
Clean + normalize
NLP Models
PEGASUS
Summarization
T5 Small
Headline generation
DistilBERT
Sentiment: HOT/NOT
Evaluation
ROUGE Scorer
F1 / Precision / Recall
Output
Streamlit Dashboard
Step-by-step UI
CSV Export
Download results
Data Flow
Scrapy Spider→AWS S3(raw CSV)

Roadmap

  • Add more news sources (The Star, Bernama)
  • Schedule pipeline with Apache Airflow for daily runs
  • Multi-label classification (politics, finance, sports)
  • Deploy to AWS EC2 with auto-daily runs
  • Dockerize with docker-compose

Tech Stack

Models
PEGASUS (CNN/DailyMail)T5 Small (Headline Gen)DistilBERT (Multilingual Sentiment)
Scraping & Storage
Scrapy 2.11AWS S3 (boto3)pandas
Evaluation
ROUGE-1ROUGE-2ROUGE-L
UI & Deployment
StreamlitHuggingFace TransformersPyTorch 2.2