SentimentAnalyzer 2.0.0
dotnet add package SentimentAnalyzer --version 2.0.0
NuGet\Install-Package SentimentAnalyzer -Version 2.0.0
<PackageReference Include="SentimentAnalyzer" Version="2.0.0" />
<PackageVersion Include="SentimentAnalyzer" Version="2.0.0" />
<PackageReference Include="SentimentAnalyzer" />
paket add SentimentAnalyzer --version 2.0.0
#r "nuget: SentimentAnalyzer, 2.0.0"
#:package SentimentAnalyzer@2.0.0
#addin nuget:?package=SentimentAnalyzer&version=2.0.0
#tool nuget:?package=SentimentAnalyzer&version=2.0.0
SentimentAnalyzer
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.
✨ Features
- 🔒 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
📦 Installation
dotnet add package SentimentAnalyzer
Or via Package Manager:
Install-Package SentimentAnalyzer
🚀 Quick Start
using SentimentAnalyzer;
// Analyze sentiment
var result = Sentiments.Predict("This product is amazing!");
Console.WriteLine($"Sentiment: {(result.Prediction ? "Positive" : "Negative")}");
Console.WriteLine($"Confidence: {result.Score:P2}");
📖 API Reference
Sentiments.Predict(string text)
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)
Example Usage
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 Support
| 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 |
📋 Use Cases
- 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
🔄 Migration from v1.x
Version 2.0 maintains full backward compatibility. No code changes required:
<PackageReference Include="SentimentAnalyzer" Version="2.0.0" />
See CHANGELOG.md for detailed release notes.
📚 Learn More
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.ML (>= 5.0.0)
-
net10.0
- Microsoft.ML (>= 5.0.0)
-
net8.0
- Microsoft.ML (>= 5.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on SentimentAnalyzer:
| Package | Downloads |
|---|---|
|
Bot.Builder.Community.Middleware.SentimentAnalysis
This middleware uses Cognitive Services Sentiment Analysis to identify the sentiment of each inbound message and make it available for your bot or other middleware component. |
|
|
Bot.Builder.Community.Components.Middleware.SentimentAnalysis
Sentiment Analysis Middleware component for Bot Framework Composer and v4 Bot Builder SDK. Enables you to find out what customer think of brand or topic by analyzing raw text for clues about positive or negative sentiment. This component can extract the sentiment powered by SentimentAnalyzer which encapsulates both offline (powered by ML.NET) and online (powered by Azure Cognitive Services) sentiment analysis. |
|
|
Bot.Builder.Community.Components.Middleware.Testinghttp
Sentiment Analysis Middleware component for Bot Framework Composer and v4 Bot Builder SDK. Enables you to find out what customer think of brand or topic by analyzing raw text for clues about positive or negative sentiment. This component can extract the sentiment powered by SentimentAnalyzer which encapsulates both offline (powered by ML.NET) and online (powered by Azure Cognitive Services) sentiment analysis. |
|
|
Bot.Builder.Community.Components.Middleware.Httpcall
Sentiment Analysis Middleware component for Bot Framework Composer and v4 Bot Builder SDK. Enables you to find out what customer think of brand or topic by analyzing raw text for clues about positive or negative sentiment. This component can extract the sentiment powered by SentimentAnalyzer which encapsulates both offline (powered by ML.NET) and online (powered by Azure Cognitive Services) sentiment analysis. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on SentimentAnalyzer:
| Repository | Stars |
|---|---|
|
BotBuilderCommunity/botbuilder-community-dotnet
Part of the Bot Builder Community Project. Repository for extensions for the Bot Builder .NET SDK, including middleware, dialogs, recognizers and more.
|
Major upgrade to ML.NET 5.0.0 with multi-targeting support for .NET Standard 2.0, .NET 8, and .NET 10. Cross-platform compatible with MAUI, Blazor, Unity, and more.