πŸ“Š 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
Safetensors
Model size
0.2B params
Tensor type
I64
Β·
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using Artengus/hybrid 1