Branch | Status | Recommended NuGet package version |
---|---|---|
master |
This is part of the Bot Builder Community project which contains Bot Framework Components and other projects / packages for use with Bot Framework Composer and the Bot Builder .NET SDK v4.
This middleware will spell check inbound text using Cognitive Services Spell Check and therefore requires a key. There is a free tier which meets most demo/PoC needs. You can get more info at https://azure.microsoft.com/en-gb/services/cognitive-services/spell-check/
The implementation is naive at the moment in that it assumes that the suggestions are correct and replaces inbound text automatically. If you have more sophisticated needs please feel free to contribute!
Available via NuGet package Bot.Builder.Community.Middleware.SpellCheck
Install into your project using the following command in the package manager;
PM> Install-Package Bot.Builder.Community.Middleware.SpellCheck
Typically I would place this middleware at the end of the pipeline, but it will work anywhere.
services.AddBot<Bot>((options) => {
options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);
// more middleware
options.Middleware.Add(new SpellCheckMiddleware(Configuration));
});
This requires an instance of IConfiguration
passing to it. Use the instance injected into the Startup.cs
class.
The configuration can be read from your appsettings.json
file which needs the following keys
Note: SpellCheckCountryCode and SpellCheckMarket are optional for languages other than en/en-US. For a full list of supported country and market codes see https://docs.microsoft.com/en-us/azure/cognitive-services/bing-spell-check/bing-spell-check-supported-languages.
{
"SpellCheckKey": "<YOUR SPELL CHECK KEY HERE>",
"SpellCheckCountryCode": "sv",
"SpellCheckMarket": "sv-SE"
}