As a .NET (read: Microsoft Stack) guy, I have been a huge fan of applied machine learning with the actual focus on how to solve a certain business problem with efficiency and minimal cost. When Microsoft announced the Cognitive Services API suite, I got really excited with the offerings but that too came with the cost (as it’s purely managed and scaled by Microsoft and you don’t have to worry about their underlying architecture).
However, with the advent of ML.NET, my excitement grew more towards it. I started exploring it since the early days of its development. I also managed to take little part in it by contributing to their GitHub repo.
Lately, with the Bot Builder Community Project, I developed one of the Middleware for Sentiment Analysis that would go hand-in-hand with your bot even if you’re using LUIS or not. The only catch as I stated above was the subscription (or cost). Therefore, I decided to develop another Sentiment Analyzer that’d be based on ML.NET and would work on-device, without the need of Cognitive Services API subscription.
Now, Sentiment Analysis Middleware supports both the versions (online and offline). In case you want to incorporate the same in your bot, it can easily be tweaked in just one line of code in Startup.cs of a Bot.
Just to note that Cognitive Service Text Analytics API offer more than the Sentiment such as Language Detection and so on. However, for the sake of simplicity and our goal, we were only interested in Sentiment Analysis hence, I developed the SentimentAnalyzer for the same Middleware. While I was developing that, I thought to make it as a library and publish it on NuGet so anyone (with the .NET Standard 2.0) support can actually use it into his/her apps.
Despite the challenges, lack of proper documentation and an actual gap of market made me realize that either not many people are actually looking at these ways to implement their services or since the ML.NET is still in their Preview so it’s a high chance that developers are still avoiding to use it for their production ready systems. It varies, from case to case.
Anyway, I have kept this library is an open-source and you can always look for the ways to improve it by forking it and submitting the PR. There are some challenges with ML.NET implementation therefore, you may encounter that the code written there for the library is not very efficient.
You can always reach out to me in case you need any help with either this sample or ML.NET and I will be happy to assist you.
Until next time.