Fixaro's picture
Update README.md
9daf09c verified
|
Raw
History Blame Contribute Delete
2.21 kB
---
language:
- my
license: mit
tags:
- aspect-based-sentiment-analysis
- absa
- sentiment-analysis
- burmese
- myanmar
- text-classification
- xlm-roberta
pipeline_tag: text-classification
metrics:
- f1
- precision
- recall
- accuracy
base_model:
- FacebookAI/xlm-roberta-base
library_name: transformers
---
# Myanmar ABSA - Stage 2 (Aspect-Level Sentiment Classification)
This model is a fine-tuned version of `xlm-roberta-base` trained on Burmese customer reviews formatted as sentence pairs (`review_text`, `target_aspect`). It predicts the sentiment polarity for a given target aspect.
## Sentiment Classes:
- **`0`**: `Negative`
- **`1`**: `Neutral`
- **`2`**: `Positive`
---
## Supported Aspect Names:
1. `product_or_service_quality`
2. `fulfillment_and_speed`
3. `price_and_value`
4. `digital_experience`
5. `customer_support`
6. `variety_and_availability`
---
## Usage Example (Sentence-Pair Classification)
```python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
MODEL_NAME = "Fixaro/myanmar-absa-sentiment-classification"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME)
# Input text and the specific aspect to evaluate
review_text = "ဒီဆိုင်က ဝန်ဆောင်မှု အရမ်းကောင်းတယ်၊ ဒါပေမဲ့ ပို့ဆောင်ခ အရမ်းကြီးတယ်။"
target_aspect = "customer_support"
# 1. Tokenize as a Sentence Pair (Review Text + Target Aspect)
inputs = tokenizer(review_text, target_aspect, return_tensors="pt", truncation=True, max_length=128)
# 2. Predict Sentiment
with torch.no_grad():
logits = model(**inputs).logits
# Apply Softmax for 3-class probability distribution
probs = torch.softmax(logits, dim=-1).squeeze().tolist()
predicted_class_id = torch.argmax(logits, dim=-1).item()
SENTIMENTS = ["Negative", "Neutral", "Positive"]
print(f"Target Aspect : {target_aspect}")
print(f"Predicted Sentiment : {SENTIMENTS[predicted_class_id]}")
print(f"Confidence Scores : Negative={probs[0]*100:.1f}%, Neutral={probs[1]*100:.1f}%, Positive={probs[2]*100:.1f}%")