Iciclecreek.Bot.Builder.Dialogs.Recognizers
4.20.0
dotnet add package Iciclecreek.Bot.Builder.Dialogs.Recognizers --version 4.20.0
NuGet\Install-Package Iciclecreek.Bot.Builder.Dialogs.Recognizers -Version 4.20.0
<PackageReference Include="Iciclecreek.Bot.Builder.Dialogs.Recognizers" Version="4.20.0" />
paket add Iciclecreek.Bot.Builder.Dialogs.Recognizers --version 4.20.0
#r "nuget: Iciclecreek.Bot.Builder.Dialogs.Recognizers, 4.20.0"
// Install Iciclecreek.Bot.Builder.Dialogs.Recognizers as a Cake Addin #addin nuget:?package=Iciclecreek.Bot.Builder.Dialogs.Recognizers&version=4.20.0 // Install Iciclecreek.Bot.Builder.Dialogs.Recognizers as a Cake Tool #tool nuget:?package=Iciclecreek.Bot.Builder.Dialogs.Recognizers&version=4.20.0
Recognizers
This library provides custom recognizers for Bot Framework/Composer.
Installation
To install into your project run the cli:
dotnet add package Iciclecreek.Bot.Builder.Dialogs.Recognizers
In your startup code add:
ComponentRegistration.Add(new RecognizerComponentRegistration());
To add to your schema for usage in Bot Framework Composer from cli:
bf dialog:merge -p yourproj.proj -o your.schema
Library
This library adds recognizers:
- PersonNameEntityRecognizer - Recognizes common @givenName @surname, @fullname entities (like "John Smith"=> GivenName:"john" Surname:"Smith", fullname:"John Smith")
- QuotedTextEntityRecognizer - Recognizes quoted strings as @QuotedText entities
- CsvTextEntityRecognizer - Uses a .CSV file to define tokens to match to entities
- ThresholdRecognizer - Applies a threshold to intents, any intents which have scores which are within the threshold will trigger an OnChooseIntent event.
PersonNameEntityRecognizer
Recognizes common @givenName @surname, @fullname entities (like "John Smith"=> GivenName:"john" Surname:"Smith", fullname:"John Smith"). You can optionally point it to a URL to extend matched given names and surnames.
Sample Code
var dialog = new AdaptiveDialog()
{
Recognizer = new RegexRecognizer()
{
Entities = new EntityRecognizerSet()
{
new PersonNamEntityRecognizer()
}
}
...
}
Sample Json
{
"$kind": "Microsoft.AdaptiveDialog",
"recognizer": {
"$kind":"Microsoft.RegexRecognizer",
"entities": [
{
"$kind":"Iciclecreek.PersonNameEntityRecognizer"
}
]
}
}
QuotedTextEntityRecognizer
Use the QuotedTextEntityRecognizer to recognize quoted strings as a @QuotedText entity across 64 languages:
- Afrikaans
- Albanian
- Amharic
- Arabic
- Armenian
- Azerbaijani
- Basque
- Belarusian
- Bosnian
- Bulgarian
- Catalan
- Chinese
- Croatian
- Czech
- Danish
- Dutch
- English
- Esperanto
- Estonian
- Filipino
- Finnish
- French
- Galician
- Georgian
- German
- Greek
- Hebrew
- Hindi
- Hungarian
- Icelandic
- Indonesian
- Interlingua
- Irish
- Italian
- Japanese
- Kazakh
- Khmer
- Korean
- Lao
- Latvian
- Lithuanian
- Macedonian
- Maltese
- New Tai Lue
- Norwegian
- Occitan
- Pashto
- Persian
- Polish
- Romanian
- Russian
- Serbian
- Scottish Gaelic
- Slovak
- Slovene
- Sorbian
- Spanish
- Swedish
- Tai Le
- Tamil
- Tibetan
- Tigrinya
- Thai
- Turkish
- Ukrainian
- Uyghur
- Uzbek
- Vietnamese
- Welsh
Sample Code
var dialog = new AdaptiveDialog()
{
Recognizer = new RegexRecognizer()
{
Entities = new EntityRecognizerSet()
{
new QuotedTextEntityRecognizer()
}
}
...
}
Sample Json
{
"$kind": "Microsoft.AdaptiveDialog",
"recognizer": {
"$kind":"Microsoft.RegexRecognizer",
"entities": [
{
"$kind":"Iciclecreek.QuotedTextEntityRecognizer"
}
]
}
}
CsvEntityRecognizer
Use the CsvEntityRecognizer to easily define custom entities to recognize from a csv file.
The CSV file should be in the format:
TOKEN,TYPE,VALUE1,..,VALUEN
The value columns are property paths which will be used to set modify the entity with the data in the value column.
Example:
TOKEN,TYPE,genus.class,genus.latin
alligator,animal,reptile,alligator mississippiensis
squirrel,animal,mammal,squirrus maximus
...
#### Sample Code
```C#
var dialog = new AdaptiveDialog()
{
Recognizer = new RegexRecognizer()
{
Entities = new EntityRecognizerSet()
{
new CsvEntityRecognizer()
{
Url = "http://contoso.com/animals.csv"
}
}
}
...
}
Sample Json
{
"$kind": "Microsoft.AdaptiveDialog",
"recognizer": {
"$kind":"Microsoft.RegexRecognizer",
"entities": [
{
"$kind":"Iciclecreek.CsvEntityRecognizer",
"Url": "http://contoso.com/animals.csv"
}
]
}
}
ThresholdRecognizer
Applies a threshold to intents, any intents which have scores which are within the threshold will trigger an OnChooseIntent event.
Sample Code
var dialog = new AdaptiveDialog()
{
Recognizer = new ThresholdRecognizer()
{
Threshold = 1.0f,
Recognizer = ...
}
...
}
Sample Json
{
"$kind": "Microsoft.AdaptiveDialog",
"recognizer": {
"$kind":"Iciclecreek.ThresholdRecognizer",
"threshold": 0.2,
"recognizer": {
...
}
}
}
Sample code for handling OnChooseIntent
new OnChooseIntent()
{
Intents = new List<string> { "foo","bar" },
Actions = new List<Dialog>()
{
new SetProperty()
{
Property = "dialog.candidates",
Value = $"=turn.recognized.candidates"
},
new ChoiceInput()
{
Choices = new ChoiceSet()
{
new Choice("foo"),
new Choice("bar"),
},
Prompt = new ActivityTemplate("Which intent?")
},
new EmitEvent()
{
EventName = AdaptiveEvents.RecognizedIntent,
EventValue = "=first(where(dialog.candidates, c, c.intent == turn.lastResult)).result"
},
new DeleteProperty()
{
Property = "dialog.candidates"
}
}
}
Sample code for generically handling OnChooseIntent
If you don't have the Intents constraint, then you can programmatically ask for the intents ( or map the intents to human language) like this:
new ChoiceInput()
{
Choices = "=select(dialog.candidates, result, result.intent)",
Prompt = new ActivityTemplate("Which intent?")
},
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 was computed. 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. |
.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.Bot.Builder (>= 4.20.0)
- Microsoft.Bot.Builder.Dialogs.Adaptive (>= 4.20.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.