Nepali Sentiment Analysis
Hybrid Transformer + CNN + BiLSTM sentiment model for Nepali text written in both Devanagari and Romanized script, reaching 73.88% accuracy and benchmarked against XLM-RoBERTa and NepaliBERT.
Key result
73.88% accuracy— Benchmarked against XLM-RoBERTa and NepaliBERT
01Problem
Nepali is written in two scripts at once — Devanagari and Romanized transliteration — often mixed within a single sentence. Pretrained English models do not transfer, and the two scripts fragment an already small labeled corpus into inconsistent tokens.
02Objective
Build a sentiment classifier that handles both scripts in one model, and benchmark it honestly against the established multilingual and Nepali-specific baselines rather than reporting a single number in isolation.
03Architecture
- Bi-Script Nepali Text
- Preprocessing
- Transformer Encoder
- CNN + BiLSTM
- Sentiment Classification
04Technology
- Python
- PyTorch
- Transformers
- CNN
- BiLSTM
- NLP
- XLM-RoBERTa
05Implementation
Key technical decisions
- 01Handled Devanagari and Romanized Nepali in a single model rather than training two.
- 02Combined a transformer encoder with CNN and BiLSTM branches, so local n-gram and sequential signal are both represented.
- 03Benchmarked against XLM-RoBERTa and NepaliBERT to place the result against established baselines.
- 04Reported macro-F1 alongside accuracy so minority-class performance stays visible.
What was built
- Preprocessing pipeline covering both writing systems.
- Hybrid Transformer + CNN + BiLSTM architecture.
- Evaluation against XLM-RoBERTa and NepaliBERT baselines.
06Data
Corpus and preprocessing
- Nepali text corpus in Devanagari and Romanized script
- Sentiment labels across the classification task
- Code-mixed text where both scripts appear together
- Preprocessing applied consistently across both writing systems
07Results
73.88%
Accuracy
0.737
Macro-F1
2 baselines
XLM-RoBERTa and NepaliBERT
10Links
No public repository for this one — happy to walk through the code on request.