Base recognizer

Description of base-recognizer

Introduction

Recognizers are middlewares that inherit from the abstract class called BaseRecognizerMiddleware.

export abstract class BaseRecognizerMiddleware implements Middleware, Recognizer {
    protected name: string;
    protected id: string;
    protected type: RecognizerType;
    constructor(name: string, id: string, type?: RecognizerType) {
        this.type = type || RecognizerType.Asynchronous;
        this.name = name;
        this.id = id;
    }

The source code of this recognizer is included in Aura Bot Platform recognizers - Github repository.

base-recognizer parameters

Parameters Type Description
name property Name of the middleware.
id property Unique identifier for middleware.
type property Type of execution (async or sync) to execute the recognizer method.
recognize method Abstract method that must be implemented in the recognizer. If the recognizer detects an intent, it must save the intent result in the turn context.
onTurn method Private method executed when the activity is processed by the adapter.
processIntent method Protected method to process the intent and entities and store the intentResult and the intent in AuraCommand format.

IntentResult model

Name Type Description
text string Utterance sent to the recognizer.
alteredText string If the original text is changed due to mistakes such as spelling typos, the altered version is included here.
intents Object Map of intent names to an object with score is returned. Format: [name: string]: {score: number;};
entities Entity Entities recognized.
promptCheck boolean If true, the finalize-recognizers-middleware evaluates if exits a prompt in the stack and decides whether it needs to pop from the stack or continues.