A Crash Course for Amazon Natural Language Processing

A Crash Course for Amazon Natural Language Processing

Over the past few years we have seen a rise in cloud native “machine learning” models. These general use models are accessible via API calls and maintained by their respective cloud providers. There is a lot of depth to explain in how the models are used, and why you should try them vs make your own. This is a Crash Course for the five main forms of Amazon’s real-time Comprehend Service.

Detect Entities - This is the method you want to use in order to detect “Named-entities” aka nouns that refer to a specific thing. It is especially useful if you want to detect places, companies, or organizations. Interestingly it also detects “commercial items” which are branded product names.

If you feed it this sentence “Amazon, usually shortened to AWS, is a good cloud provider.”

It will detect two entities, Amazon & AWS with a high degree of confidence. It does not however detect cloud as that is not a named-entity. It is very important to note that Detect Entities will attempt to categorize the entity, something that other methods do not perform.

No alt text provided for this image

Key Phrases - This method attempts to detect the most important parts of a sentence but does not to do any further analysis on it. This allows us to cast a broader net at the cost of categorization and deeper syntax.

Sending it the same sentence “Amazon, usually shortened to AWS, is a good cloud provider.”

correctly pulls out the two organizations from Detect entities but also grabs the “cloud provider” section. Further analysis would most likely need to be done on these snippets but it is especially good for a first analysis or feeding later models/rules.

No alt text provided for this image

Language - Language is probably the most straightforward of all the NLP methods Amazon offers. It does exactly what it claims to do, tells you what language the text is in. There really isn’t much more to say about it!

No alt text provided for this image

Sentiment - This gives you the overall emotion of the text as it falls into one of four categories: Neutral, Positive, Negative, Mixed. One shortcoming of AWS Comprehend Syntax is that it doesn’t break down what phrases contribute to the sentiment. Other platforms can do that and I will be writing about those later. Importantly though this can be used in combination with Detect entities to determine how the text is referring to a specific brand or product. To refer to our other

No alt text provided for this image

Syntax - think of this method as your automated ‘mini’ english teacher. Its sole purpose is to determine what part of language each specific word falls into. Much like Detect Entities it can determine that Amazon and AWS are proper nouns but it also adds that the word “to” is an Adposition. 

No alt text provided for this image

Using AWS Comprehend in Production

AWS makes its methods available through a collecting of SDKs. Typically to get started you would need to write them into your existing application or create a new lambda function. We have been working on a way to make calling these functions possible through NiFi with our Comprehend Bundle.

No alt text provided for this image

This allows you to pass a flowfile into the processor and get back the results. You can pass it either as a flowfile body or attribute and get the results back without having to write any additional code.

Sample Statement being sent in via Attribute and outputting results as a flow-file payload.

No alt text provided for this image
No alt text provided for this image
{Entities: [
    {Score: 0.9880228,
    Type: ORGANIZATION,
    Text: Amazon,
    BeginOffset: 0,
    EndOffset: 6}, 

    {Score: 0.9891866,
    Type: ORGANIZATION,
    Text: AWS,
    BeginOffset: 29,
    EndOffset: 32}
]}

If you are interested in learning more, check out our eBook - NiFi for Dummies

Additionally if you would like to be part of the Comprehend Processor Beta-test please Fill out this form


要查看或添加评论,请登录

Chris Gambino的更多文章

  • NiFi and Retrieval Augmented Generation

    NiFi and Retrieval Augmented Generation

    Phase 1 – “Basic Knowledge” We built a real time slackbot to help answer NiFi questions. To build and host this…

    1 条评论
  • Cloud First IoT with Syft

    Cloud First IoT with Syft

    Introduction Syft Technologies is a leading scientific equipment manufacturer specializing in chemical analysis. To…

  • What I Learned from 2.75 Million Bike Rides

    What I Learned from 2.75 Million Bike Rides

    What do you think is the most popular bicycle spot is in San Francisco? I’ll give you a hint, over 129,000 people…

  • Moving Data to the Cloud - A Practical Guide

    Moving Data to the Cloud - A Practical Guide

    Moving data to the cloud is one of the cornerstones of any cloud migration. Having worked with both on-premise and…

    2 条评论
  • Automated Data Collection with NiFi

    Automated Data Collection with NiFi

    Introduction Manufacturing is a field that is undergoing a complete transformation in the era of faster and more…

    2 条评论
  • Create A Restful API for Nifi, Walmart Case Study

    Create A Restful API for Nifi, Walmart Case Study

    I was recently tinkering with the walmart rest-api. This is publicly available interface and can be used for a quick…

  • Windows Share + Nifi + HDFS – A Practical Guide

    Windows Share + Nifi + HDFS – A Practical Guide

    Recently I had a client ask about how would we go about connecting a windows share to Nifi to HDFS, or if it was even…

    1 条评论
  • Parsing XML Logs With Nifi – Part 1 of 3

    Parsing XML Logs With Nifi – Part 1 of 3

    I have a plan to write a 3 part “intro” series as to how to handle your XML files. The subjects will be: Basic XML and…

    1 条评论
  • Integrating Nifi with Graylog

    Integrating Nifi with Graylog

    Graylog is gaining popularity as a log exploration tool. So this begs the question, how do you intelligently route your…

    1 条评论
  • Building a Smarter Home with Nifi and Spark

    Building a Smarter Home with Nifi and Spark

    I submitted an abstract for the hadoop world summit. Check it out and vote for it here Join us as we discuss what life…

    2 条评论

社区洞察

其他会员也浏览了