File size: 2,212 Bytes
cb700bb
ee56efd
 
cb700bb
ee56efd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb700bb
ee56efd
 
 
9daf09c
ee56efd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
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}%")