CONTEXT-AWARE NLP
Sentiment
Analysis.
From a published comparison of BERT and traditional models to a reproducible pipeline and live Streamlit product that treats sentiment and irony as separate classification tasks.
“Great. Another update that broke everything.”
Irony is surfaced as evidence. It does not automatically reverse sentiment.
— PROJECT SNAPSHOT
60-SECOND READA single accuracy score can hide uneven sentiment-model behavior and costly class-level errors
Research design, data preparation, modeling and evaluation
Compare accuracy with macro F1 and inspect errors before choosing a model
Interactive Streamlit sentiment classifier paired with a reproducible sentiment-and-irony pipeline
56,554 cleaned sentiment rows, independent splits, a co-authored publication and a deployed application
Published research · live Streamlit product
Question
The project began with a model-selection question, then evolved into a stricter question about evidence.
When does contextual language understanding justify the additional cost of a transformer over a fast TF-IDF baseline?
Patterns in terms and n-grams
Fast, inspectable and practical for clearer language.
Meaning from both directions
Better suited to negation, ambiguity and context-dependent phrasing.
Data
The current implementation starts with an auditable cleaning pass instead of treating the downloaded rows as ground truth.
irrelevant labels excluded
exact duplicates removed
conflicting texts isolated
missing texts removed
Decode HTML and remove invisible characters
Replace URLs and mentions with stable tokens
Keep case, emojis, punctuation, hashtags and negation
Group by source ID to prevent related-text leakage
Experiment
Every model is evaluated on the same independent test split, with macro F1 used to expose uneven class behavior.
Naive Bayes
It produced the highest headline accuracy, helped by strong recall on negative examples.
Logistic Regression
Its more balanced class performance made it the strongest traditional baseline overall.
Neutral recall
Naive Bayes frequently pulled neutral language toward a stronger sentiment class.
— PUBLISHED BENCHMARK
Context improved the paper’s reported comparison.
The RACCAI study evaluated IMDb reviews and Twitter sentiment. These are paper-reported results, not outputs from the newer repository artifacts.
System
The implementation turns the comparison into a reproducible training system with explicit task boundaries.
Raw social text
Conservative normalization
TF-IDF or tokenizer
Baseline or DistilBERT
Accuracy + macro/weighted F1
SEPARATE TASK HEADS
Detecting irony adds context; it does not mechanically invert the sentiment output.
TRANSFORMER CONFIGURATION
— LIVE PRODUCT
Test the classification workflow in Streamlit.
The deployed interface turns the modeling work into a usable product: enter text, run sentiment classification and inspect the prediction without setting up the repository locally.
Findings
The useful conclusion is not that one model always wins; it is knowing which evidence should drive the choice.
Headline accuracy can hide class imbalance
Macro F1 exposed that neutral language remained harder than the overall score suggested.
Context is valuable when language is genuinely contextual
The published benchmark favoured BERT on longer reviews and short, ambiguous social text.
Efficiency remains a product constraint
Traditional models train quickly, are easier to inspect and remain useful when latency or compute matters.
Irony deserves its own uncertainty signal
A separate irony task is safer than automatically flipping a sentiment prediction.
What the current evidence does not claim.
- The newer transformer training path exists, but no current transformer metric artifact is presented as a completed result.
- Performance can shift across topics, writing styles and time periods.
- Sarcasm and irony remain probabilistic signals, not deterministic corrections.
- The published benchmark and the reproducible repository use different evaluation contexts.
— RACCAI 2024 · AIP 2025
Comparative Study of BERT vs. Traditional Machine Learning Models for Sentiment Analysis
Co-authored research published in AIP Conference Proceedings 3343. Read the complete paper here or open its official publication record.
— THE NEXT DECISION
Have a complex problem
worth simplifying?
I’m exploring entry-level Associate Product Manager and AI Product opportunities where I can combine user understanding, analytical thinking and technical execution.