Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LocalizedRegExpRecognizer

Version of the RegExpRecognizer that uses the frameworks localization system to retrieve a localized regular expression. The lookup key in the index.json file should be provided and upon receiving a message for a new locale, the recognizer will retrieve the localized expression and a new case insensitive RegExp will be created and used to recognize the intent.

Libraries can use this feature to let a bot override their default matching expressions. just create instances of the recognizer using the namespace of your library and bot developers can customize your matching expressions by using a <namespace>.json file in their locale directory.

Hierarchy

Implements

Index

Constructors

constructor

  • Constructs a new instance of the recognizer.

    Parameters

    • intent: string

      The name of the intent to return when the expression is matched.

    • key: string

      Key for the expression in the index.json or <namespace>.json file.

    • Optional namespace: string

      (Optional) library namespace to lookup key from. The expression should be a string in the <namespace>.json locale file.

    Returns LocalizedRegExpRecognizer

Methods

onEnabled

  • Registers a function to conditionally enable/disable the recognizer. Multiple handlers can be registered and the new handler will be executed before any other handlers.

    Parameters

    • handler: function

      Function called for every message. You should call callback(null, true) for every message that should be recognized.

        • Parameters

          • context: IRecognizeContext
          • callback: function
              • (err: Error, enabled: boolean): void
              • Parameters

                • err: Error
                • enabled: boolean

                Returns void

          Returns void

    Returns RecognizerFilter

onFilter

onRecognize

recognize

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method