Navigator Prefabricating Marinates

    @botbuildercommunity/middleware-text-recognizer
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    Text Recognizer Middleware

    The Text Recognizer Middleware library is a compliment to the Text Recognizer dialog prompts. These middleware components can be used to identify certain text sequences that you might want to alter prior to appearing on the chat window. For example, turning a URL into an actual link, or turning a hashtag into a link that points to a Twitter search.

    Installing

    npm install @botbuildercommunity/middleware-text-recognizer --save
    

    Usage

    All middleware is created and used in the same way. For example, for social media recognition, import the SocialMediaRecognizer class from the package, and add it to your bot adapter:

    import { SocialMediaRecognizer } from "@botbuildercommunity/middleware-text-recognizer";
    
    adapter.use(new SocialMediaRecognizer());
    

    When used, the turnState on the TurnContext will have a property named mentionEntities, which will be an array of strings with the @ syntax elements.

    Supported middleware classes include:

    Class Property/Properties on turnState
    EmailRecognizer context.turnState.get("emailEntities")
    URLRecognizer context.turnState.get("urlEntities")
    PhoneRecognizer context.turnState.get("phoneNumberEntities")
    SocialMediaRecognizer context.turnState.get("mentionEntities") or context.turnState.get("hastagEntities")

    In each case, the turnState of the TurnContext contains an array with the various recognized entities.

    Install

    npm i @botbuildercommunity/middleware-text-recognizer

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    25.2 kB

    Total Files

    26

    Last publish

    Collaborators

    • jamesemann
    • cloudguy_pro
    • imick