Skip to main content

Sentiment Analysis

Automatically detect and analyze emotional tones and sentiments in conversations.

Overview

Sentiment Analysis identifies the emotional context of conversations, helping you understand:

  • Customer satisfaction levels
  • Emotional responses to issues
  • Conversation tone and mood
  • Agent empathy and responsiveness

How It Works

SpeechLytics sentiment analysis:

  1. Processes speech: Transcribed text and audio tone
  2. Detects emotions: Identifies emotional indicators
  3. Assigns sentiment: Classifies as positive, negative, neutral, mixed
  4. Provides context: Links sentiment to specific parts of conversation

Response Format

{
"sentiments": [
{
"title": "Positive",
"description": "Customer expressed satisfaction with resolution"
},
{
"title": "Neutral",
"description": "Technical discussion without emotional content"
}
]
}

Sentiment Fields

FieldDescription
titleSentiment classification (Positive, Negative, Neutral, Mixed)
descriptionHuman-readable explanation of the sentiment

Sentiment Types

Positive

  • Customer satisfaction
  • Agreement or approval
  • Gratitude
  • Enthusiasm
  • Compliments

Indicators:

  • Enthusiastic tone
  • Positive language ("thank you", "great", "perfect")
  • High speaking rate
  • Upbeat intonation

Negative

  • Dissatisfaction or frustration
  • Disagreement or complaints
  • Anger or irritation
  • Disappointment
  • Criticism

Indicators:

  • Harsh tone
  • Negative language ("problem", "unacceptable", "terrible")
  • Raised voice
  • Rapid or choppy speech

Neutral

  • Factual information exchange
  • Technical discussions
  • Information gathering
  • No clear emotional expression

Indicators:

  • Monotone voice
  • Neutral language
  • Normal speech rate
  • Professional tone

Mixed

  • Combination of positive and negative emotions
  • Sarcasm or irony
  • Conflicting sentiments
  • Complex emotional states

Getting Sentiment Data

From Transcript Status

curl -X GET "https://api.example.com/api/v1/transcripts/123456789/status" \
-H "Authorization: Bearer YOUR_TOKEN"

Extract sentiments from response:

{
"sentiments": [
{
"title": "Positive",
"description": "Customer satisfied with solution"
}
]
}

Querying by Sentiment

curl -X GET "https://api.example.com/api/v1/transcripts?Sentiment=Positive" \
-H "Authorization: Bearer YOUR_TOKEN"

Query Parameters:

  • Sentiment=Positive - Find positive conversations
  • Sentiment=Negative - Find negative conversations
  • Sentiment=Neutral - Find neutral conversations
  • Sentiment=Mixed - Find mixed sentiment conversations

Getting Available Sentiments

curl -X GET "https://api.example.com/api/v1/insights/sentiments" \
-H "Authorization: Bearer YOUR_TOKEN"

Response:

{
"sentiments": [
{
"id": 1,
"name": "Positive",
"color": "#4CAF50"
},
{
"id": 2,
"name": "Negative",
"color": "#F44336"
},
{
"id": 3,
"name": "Neutral",
"color": "#9E9E9E"
},
{
"id": 4,
"name": "Mixed",
"color": "#FF9800"
}
]
}

Sentiment Timeline

Track sentiment changes throughout a conversation:

{
"sentimentTimeline": [
{
"timestamp": 0,
"sentiment": "Neutral",
"confidence": 0.85,
"text": "Hi, what can I help you with?"
},
{
"timestamp": 15,
"sentiment": "Negative",
"confidence": 0.92,
"text": "I've been trying to reach someone for hours..."
},
{
"timestamp": 45,
"sentiment": "Positive",
"confidence": 0.88,
"text": "Thank you for resolving this so quickly!"
}
]
}

Use Cases

1. Quality Assurance

  • Monitor agent interactions
  • Identify training opportunities
  • Track customer satisfaction trends
  • Reward positive interactions

2. Customer Experience

  • Detect dissatisfied customers early
  • Trigger immediate escalation
  • Measure satisfaction scores
  • Improve service delivery

3. Business Intelligence

  • Sentiment trends over time
  • Campaign effectiveness
  • Product/service perception
  • Market insights

4. Compliance & Audit

  • Document customer satisfaction
  • Track complaint handling
  • Verify customer rights adherence
  • Generate compliance reports

Sentiment Confidence Scoring

Each sentiment has an associated confidence score:

{
"sentiment": "Positive",
"confidence": 0.92
}
  • 0.9+: Very confident
  • 0.7-0.9: Confident
  • 0.5-0.7: Moderate confidence
  • <0.5: Low confidence

Multi-Segment Analysis

Analyze sentiment across conversation segments:

import requests

API_BASE = "https://api.example.com"

def analyze_sentiment_changes(transcript_id, token):
"""Get sentiment progression through call"""
response = requests.get(
f"{API_BASE}/api/v1/transcripts/{transcript_id}/status",
headers={"Authorization": f"Bearer {token}"}
)

data = response.json()
sentiments = data.get('sentiments', [])
timeline = data.get('sentimentTimeline', [])

return {
'overall_sentiment': sentiments,
'timeline': timeline
}

Advanced Features

Sarcasm Detection

  • Identifies when positive words are used negatively
  • Detects tone-text mismatches
  • Provides context flags

Speaker-Specific Sentiment

  • Agent sentiment tracking
  • Customer sentiment tracking
  • Interaction dynamics

Emotional Metrics

  • Frustration level
  • Enthusiasm level
  • Concern level
  • Satisfaction level

Integration Examples

Python

import requests

class SentimentAnalyzer:
def __init__(self, api_base, token):
self.api_base = api_base
self.headers = {"Authorization": f"Bearer {token}"}

def get_sentiments(self):
"""Get available sentiment types"""
response = requests.get(
f"{self.api_base}/api/v1/insights/sentiments",
headers=self.headers
)
return response.json()

def get_transcript_sentiment(self, transcript_id):
"""Get sentiment for specific transcript"""
response = requests.get(
f"{self.api_base}/api/v1/transcripts/{transcript_id}/status",
headers=self.headers
)
data = response.json()
return data.get('sentiments', [])

def search_by_sentiment(self, sentiment, rows=10):
"""Search transcripts by sentiment"""
response = requests.get(
f"{self.api_base}/api/v1/transcripts?Sentiment={sentiment}&Rows={rows}",
headers=self.headers
)
return response.json()

# Usage
analyzer = SentimentAnalyzer("https://api.example.com", "your_token")

# Get available sentiments
sentiments = analyzer.get_sentiments()
print("Available sentiments:", sentiments)

# Analyze specific transcript
sentiment = analyzer.get_transcript_sentiment(123456)
print("Transcript sentiment:", sentiment)

# Find positive calls
positive_calls = analyzer.search_by_sentiment("Positive")
print("Positive calls:", positive_calls)

JavaScript

class SentimentAnalyzer {
constructor(apiBase, token) {
this.apiBase = apiBase;
this.headers = { 'Authorization': `Bearer ${token}` };
}

async getSentiments() {
const response = await fetch(
`${this.apiBase}/api/v1/insights/sentiments`,
{ headers: this.headers }
);
return response.json();
}

async getTranscriptSentiment(transcriptId) {
const response = await fetch(
`${this.apiBase}/api/v1/transcripts/${transcriptId}/status`,
{ headers: this.headers }
);
const data = await response.json();
return data.sentiments;
}

async searchBySentiment(sentiment, rows = 10) {
const response = await fetch(
`${this.apiBase}/api/v1/transcripts?Sentiment=${sentiment}&Rows=${rows}`,
{ headers: this.headers }
);
return response.json();
}
}

// Usage
const analyzer = new SentimentAnalyzer('https://api.example.com', 'token');
const sentiments = await analyzer.getSentiments();
console.log('Sentiments:', sentiments);

Visualization

Sentiment Distribution Chart

Positive: ████████░ 45%
Negative: ███░░░░░░ 15%
Neutral: ██████░░░ 30%
Mixed: ██░░░░░░░ 10%

Timeline Visualization

0s    Neutral (85%)
15s Negative (92%) ↓
30s Negative (88%)
45s Positive (88%) ↑
60s Positive (90%)

Best Practices

1. Contextualize Results

  • Consider industry and call type
  • Account for cultural differences
  • Verify with human review
  • Don't over-rely on automation

2. Action Planning

  • Set sentiment thresholds for alerts
  • Create escalation workflows
  • Train agents on sentiment awareness
  • Monitor sentiment trends

3. Data Analysis

  • Compare sentiments across agents
  • Track trends over time
  • Correlate with customer satisfaction
  • Measure intervention impact

4. Privacy & Ethics

  • Ensure customer consent
  • Use results for improvement
  • Protect individual privacy
  • Maintain fairness in evaluation

Troubleshooting

Low Confidence Scores

  • Audio quality may be poor
  • Language mismatch
  • Sarcasm or complex emotions
  • Background noise interference

Unexpected Sentiments

  • Sarcasm detection limitations
  • Context-dependent language
  • Accent or dialect variations
  • Industry-specific terminology

No Sentiment Data

  • Ensure transcription completed successfully
  • Check if sentiment analysis is enabled on account
  • Verify sufficient speech content
  • Review error messages in response

Next Steps