language: en
license: mit
tags:
- sentiment-analysis
- aspect-based-sentiment
datasets:
- custom
metrics:
- accuracy
📊 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