api-builder-plugin-comprehend-sdk

1.0.8 • Public • Published

API Builder Plugin for AWS Comprehend for NLP

Axway API Builder flow-node that implements AWS Comprehend for Natural Language Processing (NLP): api-builder-plugin-comprehend-sdk.

Methods implemented:

  • detectDominantLanguage
  • detectEntities
  • detectPiiEntities
  • detectSentiment

About flow-nodes

Flow-nodes are used within Axway API Builder's flow editor that is a low-code / no-code solution to designing and developing services that integrate to many different connected components, such as databases and APIs.

Install

After creating your API Builder Project, you can install this plugin using npm:

npm install api-builder-plugin-comprehend-sdk

Note that this command will install from npm. If you want to install locally, then provide the full path to the plugin folder

Before launching your API Builder app that uses this plugin, you must set the following two environment variables as per the AWS SDK for JavaScript online docs:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

Use

Find the plugin in the NLP group in the Flow-Nodes panel. Drag onto the canvas and select the desired method and provide the input Text and wire up to the rest of your flow as shown below:

Methods

The currently implemented methods are described below.

detectSentiment

AWS docs are here

Provide the Text input and the optional LanguageCode and the output will be similar to below:

Text = "Today is my birthday, I am so happy."

{
    "SentimentScore": {
        "Mixed": 0.0033542951568961143,
        "Positive": 0.9869875907897949,
        "Neutral": 0.008563132025301456,
        "Negative": 0.0010949420975521207
    },
    "Sentiment": "POSITIVE",
 }   
}

detectDominantLanguage

AWS docs are here

Provide the Text input and the output will be similar to below:

Text = "Bob lives in Seattle. He is a software engineer at Amazon."

{
    "Languages": [
        {
            "LanguageCode": "en",
            "Score": 0.9774383902549744
        },
        {
            "LanguageCode": "de",
            "Score": 0.010717987082898617
        }
    ]
}

detectPiiEntities

AWS docs are here

Provide the Text input and the optional LanguageCode and the output will be similar to below:

Text = "Hello Paulo Santos. The latest statement for your credit card account 1111-0000-1111-0000 was mailed to 123 Any Street, Seattle, WA 98109."

{
    "Entities": [
        {
            "Score": 0.9999669790267944,
            "Type": "NAME",
            "BeginOffset": 6,
            "EndOffset": 18
        },
        {
            "Score": 0.8905550241470337,
            "Type": "CREDIT_DEBIT_NUMBER",
            "BeginOffset": 69,
            "EndOffset": 88
        },
        {
            "Score": 0.9999889731407166,
            "Type": "ADDRESS",
            "BeginOffset": 103,
            "EndOffset": 138
        }
    ]
}

detectEntities

AWS docs are here

Provide the Text input and the optional LanguageCode and the output will be similar to below:

Text = "Bob ordered two sandwiches and three ice cream cones today from a store in Seattle."


    {
    "Entities": [
        {
            "Text": "Bob",
            "Score": 1.0,
            "Type": "PERSON",
            "BeginOffset": 0,
            "EndOffset": 3
        },
        {
            "Text": "two",
            "Score": 1.0,
            "Type": "QUANTITY",
            "BeginOffset": 12,
            "EndOffset": 15
        },
        {
            "Text": "three",
            "Score": 1.0,
            "Type": "QUANTITY",
            "BeginOffset": 32,
            "EndOffset": 37
        },
        {
            "Text": "Today",
            "Score": 1.0,
            "Type": "DATE",
            "BeginOffset": 54,
            "EndOffset": 59
        },
        {
            "Text": "Seattle",
            "Score": 1.0,
            "Type": "LOCATION",
            "BeginOffset": 76,
            "EndOffset": 83
        }
    ],
}


Readme

Keywords

Package Sidebar

Install

npm i api-builder-plugin-comprehend-sdk

Weekly Downloads

1

Version

1.0.8

License

ISC

Unpacked Size

24.8 kB

Total Files

6

Last publish

Collaborators

  • lbrenman