Using the codelab on Sentiment Analysis
Using the Natural Language API with Python Codelab NLP Welcome to Cloud Shell! Type "help" to get started. Your Cloud Platform project in ... uconnstamfordslp.blogspot.com |
Take any paragraph of text and score it for sentiment and entity recognition.
Send me the output via email
Example
text = """Artificial intelligence may be one of the biggest technological leaps in history. It is poised to unlock new business models, transform industries, reshape people’s jobs, and boost economic productivity. Goldman Sachs is uniquely positioned to understand this fast-moving revolution. With our research across markets as well as our work with clients, we aim to provide meaningful analysis of this radical change and its implications for investors, companies, and the global economy."""
results
In [16]: show_text_sentiment(analyze_sentiment_response)
At sentence level:
score | sentence
---------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+0.5 | Artificial intelligence may be one of the biggest technological leaps in history.
+0.2 | It is poised to unlock new business models, transform industries, reshape people’s jobs, and boost economic productivity.
+0.3 | Goldman Sachs is uniquely positioned to understand this fast-moving revolution.
+0.4 | With our research across markets as well as our work with clients, we aim to provide meaningful analysis of this radical change and its implications for investors, companies, and the global economy.
At document level:
score | magnitude | language
---------+-------------+------------
+0.4 | +1.6 | en
In [17]:
for name
In [20]: show_text_entities(analyze_entities_response)
name | type | salience | mid | wikipedia_url
-------------------------+---------------+------------+-----------+---------------------------------------------
Artificial intelligence | OTHER | 22% | |
one | PERSON | 22% | |
leaps | OTHER | 18% | |
history | OTHER | 7% | |
business models | CONSUMER_GOOD | 3% | |
analysis | OTHER | 3% | |
productivity | OTHER | 2% | |
industries | OTHER | 2% | |
jobs | OTHER | 2% | |
people | PERSON | 2% | |
revolution | OTHER | 2% | |
research | OTHER | 2% | |
markets | OTHER | 2% | |
change | OTHER | 2% | |
implications | OTHER | 2% | |
Goldman Sachs | ORGANIZATION | 1% | /m/01xdn1 | https://en.wikipedia.org/wiki/Goldman_Sachs
investors | PERSON | 1% | |
companies | ORGANIZATION | 1% | |
economy | OTHER | 1% | |
work | OTHER | 1% | |
clients | PERSON | 1% | |
one | NUMBER | 0% | |
No comments:
Post a Comment