Sentimatrix
Advanced sentiment analysis toolkit with multi-provider LLM support
What is Sentimatrix?¶
Sentimatrix is a production-ready Python library for sentiment analysis, emotion detection, and review aggregation. It combines the power of multiple LLM providers with robust web scraping capabilities to deliver comprehensive text analysis solutions.
Quick Example¶
import asyncio
from sentimatrix import Sentimatrix
async def main():
async with Sentimatrix() as sm:
# Analyze sentiment
result = await sm.analyze("This product exceeded my expectations!")
print(f"Sentiment: {result.sentiment}") # positive
print(f"Confidence: {result.confidence:.2%}") # 94.32%
# Detect emotions
emotions = await sm.detect_emotions("I'm thrilled about this purchase!")
print(f"Primary: {emotions.primary}") # joy
print(f"All: {emotions.scores}") # {'joy': 0.89, 'surprise': 0.12, ...}
asyncio.run(main())
Core Features¶
:material-brain: Sentiment Analysis
Multiple analysis modes including quick sentiment, structured analysis, aspect-based, comparative, and temporal analysis with domain-specific support.
:material-emoticon: Emotion Detection
Detect emotions using Ekman's 6 basic emotions, GoEmotions' 28 classes, or Plutchik's wheel. Supports intensity analysis and emotion timelines.
:material-api: 21 LLM Providers
Seamless integration with OpenAI, Anthropic, Google, Groq, Mistral, Cohere, Together, Fireworks, Ollama, vLLM, AWS Bedrock, and more.
:material-web: Web Scraping
Built-in scrapers for Amazon, Steam, YouTube, Reddit, IMDB, Yelp, Trustpilot, and Google Reviews with anti-detection measures.
:material-cloud: 8 Commercial APIs
Integration with ScraperAPI, Apify, Bright Data, Oxylabs, Zyte, ScrapingBee, ScrapingAnt, and Firecrawl for enterprise-scale scraping.
:material-cog: Fully Async
Built from the ground up with async/await support for high-performance concurrent operations.
LLM Providers¶
Sentimatrix supports a wide range of LLM providers for enhanced analysis:
Core Providers
OpenAI Anthropic Google Gemini
Specialized
Mistral Cohere DeepSeek OpenRouter
Fast Inference
Groq Cerebras Fireworks Together
Local Inference
Ollama LM Studio vLLM llama.cpp ExLlamaV2 Text-Gen-WebUI
Enterprise
Azure OpenAI AWS Bedrock
Platform Scrapers¶
Collect reviews and feedback from popular platforms:
| Platform | Type | Authentication | Rate Limit |
|---|---|---|---|
| Amazon | E-commerce | None | 10 req/min |
| Steam | Gaming | None | 20 req/min |
| YouTube | Video | API Key | 100 req/min |
| Social | OAuth | 60 req/min | |
| IMDB | Entertainment | None | 15 req/min |
| Yelp | Reviews | API Key | 50 req/min |
| Trustpilot | Reviews | None | 10 req/min |
| Google Reviews | Reviews | None | 5 req/min |
Full Pipeline Example¶
Scrape reviews, analyze sentiment, and generate insights:
import asyncio
from sentimatrix import Sentimatrix
from sentimatrix.config import SentimatrixConfig, LLMConfig
async def main():
config = SentimatrixConfig(
llm=LLMConfig(
provider="groq",
api_key="your-groq-key",
model="llama-3.3-70b-versatile"
)
)
async with Sentimatrix(config) as sm:
# Scrape reviews from Steam
reviews = await sm.scrape_reviews(
url="https://store.steampowered.com/app/1245620/ELDEN_RING/",
platform="steam",
max_reviews=100
)
# Analyze all reviews
results = await sm.analyze_batch([r.text for r in reviews])
# Get distribution
positive = sum(1 for r in results if r.sentiment == "positive")
negative = sum(1 for r in results if r.sentiment == "negative")
neutral = sum(1 for r in results if r.sentiment == "neutral")
print(f"Positive: {positive}, Negative: {negative}, Neutral: {neutral}")
# Generate LLM summary
summary = await sm.summarize_reviews(reviews)
print(f"\nSummary:\n{summary}")
asyncio.run(main())
Installation¶
Why Sentimatrix?¶
:material-speedometer: Performance
Async-first architecture with connection pooling, caching, and batch processing for maximum throughput.
:material-shield-check: Reliability
Built-in retry logic, rate limiting, and fallback providers ensure your analysis pipelines stay running.
:material-puzzle: Extensibility
Plugin architecture makes it easy to add new providers, scrapers, and analysis methods.
:material-test-tube: Well Tested
1100+ tests with 91% coverage including unit, integration, and end-to-end scenarios.
Getting Help¶
- Documentation: You're here! Explore the sidebar for detailed guides.
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions and share ideas