|
|
Gemini API for Sentiment Analysis at Scale
Author: Venkata Sudhakar
Sentiment analysis with LLMs is fundamentally different from traditional NLP approaches. The Gemini API understands context, sarcasm, mixed sentiment, and domain-specific language without any training data. It can identify not just whether a review is positive or negative, but which specific aspects of a product or service the customer is praising or criticising.
ShopMax India analyses customer reviews across its website and app - over 5,000 new reviews per day. The product team uses Gemini to extract aspect-level sentiment: delivery speed, product quality, packaging, customer service, and value for money are scored independently for each review. This feeds directly into supplier scorecards and product listing improvements.
The below example shows aspect-level sentiment analysis on a customer review using Gemini with structured JSON output.
It gives the following output,
Overall: mixed (score: 0.52)
Emotions: ['happy', 'satisfied']
Recommend: True
Aspects:
product_quality: 0.90 (positive)
delivery_speed: 0.95 (positive)
packaging: 0.80 (positive)
value_for_money: -0.40 (negative)
customer_service: 0.70 (positive)
The below example shows how to aggregate sentiment across a batch of reviews to generate a product scorecard.
It gives the following output,
Product: SKU-9821
Reviews: 3, Recommend: 100%
Aspect scores: {'product_quality': 0.9, 'delivery_speed': 0.95,
'packaging': 0.8, 'value_for_money': -0.4,
'customer_service': 0.7}
Aspect-level sentiment gives ShopMax India actionable signals that star ratings alone cannot provide. A product with a 4-star average might have excellent quality scores but consistently negative value_for_money sentiment - a clear signal to review pricing strategy rather than supplier quality. This granularity is what makes Gemini-powered sentiment analysis more valuable than traditional positive/negative classification for merchandising decisions.
|
|