Language recognizer reference for Bot Framework bots

APPLIES TO: SDK v4

Language recognizers let your bot interpret user input. Adaptive dialogs and language recognizers work together to interpret user intent and to react fluidly to user input. This article describes the builtin recognizers in the Bot Framework SDK and some of their key properties.

For information about how recognizer are used, see Language understanding in the Bot Framework Composer documentation.

Cross-trained recognizer set

The cross-trained recognizer set compares recognition results from more than one recognizer to decide a winner. Given a collection of recognizers, the cross-trained recognizer will:

  • Promote the recognition result of one of the recognizers if all other recognizers defer recognition to a single recognizer. To defer recognition, a recognizer can return the None intent or an explicit DeferToRecognizer_recognizerId as intent.
  • Raise an OnChooseIntent event to allow your code to choose which recognition result to use. Each recognizer's results are returned via the turn.recognized.candidates property. This enables you to choose the most appropriate result.

Default recognizer

The default recognizer was created to replace the following recognizers:

  • LUIS recognizer - to extract intents and entities from a user's utterance based on the defined Language Understanding (LUIS) service.
  • QnA Maker recognizer - to extract intents from a user's utterance based on the defined QnA Maker service.
  • Cross-trained recognizer set - to compare recognition results from more than one recognizer to decide a winner.

LUIS recognizer

Language Understanding (LUIS) is a cloud-based API service that applies custom machine-learning intelligence to a user's conversational, natural language text to predict overall meaning, and pull out relevant, detailed information. The LUIS recognizer enables you to extract intents and entities from a user's utterance based on the defined LUIS application, which you train in advance.

Tip

For more information about how to incorporate language understanding into your bot using LUIS, see:

Multi-language recognizer

When building a sophisticated multi-lingual bot, you'll typically have one recognizer for each language and locale. The Multi-language recognizer enables you to easily specify the recognizer to use based on the locale property on the incoming activity from a user.

For more information, see the Multilingual support article in the Composer documentation.

Orchestrator recognizer

Orchestrator is a language understanding solution optimized for conversational AI applications. It replaces the Bot Framework Dispatcher. The Orchestrator recognizer enables you to extract an intent from a user's utterance, which could be used to route to an appropriate skill or recognizer, such as LUIS or QnA Maker.

Tip

For more information about how to incorporate language understanding into your bot using Orchestrator, see:

QnA Maker recognizer

QnAMaker.ai is one of the Microsoft Cognitive Services that enables you to create rich question-answer pairs from existing content - documents, URLs, PDFs, and so on. You can use the QnA Maker recognizer to integrate with the service.

Note

The QnA Maker recognizer will emit a QnAMatch event, which you can handle with an OnQnAMatch trigger. The entire QnA Maker response will be available in the answer property.

Recognizer set

Sometimes you might need to run more than one recognizer on every turn of the conversation. The recognizer set does exactly that. All recognizers are run on each turn of the conversation and the result is a union of all recognition results.

Regular expression (regex) recognizer

The Regex recognizer uses regular expressions to extract intent and entity data from an utterance.

The Regex recognizer consists primarily of:

  • Intents. The Intents object contains a list of IntentPattern objects, and these IntentPattern objects consist of an Intent property that is the name of the intent, and a Pattern property that contains a regular expression used to parse the utterance to determine intent.
  • Entities. The Entities object contains a list of EntityRecognizer objects. The Bot Framework SDK defines several EntityRecognizer classes to help you determine the entities contained in a user's utterance:
    • AgeEntityRecognizer
    • ConfirmationEntityRecognizer
    • CurrencyEntityRecognizer
    • DateTimeEntityRecognizer
    • DimensionEntityRecognizer
    • EmailEntityRecognizer
    • EntityRecognizer
    • EntityRecognizerSet
    • GuidEntityRecognizer
    • HashtagEntityRecognizer
    • IpEntityRecognizer
    • MentionEntityRecognizer
    • NumberEntityRecognizer
    • NumberRangeEntityRecognizer
    • OrdinalEntityRecognizer
    • PercentageEntityRecognizer
    • PhoneNumberEntityRecognizer
    • RegExEntityRecognizer
    • TemperatureEntityRecognizer
    • TextEntity
    • TextEntityRecognizer
    • UrlEntityRecognizer

Tip

  • The Regex recognizer emits a "None" intent when the input utterance does not match any defined intent. You can create an OnIntent trigger with Intent = "None" to handle this scenario.
  • The Regex recognizer is useful for testing and quick prototyping. For more sophisticated bots we recommend using the Language Understanding (LUIS) recognizer.
  • You might find the Regular expression language quick reference helpful.

Additional Information