[PYTHON] I tried Amazon Comprehend sentiment analysis with AWS CLI.

I tried Amazon Comprehend sentiment analysis with AWS CLI.

It seems that it can be done with Amazon Comprehend.

See Detect Sentiment https://docs.aws.amazon.com/comprehend/latest/dg/API_DetectSentiment.html

I'll try it in Python this time, so I'll see the one for Python. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/comprehend.html#Comprehend.Client.detect_sentiment

At the top is what to import. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/comprehend.html

The code looks like this.

import boto3
client = boto3.client('comprehend')

response = client.detect_sentiment(
    Text='The postponement of the Tokyo Olympics is just like the world of Akira.',
    LanguageCode='ja'
)
print(response)

The result looks like this.

{'Sentiment': 'NEUTRAL', 'SentimentScore': {'Positive': 0.12571793794631958, 'Negative': 0.006899271160364151, 'Neutral': 0.8673694729804993, 'Mixed': 1.3250895790406503e-05}, 'ResponseMetadata': {'RequestId': 'e458bcfd-c85e-4314-bb01-f11b8e72ec8f', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': 'e458bcfd-c85e-4314-bb01-f11b8e72ec8f', 'content-type': 'application/x-amz-json-1.1', 'content-length': '164', 'date': 'Fri, 27 Mar 2020 04:44:21 GMT'}, 'RetryAttempts': 0}}

Recommended Posts

I tried Amazon Comprehend sentiment analysis with AWS CLI.
I tried multiple regression analysis with polynomial regression
I tried using Amazon SQS with django-celery
I tried factor analysis with Titanic data!
I tried principal component analysis with Titanic data!
I tried connecting AWS Lambda with other services
I tried to start Jupyter with Amazon lightsail
I tried AWS CDK!
I tried AWS Iot
[OpenCV / Python] I tried image analysis of cells with OpenCV
[Introduction to AWS] I tried playing with voice-text conversion ♪
I tried fp-growth with python
I tried Learning-to-Rank with Elasticsearch!
Sentiment analysis with Python (word2vec)
I tried clustering with PyCaret
I tried using Amazon Glacier
I tried gRPC with Python
I tried scraping with python
Text sentiment analysis with ML-Ask
I tried using AWS Chalice
I tried sending an email from Amazon SES with Python
Sentiment analysis with natural language processing! I tried to predict the evaluation from the review text
[AWS / Tello] I tried operating the drone with my voice Part2
I tried standalone deployment of play with fabric [AWS operation with boto] [Play deployment]
I tried summarizing sentences with summpy
I tried machine learning with liblinear
I tried web scraping with python.
I tried moving food with SinGAN
I tried implementing DeepPose with PyTorch
I tried face detection with MTCNN
[AWS / Tello] I tried operating the drone with my voice Part1
I played with Mecab (morphological analysis)!
I tried running prolog with python 3.8.2.
I tried SMTP communication with Python
I tried sentence generation with GPT-2
I tried learning LightGBM with Yellowbrick
I tried face recognition with OpenCV
I tried to delete bad tweets regularly with AWS Lambda + Twitter API
[AWS] [GCP] I tried to make cloud services easy to use with Python
I tried fMRI data analysis with python (Introduction to brain information decoding)
I tried to make a url shortening service serverless with AWS CDK
I tried sending an SMS with Twilio
I tried to implement Autoencoder with TensorFlow
I tried linebot with flask (anaconda) + heroku
I tried to visualize AutoEncoder with TensorFlow
I tried to get started with Hy
I tried scraping Yahoo News with Python
I tried time series analysis! (AR model)
I tried using Selenium with Headless chrome
I tried learning with Kaggle's Titanic (kaggle②)
I tried sending an email with python.
I tried non-photorealistic rendering with Python + opencv
I am making my own aws cli
I want to play with aws with python
I tried a functional language with Python
Sentiment analysis of tweets with deep learning
I tried batch normalization with PyTorch (+ note)
I tried recursion with Python ② (Fibonacci sequence)
I tried implementing DeepPose with PyTorch PartⅡ
I tried to implement CVAE with PyTorch
I tried playing with the image with Pillow