On-device (offline) Sentiment Analysis for .NET applications
A cross-platform, privacy-first library for sentiment analysis that runs entirely on-device without requiring internet connectivity. Powered by ML.NET 5.0.
- 🔒 Privacy-first - All processing happens on-device, no data leaves your app
- 📴 Fully offline - No internet connection required
- 🚀 Cross-platform - Works on .NET Standard 2.0, .NET 8, .NET 10, MAUI, Blazor, Unity
- ⚡ Fast - Thread-safe singleton pattern for optimal performance
- 📦 Lightweight - Single NuGet package, no external dependencies
dotnet add package SentimentAnalyzerOr via Package Manager:
Install-Package SentimentAnalyzerusing SentimentAnalyzer;
// Analyze sentiment
var result = Sentiments.Predict("This product is amazing!");
Console.WriteLine($"Sentiment: {(result.Prediction ? "Positive" : "Negative")}");
Console.WriteLine($"Confidence: {result.Score:P2}");Analyzes the sentiment of the provided text.
Parameters:
text- The text to analyze
Returns: SentimentPrediction
Prediction(bool) -truefor Positive sentiment,falsefor Negative sentimentScore(float) - Confidence score (0.0 to 1.0)
using SentimentAnalyzer;
// Positive sentiment
var positive = Sentiments.Predict("I love this! Best purchase ever!");
// positive.Prediction = true, positive.Score ≈ 0.95
// Negative sentiment
var negative = Sentiments.Predict("Terrible experience, very disappointed.");
// negative.Prediction = false, negative.Score ≈ 0.12| Platform | Supported | Target Framework |
|---|---|---|
| .NET Framework 4.6.1+ | ✅ | netstandard2.0 |
| .NET Core 2.0+ | ✅ | netstandard2.0 |
| .NET 5/6/7 | ✅ | netstandard2.0 |
| .NET 8 (LTS) | ✅ | net8.0 |
| .NET 10 (LTS) | ✅ | net10.0 |
| .NET MAUI | ✅ | All targets |
| Blazor Server | ✅ | All targets |
| Blazor WebAssembly | ✅ | netstandard2.0 |
| Unity | ✅ | netstandard2.0 |
- Customer Feedback Analysis - Automatically categorize reviews and feedback
- Social Media Monitoring - Track brand sentiment in real-time
- Chatbot Intelligence - Detect user mood and respond appropriately
- Content Moderation - Flag negative or toxic content
- IoT/Edge Devices - Run sentiment analysis on resource-constrained devices
- Air-gapped Environments - Perfect for defense, healthcare, and enterprise use
Version 2.0 maintains full backward compatibility. No code changes required:
<!-- Just update the version -->
<PackageReference Include="SentimentAnalyzer" Version="2.0.0" />See CHANGELOG.md for detailed release notes.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.