52. Text Cleaning and TF-IDF in Python
52.5 Practice, Tip and Close
Why. Close when TF-IDF + train-only fit is a habit, then classify sentiment.
How.
Chapter practice
- Build six fictional reviews; split; fit TfidfVectorizer on train only.
- Print shapes and ten feature names.
- Write why fitting the vectoriser on all data (including test) leaks information.
Thodkyaat sangaycha tar (quick recap)
- TF-IDF weights distinctive words higher
- fit on train, transform on test
- ngrams help phrases like "not good"
- Hinglish needs humble expectations + light normalisation
Samajla ka? Next: Chapter 53 — Sentiment Analysis Project in Python.