Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: si
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- sinhala
|
| 6 |
+
- emotion-classification
|
| 7 |
+
- text-classification
|
| 8 |
+
- fine-tuned
|
| 9 |
+
- low-resource
|
| 10 |
+
- multilingual
|
| 11 |
+
base_model: NLPC-UOM/SinBERT-large
|
| 12 |
+
pipeline_tag: text-classification
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Sinhala Text Emotion Recognition Model
|
| 16 |
+
|
| 17 |
+
Fine-tuned RoBERTa-style transformer for **multi-class emotion classification in Sinhala text**.
|
| 18 |
+
Detects basic emotions from Sinhala sentences/comments (e.g. social media, news).
|
| 19 |
+
Trained for 6 epochs on a Sinhala emotion dataset; validation accuracy 86% (modest performance – typical for initial fine-tuning in low-resource Sinhala NLP; suggest more epochs or Sinhala-pretrained base for better results).
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
|
| 23 |
+
### Model Description
|
| 24 |
+
|
| 25 |
+
- **Developed by:** Bimsara Serasinghe
|
| 26 |
+
- **Shared by:** Bimsara Serasinghe
|
| 27 |
+
- **Model type:** Text Classification (fine-tuned encoder-only transformer for multi-class emotion detection)
|
| 28 |
+
- **Language(s) (NLP):** Sinhala (සිංහල)
|
| 29 |
+
- **License:** Apache-2.0
|
| 30 |
+
- **Finetuned from model:** NLPC-UOM/SinBERT-large
|
| 31 |
+
|
| 32 |
+
### Model Sources
|
| 33 |
+
|
| 34 |
+
- **Repository:** https://huggingface.co/ShanukaB/SInhala_Text_Emotion_Recognition_Model
|
| 35 |
+
|
| 36 |
+
## Uses
|
| 37 |
+
|
| 38 |
+
### Direct Use
|
| 39 |
+
|
| 40 |
+
Classify Sinhala text directly via Hugging Face `pipeline` into one of the emotion classes.
|
| 41 |
+
|
| 42 |
+
### Downstream Use
|
| 43 |
+
|
| 44 |
+
- Emotion-aware Sinhala chatbots & virtual assistants
|
| 45 |
+
- Monitoring emotions in Sinhala social media (Facebook comments, YouTube, Twitter/X)
|
| 46 |
+
- Mental health & wellbeing tools for Sinhala speakers
|
| 47 |
+
- Customer support emotion detection in Sinhala
|
| 48 |
+
- Academic/research projects on low-resource Sinhala affective computing
|
| 49 |
+
|
| 50 |
+
### Out-of-Scope Use
|
| 51 |
+
|
| 52 |
+
- High-stakes automated decisions (e.g. psychological diagnosis, legal judgments)
|
| 53 |
+
- Real-time safety-critical systems without human validation
|
| 54 |
+
- Non-Sinhala languages (expected very poor performance)
|
| 55 |
+
|
| 56 |
+
### Recommendations
|
| 57 |
+
|
| 58 |
+
- Always pair model outputs with human review for sensitive applications (mental health, support)
|
| 59 |
+
- Fine-tune longer or switch to Sinhala-specific pre-trained models (e.g. SinBERT variants if available)
|
| 60 |
+
- Test on your target domain (e.g. news vs. casual chat) before deployment
|
| 61 |
+
- Report dialect/code-mixed failures to improve community versions
|
| 62 |
+
|
| 63 |
+
## How to Get Started with the Model
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from transformers import pipeline
|
| 67 |
+
import joblib # if using saved label encoder
|
| 68 |
+
|
| 69 |
+
classifier = pipeline(
|
| 70 |
+
"text-classification",
|
| 71 |
+
model="YOUR_USERNAME/YOUR_MODEL_NAME",
|
| 72 |
+
tokenizer="YOUR_USERNAME/YOUR_MODEL_NAME"
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
# Optional: load label encoder if uploaded to repo
|
| 76 |
+
# label_encoder = joblib.load("label_encoder.pkl")
|
| 77 |
+
|
| 78 |
+
texts = [
|
| 79 |
+
"මම ගොඩක් සතුටින් ඉන්නවා! 😊",
|
| 80 |
+
"මේක බලල බයයි වෙලා... 😨",
|
| 81 |
+
"අපිට මේක ගැන කෝපයි ගොඩක්!"
|
| 82 |
+
]
|
| 83 |
+
|
| 84 |
+
for text in texts:
|
| 85 |
+
result = classifier(text)[0]
|
| 86 |
+
# If labels are "LABEL_0" etc., map manually or use saved encoder
|
| 87 |
+
print(f"Text: {text}")
|
| 88 |
+
print(f"→ Emotion: {result['label']} (confidence: {result['score']:.3f})\n")
|