SemEvalWorkshop/sem_eval_2014_task_1
Updated • 278 • 1
Aspect Sentiment Triplet Extraction (ASTE) model trained on SemEval + MAMS datasets. Given a sentence, it extracts (aspect, opinion, sentiment) triplets.
yangheng/deberta-v3-base-absa-v1.1pip install pyabsa
from pyabsa import AspectSentimentTripletExtraction as ASTE
extractor = ASTE.AspectSentimentTripletExtractor(
checkpoint="<your-username>/brand-absa-emcgcn"
)
result = extractor.predict("The battery life is great but the screen is terrible")
print(result)
# [('battery life', 'great', 'Positive'), ('screen', 'terrible', 'Negative')]
sentences = [
"The food was amazing but the service was slow.",
"Great camera quality, terrible battery life.",
"The price is reasonable and the build quality is solid.",
]
results = extractor.predict(sentences)
for sentence, triplets in zip(sentences, results["triplets"]):
print(f"{sentence}")
for aspect, opinion, sentiment in triplets:
print(f" - Aspect: {aspect} | Opinion: {opinion} | Sentiment: {sentiment}")
| Parameter | Value |
|---|---|
| Base model | yangheng/deberta-v3-base-absa-v1.1 |
| Epochs | 50 |
| Batch size | 16 |
| Learning rate | 1e-5 |
| Max seq length | 128 |
| Optimizer | AdamW |
| Seed | 42 |
Training data:
Total training examples: 3,634 | Validation: 885 | Test: 1,466
Each triplet is (aspect_term, opinion_term, sentiment) where sentiment is one of:
PositiveNegativeNeutral