π Hybrid Aspect-Based Sentiment Analysis Model
A Hybrid Approach for Aspect-Based Sentiment Analysis (ABSA) that combines transfer learning, syntactic dependency parsing, and weak supervision to extract fine-grained sentiment insights from text.
π Overview
Aspect-Based Sentiment Analysis (ABSA) is a Natural Language Processing (NLP) task that identifies specific aspects (features) in a sentence and determines the sentiment polarity associated with each aspect.
Unlike traditional sentiment analysis, which assigns a single sentiment to the whole sentence, ABSA provides fine-grained insights.
Example: Input: "The food was amazing but the service was slow."
Output:
- Food β Positive
- Service β Negative π§ Model Architecture
This project implements a hybrid approach inspired by recent research combining:
πΉ Pretrained Transformer Models (for contextual understanding) πΉ Syntactic Dependency Parsing (for better aspect extraction) πΉ Weakly-Supervised Learning (reduces dependency on labeled data)
The hybrid design leverages both LLM-based semantic understanding and rule-based linguistic structure, improving aspect detection accuracy.
βοΈ Features β Aspect Term Extraction (ATE) β Aspect Sentiment Classification (ASC) β Hybrid (Rule + Deep Learning) Approach β Domain Adaptable β Reduced Need for Large Labeled Datasets π Model Details Attribute Description Task Aspect-Based Sentiment Analysis Framework Hugging Face Transformers Approach Hybrid (Transfer Learning + Dependency Parsing) Input Text sentence Output Aspect + Sentiment pairs π οΈ Installation pip install transformers torch π§ Usage from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_name = "Artengus/hybrid"
tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "The battery is good but the camera is poor." aspects = ["battery", "camera"]
results = {}
for aspect in aspects: inputs = tokenizer(text, aspect, return_tensors="pt") outputs = model(**inputs) logits = outputs.logits predicted_class_id = logits.argmax().item() results[aspect] = model.config.id2label[predicted_class_id]
print(results) π How It Works
The pipeline typically follows:
Aspect Candidate Extraction Aspect Filtering (Dependency + Model) Sentiment Classification per Aspect
This multi-stage approach improves performance compared to single-stage models.
π Applications π Product Review Analysis π± App Feedback Mining π’ Customer Experience Analytics π Market Research π§ Opinion Mining
- Downloads last month
- 16