AWS Machine Learning Blog
Amazon Comprehend now supports Syntax Analysis
We’re excited to announce that Amazon Comprehend now provides a Syntax API. This enables you to tokenize text (for example, to extract word boundaries) and the corresponding part of speech (PoS) for each word.
Today, Amazon Comprehend enables analysis use cases like such as knowing whether a customer comment is negative or positive, and identifying categorized proper nouns like “Amazon” as an “Organization”. With the new Syntax API, customers can analyze text at the most detailed level and the syntactical meaning of the words themselves, thus enabling even finer-grain analysis of text documents covering a wider range of use cases.
For example, let’s say you just launched a kitchen blender product, and you want to analyze customer comments to find out what colors were mentioned the most..
You can submit the following string against the API:
“It is raining today in Seattle.”
The response will return each word, a token ID, the word itself, the offset (location of the word within the text), the part of speech tag (such as whether the word is an adjective, noun, or verb), and a confidence score (which is the service’s confidence it is correct in the part of speech tag).
Here is an example of the response:
The service provides synchronous requests support using the DetectSyntax API action for single documents per request or the BatchDetectSyntax API action for up to 25 documents per request.
For example, using the AWS CLI, the previous request would look like the following:
The Syntax API and the rest of the Comprehend APIs are available in the AWS SDK here: https://thinkwithwp.com/tools/
To get started or to learn more about Amazon Comprehend, visit: https://thinkwithwp.com/comprehend/
About the Author
Binny Peh is a Sr. Product Marketing Manager for AWS machine learning solutions. In her spare time, she indulges in too much television and is an aspiring foodie. Binny’s glass is always half-full, and she believes in the power of positive thinking.