Sentiment Analysis Overview
Neuredge's sentiment analysis capability helps you understand emotions, opinions, and attitudes expressed in text. Our models provide detailed sentiment insights that can be used for brand monitoring, customer feedback analysis, and social media intelligence.
Features
Core Capabilities
- Multi-level Analysis: Beyond just positive/negative classifications
- Emotion Detection: Identify specific emotions in text
- Aspect-based Analysis: Sentiment for specific aspects or topics
- Confidence Scores: Reliability metrics for predictions
Integration with Other Services
- Combines with summarization for efficient feedback processing
- Works with translation for multi-language sentiment analysis
- Pairs with embeddings for semantic sentiment search
Getting Started
Basic Usage
import { NeuredgeClient } from '@neuredge/sdk';
const client = new NeuredgeClient({
apiKey: 'your-api-key'
});
// Simple sentiment analysis
const sentiment = await client.text.analyzeSentiment(
'I really love this product! The features are amazing.'
);
// With more options
const detailedSentiment = await client.text.analyzeSentiment(
'The interface is great but customer service needs improvement.',
{
includeEmotions: true,
extractAspects: true,
confidenceScores: true
}
);
Python Example
from neuredge_sdk import NeuredgeClient
client = NeuredgeClient("YOUR_API_KEY")
# Basic sentiment analysis
sentiment = client.text.analyze_sentiment(
"I really love this product! The features are amazing."
)
# Advanced options
detailed_sentiment = client.text.analyze_sentiment(
"The interface is great but customer service needs improvement.",
include_emotions=True,
extract_aspects=True,
confidence_scores=True
)
Advanced Features
Batch Analysis
const texts = [
'This product is amazing!',
'The service was terrible.',
'Not sure how I feel about this.'
];
const batchSentiments = await client.text.analyzeSentimentBatch(
texts,
{
includeEmotions: true
}
);
Aspect-Based Analysis
const aspectSentiment = await client.text.analyzeSentiment(
'The food was delicious but the service was slow.',
{
extractAspects: true,
aspects: ['food', 'service', 'ambiance']
}
);
Emotion Detection
const emotions = await client.text.analyzeEmotions(
'I am so excited about this new feature!',
{
includeIntensity: true,
emotionSet: 'extended'
}
);
Best Practices
Optimizing Results
-
Text Preparation
- Clean and normalize input text
- Consider context when needed
- Group related content for batch analysis
-
Analysis Configuration
- Choose appropriate detail level
- Set relevant aspects for tracking
- Use confidence thresholds
-
Error Handling
try {
const sentiment = await client.text.analyzeSentiment(
'Your text here',
{ includeEmotions: true }
);
} catch (error) {
if (error.code === 'invalid_request') {
console.log('Invalid request parameters');
} else if (error.code === 'text_too_long') {
console.log('Text exceeds maximum length');
}
}
Use Cases
Customer Feedback Analysis
// Analyze customer review
const feedbackAnalysis = await client.text.analyzeSentiment(
reviewText,
{
extractAspects: true,
aspects: ['product', 'service', 'price', 'quality'],
includeEmotions: true
}
);
Social Media Monitoring
// Analyze social media post
const socialAnalysis = await client.text.analyzeSentiment(
postText,
{
includeEmotions: true,
extractHashtags: true,
trackTrends: true
}
);
Brand Monitoring
// Monitor brand mentions
const brandSentiment = await client.text.analyzeSentiment(
brandMention,
{
aspectBasedAnalysis: true,
brandAttributes: ['reputation', 'quality', 'innovation'],
timeTracking: true
}
);
Integration Examples
Feedback Processing Pipeline
async function processFeedback(feedback: string) {
// Analyze sentiment
const sentiment = await client.text.analyzeSentiment(
feedback,
{
extractAspects: true,
includeEmotions: true
}
);
// Generate summary
const summary = await client.text.summarize(
feedback,
{ maxLength: 100 }
);
// Translate if needed
const translation = await client.text.translate(
summary,
{ targetLanguage: 'es' }
);
return {
sentiment,
summary,
translation
};
}
Real-time Sentiment Monitoring
async function monitorLiveFeedback(feedbackStream: string[]) {
const results = [];
for (const feedback of feedbackStream) {
// Analyze sentiment
const sentiment = await client.text.analyzeSentiment(
feedback,
{ includeEmotions: true }
);
// Generate embedding for clustering
const embedding = await client.embeddings.create({
text: feedback,
model: 'embedding-v1'
});
results.push({
text: feedback,
sentiment,
embedding: embedding.vector
});
}
return results;
}
Output Format
Basic Sentiment
{
"sentiment": "positive",
"score": 0.85,
"confidence": 0.92
}
Detailed Analysis
{
"overall": {
"sentiment": "mixed",
"score": 0.6,
"confidence": 0.88
},
"aspects": {
"product": {
"sentiment": "positive",
"score": 0.9
},
"service": {
"sentiment": "negative",
"score": 0.3
}
},
"emotions": {
"joy": 0.6,
"frustration": 0.3,
"satisfaction": 0.7
}
}