Does sentiment analysis understand Taglish?
I ran three off-the-shelf sentiment models on 2,000 code-switched tweets. One of them did surprisingly well; the other two mostly guessed.
- nlp
- taglish
- python
Why bother?
Most sentiment models are trained on monolingual English. But a huge chunk of Filipino social media is Taglish: English and Tagalog mixed mid-sentence.
So the question was simple: if you point a standard model at real Taglish text, does it still work, or does it fall apart?
The multilingual model (XLM-R) hit 78% accuracy. The two English-only models landed around 52–55%, barely better than a coin flip.
Setup
- Collected 2,000 public tweets with at least one Tagalog and one English word
- Hand-labelled each as positive, negative, or neutral
- Ran three pretrained models with no fine-tuning
- Compared predictions against my labels
from transformers import pipeline
clf = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment")
clf("grabe ang ganda ng weather today, sobrang happy ko")
# [{'label': 'positive', 'score': 0.93}]The English-only models had a clear failure mode: anything with Tagalog negation (hindi, wala) was usually read as neutral.
XLM-R handled negation much better, but still struggled with sarcasm, which, to be fair, so do people.
Code-switching isn't noise. It's how a lot of people actually talk.
What's next
Next up: fine-tuning on a small labelled Taglish set to see how far a few hundred examples can push things. Dataset notes are in data/README.md, and the original idea came from this paper.