You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

AspectLens - Aspect-Based Sentiment Analysis

A production-ready Aspect-Based Sentiment Analysis (ABSA) model that extracts granular sentiment for specific product features from customer reviews.

Model Description

This model identifies sentiment for 6 product aspects:

  • Battery, Camera, Display, Performance, Build, Price

Model Details

  • Architecture: TF-IDF Vectorization + Logistic Regression
  • Training Data: 200K Amazon mobile phone reviews
  • Accuracy: 90% on test set
  • Inference Time: <100ms per review
  • Language: English

Performance

Metric Score
Overall Accuracy 90.0%
Positive Class 100%
Negative Class 80%
Neutral Class 90%
Weighted F1 0.90

Usage

from inference import predict

# Analyze a review
review = "Great camera but terrible battery life. The display is amazing though!"
result = predict(review)

print(result)
# Output:
# {
#   'aspects': [
#     {'aspect': 'camera', 'sentiment': 'positive', 'confidence': 0.982},
#     {'aspect': 'battery', 'sentiment': 'negative', 'confidence': 0.947},
#     {'aspect': 'display', 'sentiment': 'positive', 'confidence': 0.991}
#   ],
#   'overall_sentiment': 'positive'
# }

API Endpoint

Once deployed on Hugging Face Inference API:

import requests

API_URL = "https://api-inference.huggingface.co/models/YOUR_USERNAME/AspectLens-Aspectwise-sentiment-breakdown"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()

output = query({
    "inputs": "Great phone but battery dies quickly"
})

Training Details

  • Dataset: Amazon Product Reviews (Mobile Phones)
  • Preprocessing: Text cleaning, sentence segmentation, aspect detection
  • Features: TF-IDF with max 5000 features
  • Classifier: Logistic Regression with balanced class weights
  • Validation: 80/20 train-test split

Limitations

  • English language only
  • Focused on mobile phone reviews (generalizes to other electronics)
  • Rule-based aspect detection (keyword matching)
  • May struggle with sarcasm or complex negations

Intended Use

  • Product development teams identifying pain points
  • Customer support prioritizing issues
  • E-commerce platforms analyzing feedback
  • Marketing teams understanding preferences

Citation

@misc{aspectlens2026,
  author = {Aryan Patel},
  title = {AspectLens: Aspect-Based Sentiment Analysis for Product Reviews},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/YOUR_USERNAME/AspectLens}}
}

License

MIT License - Free for commercial and research use

Contact


Built with ❤️ using scikit-learn

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using DukeShadow/AspectLens-Aspectwise-sentiment-breakdown 1