AWS Comprehend Lab

AWS Comprehend

AWS Comprehend


Comprehend

Amazon Comprehend Documentation


Analyze insights in text with Amazon Comprehend

Analyze insights in text with Amazon Comprehend


Situation

The lab is based on the assumption: News will influence the stock price.

Here, I will take a financial news for the Real-time analysis.
In the future, I will design a web crawler to crawl finance news. For example, crawling the news from yahoo! finance.

The example news is Big Tech earnings, Federal Reserve decision: What to know this week

Using F12 in Google Chrome to observe the news structure.

Header

The First Paragraph

The Separator

Tasks

  1. Perform a real-time analysis on Amazon Comprehend console.
  2. Perform a real-time analysis on Amazon Comprehend API through Python boto3 SDK.

Amazon Comprehend Console

Services -> Comprehend -> Real-time analysis


Try to copy the following part of news for real-time analysis with Amazon Comprehend.

1
2
3
4
5
6
7
8
9
10
11
Traders are gearing up for a busy week of corporate earnings results from the mega-cap technology stocks this week. This will come alongside a slew of economic data reports and a monetary policy decision from the Federal Reserve. 

The biggest names in the S&P 500 — including Apple (AAPL), Microsoft (MSFT), Amazon (AMZN), Facebook (FB) and Alphabet (GOOGL) — are set to report second-quarter results this week. The reports will add to what has already been an exceptional earnings season: So far, 24% of companies in the S&P 500 have reported second-quarter results, and of these, 88% have topped Wall Street's earnings per shares estimates, according to an analysis from FactSet. The blended earnings growth rate for the blue-chip index, which includes both companies' reported growth rates and the estimated rates for the companies have yet to report, stands at 74.2%, which would be the highest since the fourth quarter of 2009.

Earnings results from technology companies Snap (SNAP) and Twitter (TWTR) last week underscored the strength in the internet advertising market, suggesting a strong backdrop that likely also benefitted bigger ad-driven companies like Facebook and Alphabet. Snap's second-quarter revenue growth came in at 116%, or the biggest jump in four years, and the stock rocketed to a record high following the results. Both Snap and Twitter grew active users more than expected, and their estimates topping second-quarter revenues suggested better monetization of these increased users.

According to JPMorgan analyst Doug Anmuth, Snap's results especially "will likely raise the bar for other ad names," including Alphabet and Facebook. The companies report results on Tuesday and Wednesday, respectively.

"GOOGL shares are well-owned, but GOOGL remains one of our Top Ideas in 2021 as we believe: 1) reopening will remain a tailwind for Search and YouTube ads, especially as overall spend continues to shift online and travel continues to recover; 2) overall margins will remain meaningfully above pre-pandemic levels ... 3) Cloud growth will remain solid at 40%+ while profit losses continue to improve; and 4) greater capital returns are likely on the heels of the $50 billion incremental buyback authorization last quarter," Anmuth wrote in a note published July 22.

As for Facebook, "advertising should continue to benefit from reopening and we are encouraged by newer initiatives around Reels and Shops, as well as the creator economy, audio, and AR/VR [augmented reality/virtual reality] a bit further out," Anmuth added.

Click on Analyze.


Entities


Key phrase


Language


PII


Sentiment


Syntax


Boto3

Getting Started with Amazon Comprehend
Text Analysis APIs
Comprehend APIs

The ideal structure:

  • Data Collection: Web crawler
  • Data Storage: S3
  • Data Processing: Lambda
  • NLP: Amazon Comprehend API/Custom RNN model

To simplify the lab, I will use Python running on local machine to read the news stored as .txt file on local machine to call the Text Analysis APIs.

Create a .txt file and paste the copied content to the file.


Project

See we have the same outcome from Amazon Comprehend API as the outcome from Amazon Comprehend console.