Block 110: Mini-Project: Sentiment Analysis Tool
Build a complete NLP pipeline from raw text to predictions.
Concepts
- Combining preprocessing + feature extraction + model + evaluation
- Comparing traditional ML vs transformer approach
- Presenting NLP results
Code Examples
See exercise below.
Exercise
Build a sentiment analysis pipeline: (a) with TF-IDF + Logistic Regression, (b) with Hugging Face pipeline. Compare accuracy on a labelled dataset (IMDb or similar). Report which is better and why. Wrap the better model into a simple function analyze_sentiment(text) → {'label': ..., 'confidence': ...}.
Homework
Reflection: Write a 'NLP workflow cheat sheet' — the 8 steps from raw text to a working model.