← Back to portfolio

Case Study · NLP / Text Classification

Fake News Detector — NLP classification pipeline.

An end-to-end NLP workflow that cleans article text, vectorizes it with TF-IDF, and compares multiple classical classifiers side by side — built to stay interpretable rather than reach for a black box.

  • Text cleaning & preprocessing pipeline (tokenization, stopword removal, normalization)
  • TF-IDF vectorization feeding several classical ML classifiers
  • Same train/test split reused across every model for a fair comparison

How the pipeline works

Every stage is kept explicit and inspectable, from raw text to a labeled prediction.

Text cleaning

Lowercasing, punctuation stripping, and stopword removal bring raw article text into a consistent shape before vectorizing.

TF-IDF vectorization

Term frequency–inverse document frequency turns cleaned text into weighted feature vectors that reflect word importance, not just word count.

Multiple classifiers

Several classical classifiers are trained on the same features so their behavior can be compared directly, not just their headline score.

Metric comparison

Precision, recall, and F1 are reported per model — accuracy alone doesn’t tell the whole story on an imbalanced news dataset.

Reproducible split

A fixed train/test split keeps every classifier comparison fair and the results reproducible on a re-run.

Clear reporting

Results are laid out per classifier rather than buried in a single summary number, so trade-offs stay visible.

Workflow

Step 01

Clean & normalize text

Strip noise from raw article text — casing, punctuation, and stopwords — so the vectorizer sees signal, not formatting.

Step 02

Vectorize with TF-IDF

Convert cleaned text into weighted feature vectors that emphasize words that are distinctive, not just frequent.

Step 03

Train & compare classifiers

Fit several classical classifiers on identical features and the same split, then compare precision, recall, and F1 side by side.

Full source

Explore the code

This case study covers the approach at a glance — the notebook with cleaning, vectorization, and classifier comparisons in full lives on GitHub.